Re: Build failure with GCC 15 (defaults to -std=gnu23)

Thomas Munro <thomas.munro@gmail.com>

From: Thomas Munro <thomas.munro@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Sam James <sam@gentoo.org>, pgsql-bugs@lists.postgresql.org
Date: 2024-11-17T21:18:30Z
Lists: pgsql-bugs
On Mon, Nov 18, 2024 at 9:26 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Fun.  Well, now that we insist on C99 support in all branches,
> I wonder whether we can just remove all the non-stdbool support.
> The one thing that looks tricky is that we insist on sizeof(bool)
> being 1, but are there any remaining supported platforms where
> it isn't?  The buildfarm doesn't have any examples.

So far I have found only Apple/Darwin PPC (RIP), where this was
occasionally an issue.  Some projects would apparently compile with
-mone-byte-bool to unbreak local assumptions, but risk breaking ABI
with other libraries (as we do?).  GCC filed that switch under Darwin
options rather than somewhere more general... can we call that a clue
that it was highly unusual?

https://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html

There may be a systematic way to survey ABIs from the LLVM or GCC
source trees... hmm, I am no expert so take this with a grain of salt
but I found where the LLVM project defines BoolWidth and BoolAlign,
starting from the commit where they removed Darwin PPC support
(2fe49ea0), and it looks like it was the only target ABI that overrode
the default of 8 there (it had 32, meaning bits).

BTW animal "alligator" has just shown the failure.  Ah, yes, due to
this GCC switch being flipped a couple of days ago:

https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Require sizeof(bool) == 1.

  2. If a C23 compiler is detected, try asking for C17.

  3. Fix C23 compiler warning

  4. Rename C23 keyword

  5. Assume that <stdbool.h> conforms to the C standard.

  6. Revise tree-walk APIs to improve spec compliance & silence warnings.