Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c051180

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 d5e1d5e commit c051180

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
@@ -199,7 +199,7 @@ bt_index_check_internal(Oid indrelid, bool parentcheck)
199199
else
200200
{
201201
heaprel = NULL;
202-
/* for "gcc -Og" https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78394 */
202+
/* Set these just to suppress "uninitialized variable" warnings */
203203
save_userid = InvalidOid;
204204
save_sec_context = -1;
205205
save_nestlevel = -1;

src/backend/access/brin/brin.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,13 @@ brin_summarize_range(PG_FUNCTION_ARGS)
913913
save_nestlevel = NewGUCNestLevel();
914914
}
915915
else
916+
{
916917
heapRel = NULL;
918+
/* Set these just to suppress "uninitialized variable" warnings */
919+
save_userid = InvalidOid;
920+
save_sec_context = -1;
921+
save_nestlevel = -1;
922+
}
917923

918924
indexRel = index_open(indexoid, ShareUpdateExclusiveLock);
919925

0 commit comments

Comments
 (0)