aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2024-11-25 13:11:28 +1300
committerThomas Munro <tmunro@postgresql.org>2024-11-25 20:54:28 +1300
commitbc5a4dfcf7390145dc3ba3c1c18c5ce561b778cd (patch)
tree9c1e3b47557a5ca0fc572bfb26d5c108c8d88193 /src
parentd4d11940df94ee13166dda70271ff3b97e43bc9b (diff)
downloadpostgresql-bc5a4dfcf7390145dc3ba3c1c18c5ce561b778cd.tar.gz
postgresql-bc5a4dfcf7390145dc3ba3c1c18c5ce561b778cd.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/include/c.h2
-rw-r--r--src/include/pg_config.h.in6
2 files changed, 1 insertions, 7 deletions
diff --git a/src/include/c.h b/src/include/c.h
index 4a6b361231c..fe1ce87882b 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -450,7 +450,7 @@ typedef void (*pg_funcptr_t) (void);
* bool
* Boolean value, either true or false.
*
- * We use stdbool.h if available and its bool has size 1. That's useful for
+ * We use stdbool.h if bool has size 1 after including it. That's useful for
* better compiler and debugger output and for compatibility with third-party
* libraries. But PostgreSQL currently cannot deal with bool of other sizes;
* there are static assertions around the code to prevent that.
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index a903c60a3a0..40e4b2e3816 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -367,9 +367,6 @@
/* Define to 1 if you have the `SSL_CTX_set_num_tickets' function. */
#undef HAVE_SSL_CTX_SET_NUM_TICKETS
-/* Define to 1 if stdbool.h conforms to C99. */
-#undef HAVE_STDBOOL_H
-
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@@ -499,9 +496,6 @@
/* Define to 1 if you have XSAVE intrinsics. */
#undef HAVE_XSAVE_INTRINSICS
-/* Define to 1 if the system has the type `_Bool'. */
-#undef HAVE__BOOL
-
/* Define to 1 if your compiler understands __builtin_bswap16. */
#undef HAVE__BUILTIN_BSWAP16