Skip to content

Commit 4e46726

Browse files
committed
Silence compiler warnings from some older compilers.
Since a117ceb, some older gcc versions issue "variable may be used uninitialized in this function" complaints for brin_summarize_range. Silence that using the same coding pattern as in bt_index_check_internal; arguably, a117ceb had too narrow a view of which compilers might give trouble. Nathan Bossart and Tom Lane. Back-patch as the previous commit was. Discussion: https://postgr.es/m/20220601163537.GA2331988@nathanxps13
1 parent 1072e4c commit 4e46726

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

contrib/amcheck/verify_nbtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed,
283283
else
284284
{
285285
heaprel = NULL;
286-
/* for "gcc -Og" https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78394 */
286+
/* Set these just to suppress "uninitialized variable" warnings */
287287
save_userid = InvalidOid;
288288
save_sec_context = -1;
289289
save_nestlevel = -1;

src/backend/access/brin/brin.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,13 @@ brin_summarize_range(PG_FUNCTION_ARGS)
10531053
save_nestlevel = NewGUCNestLevel();
10541054
}
10551055
else
1056+
{
10561057
heapRel = NULL;
1058+
/* Set these just to suppress "uninitialized variable" warnings */
1059+
save_userid = InvalidOid;
1060+
save_sec_context = -1;
1061+
save_nestlevel = -1;
1062+
}
10571063

10581064
indexRel = index_open(indexoid, ShareUpdateExclusiveLock);
10591065

0 commit comments

Comments
 (0)