Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit85c077f

Browse files
committed
Suppress variable-set-but-not-used warnings from clang 15.
clang 15+ will issue a set-but-not-used warning when the onlyuse of a variable is in autoincrements (e.g., "foo++;").That's perfectly sensible, but it detects a few more cases thatwe'd not noticed before. Silence the warnings with our usualmethods, such as PG_USED_FOR_ASSERTS_ONLY, or in one case byactually removing a useless variable.One thing that we can't nicely get rid of is that with %pure-parser,Bison emits "yynerrs" as a local variable that falls foul of thiswarning. To silence those, I inserted "(void) yynerrs;" in thetop-level productions of affected grammars.Per recently-established project policy, this is a candidatefor back-patching into out-of-support branches: it suppressesannoying compiler warnings but changes no behavior. Hence,back-patch to 9.5, which is as far as these patches go withoutissues. (A preliminary check shows that the prior branchesneed some other set-but-not-used cleanups too, so I'll leavethem for another day.)Discussion:https://postgr.es/m/514615.1663615243@sss.pgh.pa.us
1 parentd4c1618 commit85c077f

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

‎src/backend/access/gist/gistxlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ gistRedoPageUpdateRecord(XLogReaderState *record)
255255
char*begin;
256256
char*data;
257257
Sizedatalen;
258-
intninserted=0;
258+
intninsertedPG_USED_FOR_ASSERTS_ONLY=0;
259259

260260
data=begin=XLogRecGetBlockData(record,0,&datalen);
261261

‎src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1923,7 +1923,7 @@ AdvanceXLInsertBuffer(XLogRecPtr upto, bool opportunistic)
19231923
XLogRecPtrNewPageEndPtr=InvalidXLogRecPtr;
19241924
XLogRecPtrNewPageBeginPtr;
19251925
XLogPageHeaderNewPage;
1926-
intnpages=0;
1926+
intnpagespg_attribute_unused()=0;
19271927

19281928
LWLockAcquire(WALBufMappingLock,LW_EXCLUSIVE);
19291929

‎src/backend/parser/gram.y

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
734734
stmtblock:stmtmulti
735735
{
736736
pg_yyget_extra(yyscanner)->parsetree = $1;
737+
(void)yynerrs;/* suppress compiler warning*/
737738
}
738739
;
739740

‎src/backend/utils/adt/array_typanalyze.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
216216
{
217217
ArrayAnalyzeExtraData*extra_data;
218218
intnum_mcelem;
219-
intnull_cnt=0;
220219
intnull_elem_cnt=0;
221220
intanalyzed_rows=0;
222221

@@ -320,8 +319,7 @@ compute_array_stats(VacAttrStats *stats, AnalyzeAttrFetchFunc fetchfunc,
320319
value=fetchfunc(stats,array_no,&isnull);
321320
if (isnull)
322321
{
323-
/* array is null, just count that */
324-
null_cnt++;
322+
/* ignore arrays that are null overall */
325323
continue;
326324
}
327325

‎src/bin/pgbench/exprparse.y

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ static PgBenchExpr *make_func(yyscan_t yyscanner, int fnumber, PgBenchExprList *
6060

6161
%%
6262

63-
result:expr{ expr_parse_result =$1; }
63+
result:expr{
64+
expr_parse_result =$1;
65+
(void)yynerrs;/* suppress compiler warning*/
66+
}
6467

6568
elist: {$$ =NULL; }
6669
|expr {$$ = make_elist($1,NULL); }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp