Skip to content

Commit dd672be

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 c085387 commit dd672be

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
@@ -263,7 +263,7 @@ bt_index_check_internal(Oid indrelid, bool parentcheck, bool heapallindexed,
263263
else
264264
{
265265
heaprel = NULL;
266-
/* for "gcc -Og" https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78394 */
266+
/* Set these just to suppress "uninitialized variable" warnings */
267267
save_userid = InvalidOid;
268268
save_sec_context = -1;
269269
save_nestlevel = -1;

src/backend/access/brin/brin.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,13 @@ brin_summarize_range(PG_FUNCTION_ARGS)
919919
save_nestlevel = NewGUCNestLevel();
920920
}
921921
else
922+
{
922923
heapRel = NULL;
924+
/* Set these just to suppress "uninitialized variable" warnings */
925+
save_userid = InvalidOid;
926+
save_sec_context = -1;
927+
save_nestlevel = -1;
928+
}
923929

924930
indexRel = index_open(indexoid, ShareUpdateExclusiveLock);
925931

0 commit comments

Comments
 (0)