Re: headerscheck warnings with late-model gcc

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-08-07T14:15:19Z
Lists: pgsql-hackers

Attachments

On 06.08.25 21:11, Tom Lane wrote:
> Peter Eisentraut <peter@eisentraut.org> writes:
>> On 05.08.25 20:09, Tom Lane wrote:
>>> Curiously, no such complaints appear with cpluspluscheck (which is
>>> using g++ 15.1.1).  I don't really understand why not ...
> 
>> -Wmissing-variable-declarations is added by us as of PG18 (commit
>> 66188912566).  It's available since gcc 14 and doesn't exist for C++.
> 
> Oh!  Okay, that explains the lack of messages, but it still seems
> like an odd omission.

Yeah, this is pretty much my fault for not checking this for the above 
commit.

I've been having a hard time getting headerscheck to work reliably in my 
environment, so I ended up relying on CI, which doesn't have new-enough 
compilers yet (and/or doesn't run it everywhere; the clang on the 
FreeBSD task might have caught it (but we also don't have this 
integrated with meson yet)).

Attached are three patches to fix some unrelated problems with 
headerscheck in my environment.

The fourth one is to fix the ecpg issue; I think we can ignore it under 
the "code fragment" category.

kwlist_d.h doesn't show up in my run, probably because I'm using a 
separate build directory, which headerscheck doesn't handle?  Another 
thing to fix.  But I guess it would also fall under the code fragment 
category?

But the code fragment exception is also faulty, because we plausibly do 
want to check that file for C++ compatibility, just not necessarily as a 
standalone file.  Not sure how to cover all these bases at once.

Commits

  1. Silence -Wmissing-variable-declarations in headerscheck.

  2. headerscheck: Document that --with-llvm is required

  3. headerscheck: Ignore Windows-specific header

  4. headerscheck: Use ICU_CFLAGS

  5. Add -Wmissing-variable-declarations to the standard compilation flags