postgresql/src
Thomas Munro 15a89e2cc5 Assume that <stdbool.h> conforms to the C standard.
Previously we checked "for <stdbool.h> that conforms to C99" using
autoconf's AC_HEADER_STDBOOL macro.  We've required C99 since PostgreSQL
12, so the test was redundant, and under C23 it was broken: autoconf
2.69's implementation doesn't understand C23's new empty header (the
macros it's looking for went away, replaced by language keywords).
Later autoconf versions fixed that, but let's just remove the
anachronistic test.

HAVE_STDBOOL_H and HAVE__BOOL will no longer be defined, but they
weren't directly tested in core or likely extensions (except in 11, see
below).  PG_USE_STDBOOL (or USE_STDBOOL in 11 and 12) is still defined
when sizeof(bool) is 1, which should be true on all modern systems.
Otherwise we define our own bool type and values of size 1, which would
fail to compile under C23 as revealed by the broken test.  (We'll
probably clean that dead code up in master, but here we want a minimal
back-patchable change.)

This came to our attention when GCC 15 recently started using using C23
by default and failed to compile the replacement code, as reported by
Sam James and build farm animal alligator.

Back-patch to all supported releases, and then two older versions that
also know about <stdbool.h>, per the recently-out-of-support policy[1].
12 requires C99 so it's much like the supported releases, but 11 only
assumes C89 so it now uses AC_CHECK_HEADERS instead of the overly picky
AC_HEADER_STDBOOL.  (I could find no discussion of which historical
systems had <stdbool.h> but failed the conformance test; if they ever
existed, they surely aren't relevant to that policy's goals.)

[1] https://wiki.postgresql.org/wiki/Committing_checklist#Policies

Reported-by: Sam James <sam@gentoo.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> (master version)
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> (approach)
Discussion: https://www.postgresql.org/message-id/flat/87o72eo9iu.fsf%40gentoo.org
2024-11-25 20:53:07 +13:00
..
backend Fix per-session activation of ALTER {ROLE|DATABASE} SET role. 2024-11-15 20:40:00 -08:00
bin Translation updates 2024-11-11 13:59:28 +01:00
common
fe_utils
include Assume that <stdbool.h> conforms to the C standard. 2024-11-25 20:53:07 +13:00
interfaces Stamp 12.22. 2024-11-18 15:41:03 -05:00
makefiles
pl Fix cross-version upgrade tests. 2024-11-11 13:57:41 -05:00
port Stamp 12.22. 2024-11-18 15:41:03 -05:00
template
test Fix per-session activation of ALTER {ROLE|DATABASE} SET role. 2024-11-15 20:40:00 -08:00
timezone Update time zone data files to tzdata release 2024b. 2024-10-29 11:50:14 -04:00
tools src/tools/msvc: Respect REGRESS_OPTS in plcheck. 2024-11-11 10:56:14 -08:00
tutorial
.gitignore
DEVELOPERS
Makefile
Makefile.global.in
Makefile.shlib
nls-global.mk