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:
parent
e3ce2de09d
commit
3e0fff2e68
|
@ -240,7 +240,6 @@ hash_xlog_add_ovfl_page(XLogReaderState *record)
|
||||||
{
|
{
|
||||||
Page mappage = (Page) BufferGetPage(mapbuffer);
|
Page mappage = (Page) BufferGetPage(mapbuffer);
|
||||||
uint32 *freep = NULL;
|
uint32 *freep = NULL;
|
||||||
char *data;
|
|
||||||
uint32 *bitmap_page_bit;
|
uint32 *bitmap_page_bit;
|
||||||
|
|
||||||
freep = HashPageGetBitmap(mappage);
|
freep = HashPageGetBitmap(mappage);
|
||||||
|
|
|
@ -1614,7 +1614,6 @@ mXactCachePut(MultiXactId multi, int nmembers, MultiXactMember *members)
|
||||||
if (MXactCacheMembers++ >= MAX_CACHE_ENTRIES)
|
if (MXactCacheMembers++ >= MAX_CACHE_ENTRIES)
|
||||||
{
|
{
|
||||||
dlist_node *node;
|
dlist_node *node;
|
||||||
mXactCacheEnt *entry;
|
|
||||||
|
|
||||||
node = dlist_tail_node(&MXactCache);
|
node = dlist_tail_node(&MXactCache);
|
||||||
dlist_delete(node);
|
dlist_delete(node);
|
||||||
|
|
|
@ -3036,8 +3036,7 @@ XLogFileInitInternal(XLogSegNo logsegno, TimeLineID logtli,
|
||||||
pgstat_report_wait_start(WAIT_EVENT_WAL_INIT_SYNC);
|
pgstat_report_wait_start(WAIT_EVENT_WAL_INIT_SYNC);
|
||||||
if (pg_fsync(fd) != 0)
|
if (pg_fsync(fd) != 0)
|
||||||
{
|
{
|
||||||
int save_errno = errno;
|
save_errno = errno;
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
errno = save_errno;
|
errno = save_errno;
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
|
@ -4721,7 +4720,6 @@ XLogInitNewTimeline(TimeLineID endTLI, XLogRecPtr endOfLog, TimeLineID newTLI)
|
||||||
|
|
||||||
if (close(fd) != 0)
|
if (close(fd) != 0)
|
||||||
{
|
{
|
||||||
char xlogfname[MAXFNAMELEN];
|
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
|
|
||||||
XLogFileName(xlogfname, newTLI, startLogSegNo, wal_segment_size);
|
XLogFileName(xlogfname, newTLI, startLogSegNo, wal_segment_size);
|
||||||
|
|
|
@ -121,7 +121,6 @@ compute_return_type(TypeName *returnType, Oid languageOid,
|
||||||
{
|
{
|
||||||
char *typnam = TypeNameToString(returnType);
|
char *typnam = TypeNameToString(returnType);
|
||||||
Oid namespaceId;
|
Oid namespaceId;
|
||||||
AclResult aclresult;
|
|
||||||
char *typname;
|
char *typname;
|
||||||
ObjectAddress address;
|
ObjectAddress address;
|
||||||
|
|
||||||
|
@ -1112,8 +1111,6 @@ CreateFunction(ParseState *pstate, CreateFunctionStmt *stmt)
|
||||||
if (languageStruct->lanpltrusted)
|
if (languageStruct->lanpltrusted)
|
||||||
{
|
{
|
||||||
/* if trusted language, need USAGE privilege */
|
/* if trusted language, need USAGE privilege */
|
||||||
AclResult aclresult;
|
|
||||||
|
|
||||||
aclresult = pg_language_aclcheck(languageOid, GetUserId(), ACL_USAGE);
|
aclresult = pg_language_aclcheck(languageOid, GetUserId(), ACL_USAGE);
|
||||||
if (aclresult != ACLCHECK_OK)
|
if (aclresult != ACLCHECK_OK)
|
||||||
aclcheck_error(aclresult, OBJECT_LANGUAGE,
|
aclcheck_error(aclresult, OBJECT_LANGUAGE,
|
||||||
|
|
|
@ -16796,7 +16796,6 @@ PreCommit_on_commit_actions(void)
|
||||||
if (oids_to_drop != NIL)
|
if (oids_to_drop != NIL)
|
||||||
{
|
{
|
||||||
ObjectAddresses *targetObjects = new_object_addresses();
|
ObjectAddresses *targetObjects = new_object_addresses();
|
||||||
ListCell *l;
|
|
||||||
|
|
||||||
foreach(l, oids_to_drop)
|
foreach(l, oids_to_drop)
|
||||||
{
|
{
|
||||||
|
|
|
@ -233,8 +233,6 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel)
|
||||||
*/
|
*/
|
||||||
if (!(params.options & VACOPT_ANALYZE))
|
if (!(params.options & VACOPT_ANALYZE))
|
||||||
{
|
{
|
||||||
ListCell *lc;
|
|
||||||
|
|
||||||
foreach(lc, vacstmt->rels)
|
foreach(lc, vacstmt->rels)
|
||||||
{
|
{
|
||||||
VacuumRelation *vrel = lfirst_node(VacuumRelation, lc);
|
VacuumRelation *vrel = lfirst_node(VacuumRelation, lc);
|
||||||
|
|
|
@ -768,7 +768,6 @@ ExecInitPartitionInfo(ModifyTableState *mtstate, EState *estate,
|
||||||
{
|
{
|
||||||
List *onconflset;
|
List *onconflset;
|
||||||
List *onconflcols;
|
List *onconflcols;
|
||||||
bool found_whole_row;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Translate expressions in onConflictSet to account for
|
* Translate expressions in onConflictSet to account for
|
||||||
|
|
|
@ -2062,12 +2062,13 @@ ExecWindowAgg(PlanState *pstate)
|
||||||
if (winstate->all_first)
|
if (winstate->all_first)
|
||||||
{
|
{
|
||||||
int frameOptions = winstate->frameOptions;
|
int frameOptions = winstate->frameOptions;
|
||||||
ExprContext *econtext = winstate->ss.ps.ps_ExprContext;
|
|
||||||
Datum value;
|
Datum value;
|
||||||
bool isnull;
|
bool isnull;
|
||||||
int16 len;
|
int16 len;
|
||||||
bool byval;
|
bool byval;
|
||||||
|
|
||||||
|
econtext = winstate->ss.ps.ps_ExprContext;
|
||||||
|
|
||||||
if (frameOptions & FRAMEOPTION_START_OFFSET)
|
if (frameOptions & FRAMEOPTION_START_OFFSET)
|
||||||
{
|
{
|
||||||
Assert(winstate->startOffset != NULL);
|
Assert(winstate->startOffset != NULL);
|
||||||
|
|
|
@ -565,8 +565,6 @@ intset_is_member(IntegerSet *intset, uint64 x)
|
||||||
*/
|
*/
|
||||||
if (intset->num_buffered_values > 0 && x >= intset->buffered_values[0])
|
if (intset->num_buffered_values > 0 && x >= intset->buffered_values[0])
|
||||||
{
|
{
|
||||||
int itemno;
|
|
||||||
|
|
||||||
itemno = intset_binsrch_uint64(x,
|
itemno = intset_binsrch_uint64(x,
|
||||||
intset->buffered_values,
|
intset->buffered_values,
|
||||||
intset->num_buffered_values,
|
intset->num_buffered_values,
|
||||||
|
|
|
@ -1652,8 +1652,6 @@ interpret_ident_response(const char *ident_response,
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i; /* Index into *ident_user */
|
|
||||||
|
|
||||||
cursor++; /* Go over colon */
|
cursor++; /* Go over colon */
|
||||||
while (pg_isblank(*cursor))
|
while (pg_isblank(*cursor))
|
||||||
cursor++; /* skip blanks */
|
cursor++; /* skip blanks */
|
||||||
|
|
|
@ -361,7 +361,6 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel)
|
||||||
if (bitjoinpaths != NIL)
|
if (bitjoinpaths != NIL)
|
||||||
{
|
{
|
||||||
List *all_path_outers;
|
List *all_path_outers;
|
||||||
ListCell *lc;
|
|
||||||
|
|
||||||
/* Identify each distinct parameterization seen in bitjoinpaths */
|
/* Identify each distinct parameterization seen in bitjoinpaths */
|
||||||
all_path_outers = NIL;
|
all_path_outers = NIL;
|
||||||
|
@ -2188,7 +2187,7 @@ match_clause_to_index(PlannerInfo *root,
|
||||||
/* Ignore duplicates */
|
/* Ignore duplicates */
|
||||||
foreach(lc, clauseset->indexclauses[indexcol])
|
foreach(lc, clauseset->indexclauses[indexcol])
|
||||||
{
|
{
|
||||||
IndexClause *iclause = (IndexClause *) lfirst(lc);
|
iclause = (IndexClause *) lfirst(lc);
|
||||||
|
|
||||||
if (iclause->rinfo == rinfo)
|
if (iclause->rinfo == rinfo)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -3484,8 +3484,6 @@ get_number_of_groups(PlannerInfo *root,
|
||||||
|
|
||||||
if (gd->hash_sets_idx)
|
if (gd->hash_sets_idx)
|
||||||
{
|
{
|
||||||
ListCell *lc;
|
|
||||||
|
|
||||||
gd->dNumHashGroups = 0;
|
gd->dNumHashGroups = 0;
|
||||||
|
|
||||||
groupExprs = get_sortgrouplist_exprs(parse->groupClause,
|
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;
|
Path *cheapest_input_path = input_rel->cheapest_total_path;
|
||||||
double numDistinctRows;
|
double numDistinctRows;
|
||||||
bool allow_hash;
|
bool allow_hash;
|
||||||
Path *path;
|
|
||||||
ListCell *lc;
|
|
||||||
|
|
||||||
/* Estimate number of distinct rows there will be */
|
/* Estimate number of distinct rows there will be */
|
||||||
if (parse->groupClause || parse->groupingSets || parse->hasAggs ||
|
if (parse->groupClause || parse->groupingSets || parse->hasAggs ||
|
||||||
|
@ -4766,6 +4762,8 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
||||||
* the other.)
|
* the other.)
|
||||||
*/
|
*/
|
||||||
List *needed_pathkeys;
|
List *needed_pathkeys;
|
||||||
|
Path *path;
|
||||||
|
ListCell *lc;
|
||||||
|
|
||||||
if (parse->hasDistinctOn &&
|
if (parse->hasDistinctOn &&
|
||||||
list_length(root->distinct_pathkeys) <
|
list_length(root->distinct_pathkeys) <
|
||||||
|
@ -4776,7 +4774,7 @@ create_final_distinct_paths(PlannerInfo *root, RelOptInfo *input_rel,
|
||||||
|
|
||||||
foreach(lc, input_rel->pathlist)
|
foreach(lc, input_rel->pathlist)
|
||||||
{
|
{
|
||||||
Path *path = (Path *) lfirst(lc);
|
path = (Path *) lfirst(lc);
|
||||||
|
|
||||||
if (pathkeys_contained_in(needed_pathkeys, path->pathkeys))
|
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)
|
if (enable_incremental_sort && list_length(root->sort_pathkeys) > 1)
|
||||||
{
|
{
|
||||||
ListCell *lc;
|
|
||||||
|
|
||||||
foreach(lc, input_rel->partial_pathlist)
|
foreach(lc, input_rel->partial_pathlist)
|
||||||
{
|
{
|
||||||
Path *input_path = (Path *) lfirst(lc);
|
Path *input_path = (Path *) lfirst(lc);
|
||||||
|
@ -7607,7 +7603,6 @@ apply_scanjoin_target_to_paths(PlannerInfo *root,
|
||||||
AppendRelInfo **appinfos;
|
AppendRelInfo **appinfos;
|
||||||
int nappinfos;
|
int nappinfos;
|
||||||
List *child_scanjoin_targets = NIL;
|
List *child_scanjoin_targets = NIL;
|
||||||
ListCell *lc;
|
|
||||||
|
|
||||||
Assert(child_rel != NULL);
|
Assert(child_rel != NULL);
|
||||||
|
|
||||||
|
|
|
@ -2554,8 +2554,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
||||||
|
|
||||||
case T_Append:
|
case T_Append:
|
||||||
{
|
{
|
||||||
ListCell *l;
|
|
||||||
|
|
||||||
foreach(l, ((Append *) plan)->appendplans)
|
foreach(l, ((Append *) plan)->appendplans)
|
||||||
{
|
{
|
||||||
context.paramids =
|
context.paramids =
|
||||||
|
@ -2571,8 +2569,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
||||||
|
|
||||||
case T_MergeAppend:
|
case T_MergeAppend:
|
||||||
{
|
{
|
||||||
ListCell *l;
|
|
||||||
|
|
||||||
foreach(l, ((MergeAppend *) plan)->mergeplans)
|
foreach(l, ((MergeAppend *) plan)->mergeplans)
|
||||||
{
|
{
|
||||||
context.paramids =
|
context.paramids =
|
||||||
|
@ -2588,8 +2584,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
||||||
|
|
||||||
case T_BitmapAnd:
|
case T_BitmapAnd:
|
||||||
{
|
{
|
||||||
ListCell *l;
|
|
||||||
|
|
||||||
foreach(l, ((BitmapAnd *) plan)->bitmapplans)
|
foreach(l, ((BitmapAnd *) plan)->bitmapplans)
|
||||||
{
|
{
|
||||||
context.paramids =
|
context.paramids =
|
||||||
|
@ -2605,8 +2599,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
||||||
|
|
||||||
case T_BitmapOr:
|
case T_BitmapOr:
|
||||||
{
|
{
|
||||||
ListCell *l;
|
|
||||||
|
|
||||||
foreach(l, ((BitmapOr *) plan)->bitmapplans)
|
foreach(l, ((BitmapOr *) plan)->bitmapplans)
|
||||||
{
|
{
|
||||||
context.paramids =
|
context.paramids =
|
||||||
|
@ -2622,8 +2614,6 @@ finalize_plan(PlannerInfo *root, Plan *plan,
|
||||||
|
|
||||||
case T_NestLoop:
|
case T_NestLoop:
|
||||||
{
|
{
|
||||||
ListCell *l;
|
|
||||||
|
|
||||||
finalize_primnode((Node *) ((Join *) plan)->joinqual,
|
finalize_primnode((Node *) ((Join *) plan)->joinqual,
|
||||||
&context);
|
&context);
|
||||||
/* collect set of params that will be passed to right child */
|
/* collect set of params that will be passed to right child */
|
||||||
|
|
|
@ -653,7 +653,6 @@ generate_union_paths(SetOperationStmt *op, PlannerInfo *root,
|
||||||
if (partial_paths_valid)
|
if (partial_paths_valid)
|
||||||
{
|
{
|
||||||
Path *ppath;
|
Path *ppath;
|
||||||
ListCell *lc;
|
|
||||||
int parallel_workers = 0;
|
int parallel_workers = 0;
|
||||||
|
|
||||||
/* Find the highest number of workers requested for any subpath. */
|
/* Find the highest number of workers requested for any subpath. */
|
||||||
|
|
|
@ -1102,7 +1102,7 @@ rebuild_database_list(Oid newdb)
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < nelems; i++)
|
for (i = 0; i < nelems; i++)
|
||||||
{
|
{
|
||||||
avl_dbase *db = &(dbary[i]);
|
db = &(dbary[i]);
|
||||||
|
|
||||||
current_time = TimestampTzPlusMilliseconds(current_time,
|
current_time = TimestampTzPlusMilliseconds(current_time,
|
||||||
millis_increment);
|
millis_increment);
|
||||||
|
|
|
@ -824,7 +824,6 @@ add_with_check_options(Relation rel,
|
||||||
{
|
{
|
||||||
RowSecurityPolicy *policy = (RowSecurityPolicy *) lfirst(item);
|
RowSecurityPolicy *policy = (RowSecurityPolicy *) lfirst(item);
|
||||||
Expr *qual = QUAL_FOR_WCO(policy);
|
Expr *qual = QUAL_FOR_WCO(policy);
|
||||||
WithCheckOption *wco;
|
|
||||||
|
|
||||||
if (qual != NULL)
|
if (qual != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1265,7 +1265,6 @@ dependency_is_compatible_expression(Node *clause, Index relid, List *statlist, N
|
||||||
else if (is_orclause(clause))
|
else if (is_orclause(clause))
|
||||||
{
|
{
|
||||||
BoolExpr *bool_expr = (BoolExpr *) clause;
|
BoolExpr *bool_expr = (BoolExpr *) clause;
|
||||||
ListCell *lc;
|
|
||||||
|
|
||||||
/* start with no expression (we'll use the first match) */
|
/* start with no expression (we'll use the first match) */
|
||||||
*expr = NULL;
|
*expr = NULL;
|
||||||
|
|
|
@ -693,7 +693,6 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
|
||||||
* quadrants if we're looking for a value strictly greater
|
* quadrants if we're looking for a value strictly greater
|
||||||
* than the maximum.
|
* than the maximum.
|
||||||
*/
|
*/
|
||||||
int cmp;
|
|
||||||
|
|
||||||
cmp = range_cmp_bounds(typcache, ¢roidLower, maxLower);
|
cmp = range_cmp_bounds(typcache, ¢roidLower, maxLower);
|
||||||
if (cmp > 0 || (!inclusive && cmp == 0))
|
if (cmp > 0 || (!inclusive && cmp == 0))
|
||||||
|
@ -721,7 +720,6 @@ spg_range_quad_inner_consistent(PG_FUNCTION_ARGS)
|
||||||
* quadrants if we're looking for a value strictly greater
|
* quadrants if we're looking for a value strictly greater
|
||||||
* than the maximum.
|
* than the maximum.
|
||||||
*/
|
*/
|
||||||
int cmp;
|
|
||||||
|
|
||||||
cmp = range_cmp_bounds(typcache, ¢roidUpper, maxUpper);
|
cmp = range_cmp_bounds(typcache, ¢roidUpper, maxUpper);
|
||||||
if (cmp > 0 || (!inclusive && cmp == 0))
|
if (cmp > 0 || (!inclusive && cmp == 0))
|
||||||
|
|
|
@ -1303,7 +1303,6 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
|
||||||
if (!heap_attisnull(ht_idx, Anum_pg_index_indexprs, NULL))
|
if (!heap_attisnull(ht_idx, Anum_pg_index_indexprs, NULL))
|
||||||
{
|
{
|
||||||
Datum exprsDatum;
|
Datum exprsDatum;
|
||||||
bool isnull;
|
|
||||||
char *exprsString;
|
char *exprsString;
|
||||||
|
|
||||||
exprsDatum = SysCacheGetAttr(INDEXRELID, ht_idx,
|
exprsDatum = SysCacheGetAttr(INDEXRELID, ht_idx,
|
||||||
|
@ -1500,7 +1499,6 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
|
||||||
{
|
{
|
||||||
Node *node;
|
Node *node;
|
||||||
Datum predDatum;
|
Datum predDatum;
|
||||||
bool isnull;
|
|
||||||
char *predString;
|
char *predString;
|
||||||
|
|
||||||
/* Convert text string to node tree */
|
/* Convert text string to node tree */
|
||||||
|
@ -1945,7 +1943,6 @@ pg_get_partkeydef_worker(Oid relid, int prettyFlags,
|
||||||
if (!heap_attisnull(tuple, Anum_pg_partitioned_table_partexprs, NULL))
|
if (!heap_attisnull(tuple, Anum_pg_partitioned_table_partexprs, NULL))
|
||||||
{
|
{
|
||||||
Datum exprsDatum;
|
Datum exprsDatum;
|
||||||
bool isnull;
|
|
||||||
char *exprsString;
|
char *exprsString;
|
||||||
|
|
||||||
exprsDatum = SysCacheGetAttr(PARTRELID, tuple,
|
exprsDatum = SysCacheGetAttr(PARTRELID, tuple,
|
||||||
|
|
|
@ -3109,7 +3109,6 @@ sendCommand(CState *st, Command *command)
|
||||||
for (j = 0; commands[j] != NULL; j++)
|
for (j = 0; commands[j] != NULL; j++)
|
||||||
{
|
{
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
char name[MAX_PREPARE_NAME];
|
|
||||||
|
|
||||||
if (commands[j]->type != SQL_COMMAND)
|
if (commands[j]->type != SQL_COMMAND)
|
||||||
continue;
|
continue;
|
||||||
|
@ -3803,8 +3802,6 @@ advanceConnectionState(TState *thread, CState *st, StatsData *agg)
|
||||||
/* quickly skip commands until something to do... */
|
/* quickly skip commands until something to do... */
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
Command *command;
|
|
||||||
|
|
||||||
command = sql_script[st->use_file].commands[st->command];
|
command = sql_script[st->use_file].commands[st->command];
|
||||||
|
|
||||||
/* cannot reach end of script in that state */
|
/* cannot reach end of script in that state */
|
||||||
|
@ -3959,8 +3956,6 @@ advanceConnectionState(TState *thread, CState *st, StatsData *agg)
|
||||||
*/
|
*/
|
||||||
if (report_per_command)
|
if (report_per_command)
|
||||||
{
|
{
|
||||||
Command *command;
|
|
||||||
|
|
||||||
pg_time_now_lazy(&now);
|
pg_time_now_lazy(&now);
|
||||||
|
|
||||||
command = sql_script[st->use_file].commands[st->command];
|
command = sql_script[st->use_file].commands[st->command];
|
||||||
|
|
Loading…
Reference in New Issue