Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f959bf9

Browse files
committed
Further -Wshadow=compatible-local warning fixes
These should have been included in 421892a as these shadowed variable warnings can also be fixed by adjusting the scope of the shadowed variable to put the declaration for it in an inner scope. This is part of the same effort as f01592f. By my count, this takes the warning count from 114 down to 106. Author: David Rowley and Justin Pryzby Discussion: https://postgr.es/m/CAApHDvrwLGBP%2BYw9vriayyf%3DXR4uPWP5jr6cQhP9au_kaDUhbA%40mail.gmail.com
1 parent 161355e commit f959bf9

File tree

8 files changed

+15
-12
lines changed

8 files changed

+15
-12
lines changed

src/backend/access/spgist/spgdoinsert.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ moveLeafs(Relation index, SpGistState *state,
395395
size;
396396
Buffer nbuf;
397397
Page npage;
398-
SpGistLeafTuple it;
399398
OffsetNumber r = InvalidOffsetNumber,
400399
startOffset = InvalidOffsetNumber;
401400
bool replaceDead = false;
@@ -467,6 +466,8 @@ moveLeafs(Relation index, SpGistState *state,
467466
{
468467
for (i = 0; i < nDelete; i++)
469468
{
469+
SpGistLeafTuple it;
470+
470471
it = (SpGistLeafTuple) PageGetItem(current->page,
471472
PageGetItemId(current->page, toDelete[i]));
472473
Assert(it->tupstate == SPGIST_LIVE);

src/backend/commands/trigger.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,6 @@ CreateTriggerFiringOn(CreateTrigStmt *stmt, const char *queryString,
11491149
PartitionDesc partdesc = RelationGetPartitionDesc(rel, true);
11501150
List *idxs = NIL;
11511151
List *childTbls = NIL;
1152-
ListCell *l;
11531152
int i;
11541153
MemoryContext oldcxt,
11551154
perChildCxt;
@@ -1181,6 +1180,7 @@ CreateTriggerFiringOn(CreateTrigStmt *stmt, const char *queryString,
11811180
for (i = 0; i < partdesc->nparts; i++)
11821181
{
11831182
Oid indexOnChild = InvalidOid;
1183+
ListCell *l;
11841184
ListCell *l2;
11851185
CreateTrigStmt *childStmt;
11861186
Relation childTbl;

src/backend/executor/nodeHash.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,6 @@ static void
10801080
ExecParallelHashIncreaseNumBatches(HashJoinTable hashtable)
10811081
{
10821082
ParallelHashJoinState *pstate = hashtable->parallel_state;
1083-
int i;
10841083

10851084
Assert(BarrierPhase(&pstate->build_barrier) == PHJ_BUILD_HASHING_INNER);
10861085

@@ -1244,7 +1243,7 @@ ExecParallelHashIncreaseNumBatches(HashJoinTable hashtable)
12441243
ExecParallelHashTableSetCurrentBatch(hashtable, 0);
12451244

12461245
/* Are any of the new generation of batches exhausted? */
1247-
for (i = 0; i < hashtable->nbatch; ++i)
1246+
for (int i = 0; i < hashtable->nbatch; ++i)
12481247
{
12491248
ParallelHashJoinBatch *batch = hashtable->batches[i].shared;
12501249

src/backend/optimizer/plan/planner.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1981,7 +1981,6 @@ preprocess_grouping_sets(PlannerInfo *root)
19811981
Query *parse = root->parse;
19821982
List *sets;
19831983
int maxref = 0;
1984-
ListCell *lc;
19851984
ListCell *lc_set;
19861985
grouping_sets_data *gd = palloc0(sizeof(grouping_sets_data));
19871986

@@ -2024,6 +2023,7 @@ preprocess_grouping_sets(PlannerInfo *root)
20242023
if (!bms_is_empty(gd->unsortable_refs))
20252024
{
20262025
List *sortable_sets = NIL;
2026+
ListCell *lc;
20272027

20282028
foreach(lc, parse->groupingSets)
20292029
{

src/backend/tsearch/ts_typanalyze.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ compute_tsvector_stats(VacAttrStats *stats,
161161
int vector_no,
162162
lexeme_no;
163163
LexemeHashKey hash_key;
164-
TrackItem *item;
165164

166165
/*
167166
* We want statistics_target * 10 lexemes in the MCELEM array. This
@@ -240,6 +239,7 @@ compute_tsvector_stats(VacAttrStats *stats,
240239
curentryptr = ARRPTR(vector);
241240
for (j = 0; j < vector->size; j++)
242241
{
242+
TrackItem *item;
243243
bool found;
244244

245245
/*
@@ -296,6 +296,7 @@ compute_tsvector_stats(VacAttrStats *stats,
296296
int nonnull_cnt = samplerows - null_cnt;
297297
int i;
298298
TrackItem **sort_table;
299+
TrackItem *item;
299300
int track_len;
300301
int cutoff_freq;
301302
int minfreq,

src/backend/utils/adt/levenshtein.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ varstr_levenshtein(const char *source, int slen,
8181
int *prev;
8282
int *curr;
8383
int *s_char_len = NULL;
84-
int i,
85-
j;
84+
int j;
8685
const char *y;
8786

8887
/*
@@ -217,7 +216,7 @@ varstr_levenshtein(const char *source, int slen,
217216
* To transform the first i characters of s into the first 0 characters of
218217
* t, we must perform i deletions.
219218
*/
220-
for (i = START_COLUMN; i < STOP_COLUMN; i++)
219+
for (int i = START_COLUMN; i < STOP_COLUMN; i++)
221220
prev[i] = i * del_c;
222221

223222
/* Loop through rows of the notional array */
@@ -226,6 +225,7 @@ varstr_levenshtein(const char *source, int slen,
226225
int *temp;
227226
const char *x = source;
228227
int y_char_len = n != tlen + 1 ? pg_mblen(y) : 1;
228+
int i;
229229

230230
#ifdef LEVENSHTEIN_LESS_EQUAL
231231

src/backend/utils/adt/rangetypes_gist.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -1322,8 +1322,7 @@ range_gist_double_sorting_split(TypeCacheEntry *typcache,
13221322
ConsiderSplitContext context;
13231323
OffsetNumber i,
13241324
maxoff;
1325-
RangeType *range,
1326-
*left_range = NULL,
1325+
RangeType *left_range = NULL,
13271326
*right_range = NULL;
13281327
int common_entries_count;
13291328
NonEmptyRange *by_lower,
@@ -1518,6 +1517,7 @@ range_gist_double_sorting_split(TypeCacheEntry *typcache,
15181517
*/
15191518
for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
15201519
{
1520+
RangeType *range;
15211521
RangeBound lower,
15221522
upper;
15231523
bool empty;
@@ -1593,6 +1593,7 @@ range_gist_double_sorting_split(TypeCacheEntry *typcache,
15931593
*/
15941594
for (i = 0; i < common_entries_count; i++)
15951595
{
1596+
RangeType *range;
15961597
int idx = common_entries[i].index;
15971598

15981599
range = DatumGetRangeTypeP(entryvec->vector[idx].key);

src/backend/utils/adt/ruleutils.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1615,7 +1615,6 @@ pg_get_statisticsobj_worker(Oid statextid, bool columns_only, bool missing_ok)
16151615
ArrayType *arr;
16161616
char *enabled;
16171617
Datum datum;
1618-
bool isnull;
16191618
bool ndistinct_enabled;
16201619
bool dependencies_enabled;
16211620
bool mcv_enabled;
@@ -1668,6 +1667,8 @@ pg_get_statisticsobj_worker(Oid statextid, bool columns_only, bool missing_ok)
16681667

16691668
if (!columns_only)
16701669
{
1670+
bool isnull;
1671+
16711672
nsp = get_namespace_name_or_temp(statextrec->stxnamespace);
16721673
appendStringInfo(&buf, "CREATE STATISTICS %s",
16731674
quote_qualified_identifier(nsp,

0 commit comments

Comments
 (0)