From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | headerscheck warnings with late-model gcc |
Date: | 2025-08-05 18:09:47 |
Message-ID: | 1127775.1754417387@sss.pgh.pa.us |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Using gcc 15.1.1 (from Fedora 42) I see these warnings that
didn't appear with older gcc:
$ src/tools/pginclude/headerscheck
In file included from /tmp/headerscheck.xp0AI5/test.c:2:
./src/common/kwlist_d.h:1163:23: warning: no previous declaration for 'ScanKeywords' [-Wmissing-variable-declarations]
1163 | const ScanKeywordList ScanKeywords = {
| ^~~~~~~~~~~~
In file included from /tmp/headerscheck.xp0AI5/test.c:2:
./src/interfaces/ecpg/test/preproc/strings.h:1:13: warning: no previous declaration for 's1' [-Wmissing-variable-declarations]
1 | char *s1,
| ^~
./src/interfaces/ecpg/test/preproc/strings.h:2:21: warning: no previous declaration for 's2' [-Wmissing-variable-declarations]
2 | *s2,
| ^~
./src/interfaces/ecpg/test/preproc/strings.h:3:21: warning: no previous declaration for 's3' [-Wmissing-variable-declarations]
3 | *s3,
| ^~
./src/interfaces/ecpg/test/preproc/strings.h:4:21: warning: no previous declaration for 's4' [-Wmissing-variable-declarations]
4 | *s4,
| ^~
./src/interfaces/ecpg/test/preproc/strings.h:5:21: warning: no previous declaration for 's5' [-Wmissing-variable-declarations]
5 | *s5,
| ^~
./src/interfaces/ecpg/test/preproc/strings.h:6:21: warning: no previous declaration for 's6' [-Wmissing-variable-declarations]
6 | *s6,
| ^~
./src/interfaces/ecpg/test/preproc/strings.h:7:21: warning: no previous declaration for 's7' [-Wmissing-variable-declarations]
7 | *s7,
| ^~
./src/interfaces/ecpg/test/preproc/strings.h:8:21: warning: no previous declaration for 's8' [-Wmissing-variable-declarations]
8 | *s8;
| ^~
While we could possibly get away with making headerscheck ignore that
ecpg test header, it seems unwise to skip kwlist_d.h. So I propose
the attached patch, which I've confirmed silences these warnings.
Curiously, no such complaints appear with cpluspluscheck (which is
using g++ 15.1.1). I don't really understand why not: why would
they have turned on -Wmissing-variable-declarations by default
for C but not C++? But anyway, since there doesn't seem to be
any C++ compatibility issue here, I think it's sufficient to fix
this in master and not back-patch.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
silence-Wmissing-variable-declarations.patch | text/x-diff | 2.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-08-05 18:11:35 | Re: Bug in brin_minmax_multi_distance_numeric() |
Previous Message | Peter Eisentraut | 2025-08-05 18:06:26 | Re: Datum as struct |