1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-25 20:23:07 +03:00

More -Wshadow=compatible-local warning fixes

In a similar effort to f01592f91, here we're targetting fixing the
warnings where we've deemed the shadowing variable to serve a close enough
purpose to the shadowed variable just to reuse the shadowed version and
not declare the shadowing variable at all.

By my count, this takes the warning count from 106 down to 71.

Author: Justin Pryzby
Discussion: https://postgr.es/m/20220825020839.GT2342@telsasoft.com
This commit is contained in:
David Rowley
2022-08-26 02:35:40 +12:00
parent e3ce2de09d
commit 3e0fff2e68
20 changed files with 8 additions and 51 deletions

View File

@@ -361,7 +361,6 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel)
if (bitjoinpaths != NIL)
{
List *all_path_outers;
ListCell *lc;
/* Identify each distinct parameterization seen in bitjoinpaths */
all_path_outers = NIL;
@@ -2188,7 +2187,7 @@ match_clause_to_index(PlannerInfo *root,
/* Ignore duplicates */
foreach(lc, clauseset->indexclauses[indexcol])
{
IndexClause *iclause = (IndexClause *) lfirst(lc);
iclause = (IndexClause *) lfirst(lc);
if (iclause->rinfo == rinfo)
return;

View File

@@ -3484,8 +3484,6 @@ get_number_of_groups(PlannerInfo *root,
if (gd->hash_sets_idx)
{
ListCell *lc;
gd->dNumHashGroups = 0;
groupExprs = get_sortgrouplist_exprs(parse->groupClause,
@@ -4720,8 +4718,6 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo *input_rel,
Path *cheapest_input_path = input_rel->cheapest_total_path;
double numDistinctRows;
bool allow_hash;
Path *path;
ListCell *lc;
/* Estimate number of distinct rows there will be */
if (parse->groupClause || parse->groupingSets || parse->hasAggs ||
@@ -4766,6 +4762,8 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo *input_rel,
* the other.)
*/
List *needed_pathkeys;
Path *path;
ListCell *lc;
if (parse->hasDistinctOn &&
list_length(root->distinct_pathkeys) <
@@ -4776,7 +4774,7 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo *input_rel,
foreach(lc, input_rel->pathlist)
{
Path *path = (Path *) lfirst(lc);
path = (Path *) lfirst(lc);
if (pathkeys_contained_in(needed_pathkeys, path->pathkeys))
{
@@ -5034,8 +5032,6 @@ create_ordered_paths(PlannerInfo *root,
*/
if (enable_incremental_sort && list_length(root->sort_pathkeys) > 1)
{
ListCell *lc;
foreach(lc, input_rel->partial_pathlist)
{
Path *input_path = (Path *) lfirst(lc);
@@ -7607,7 +7603,6 @@ apply_scanjoin_target_to_paths(PlannerInfo *root,
AppendRelInfo **appinfos;
int nappinfos;
List *child_scanjoin_targets = NIL;
ListCell *lc;
Assert(child_rel != NULL);

View File

@@ -2554,8 +2554,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
case T_Append:
{
ListCell *l;
foreach(l, ((Append *) plan)->appendplans)
{
context.paramids =
@@ -2571,8 +2569,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
case T_MergeAppend:
{
ListCell *l;
foreach(l, ((MergeAppend *) plan)->mergeplans)
{
context.paramids =
@@ -2588,8 +2584,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
case T_BitmapAnd:
{
ListCell *l;
foreach(l, ((BitmapAnd *) plan)->bitmapplans)
{
context.paramids =
@@ -2605,8 +2599,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
case T_BitmapOr:
{
ListCell *l;
foreach(l, ((BitmapOr *) plan)->bitmapplans)
{
context.paramids =
@@ -2622,8 +2614,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
case T_NestLoop:
{
ListCell *l;
finalize_primnode((Node *) ((Join *) plan)->joinqual,
&context);
/* collect set of params that will be passed to right child */

View File

@@ -653,7 +653,6 @@ generate_union_paths(SetOperationStmt *op, PlannerInfo *root,
if (partial_paths_valid)
{
Path *ppath;
ListCell *lc;
int parallel_workers = 0;
/* Find the highest number of workers requested for any subpath. */