postgresql/src/include
Thomas Munro 97525bc5c8 Require sizeof(bool) == 1.
The C standard says that sizeof(bool) is implementation-defined, but we
know of no current systems where it is not 1.  The last known systems
seem to have been Apple macOS/PowerPC 10.5 and Microsoft Visual C++ 4,
both long defunct.

PostgreSQL has always required sizeof(bool) == 1 for the definition of
bool that it used, but previously it would define its own type if the
system-provided bool had a different size.  That was liable to cause
memory layout problems when interacting with system and third-party
libraries on (by now hypothetical) computers with wider _Bool, and now
C23 has introduced a new problem by making bool a built-in datatype
(like C++), so the fallback code doesn't even compile.  We could
probably work around that, but then we'd be writing new untested code
for a computer that doesn't exist.

Instead, delete the unreachable and C23-uncompilable fallback code, and
let existing static assertions fail if the system-provided bool is too
wide.  If we ever get a problem report from a real system, then it will
be time to figure out what to do about it in a way that also works on
modern compilers.

Note on C++: Previously we avoided including <stdbool.h> or trying to
define a new bool type in headers that might be included by C++ code.
These days we might as well just include <stdbool.h> unconditionally:
it should be visible to C++11 but do nothing, just as in C23.  We
already include <stdint.h> without C++ guards in c.h, and that falls
under the same C99-compatibility section of the C++11 standard as
<stdbool.h>, so let's remove the guards here too.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3198438.1731895163%40sss.pgh.pa.us
2024-11-28 12:01:14 +13:00
..
access Revert pg_wal_replay_wait() stored procedure 2024-11-04 22:47:57 +02:00
archive Add macro for customizing an archiving WARNING message. 2024-03-04 15:41:42 -06:00
backup Align blocks in incremental backups to BLCKSZ 2024-04-05 16:30:01 +02:00
bootstrap Update copyright for 2024 2024-01-03 20:49:05 -05:00
catalog Add two attributes to pg_stat_database for parallel workers activity 2024-11-11 10:40:48 +09:00
commands doc: Add better description for rewrite functions in event triggers 2024-10-29 15:35:01 +09:00
common jsonapi: add lexer option to keep token ownership 2024-11-27 12:07:14 -05:00
datatype Update copyright for 2024 2024-01-03 20:49:05 -05:00
executor Fix NULLIF()'s handling of read-write expanded objects. 2024-11-25 18:09:09 -05:00
fe_utils pg_verifybackup: Verify tar-format backups. 2024-09-27 08:40:24 -04:00
foreign Clean up more indent breakage from 6377e12a5. 2024-04-16 13:00:40 -04:00
jit jit: Remove obsolete LLVM version guard. 2024-11-11 12:07:24 +13:00
lib Revert pg_wal_replay_wait() stored procedure 2024-11-04 22:47:57 +02:00
libpq Make the memory layout of Port struct independent of USE_OPENSSL 2024-11-22 17:43:04 +02:00
mb Inline basic UTF-8 functions. 2024-03-20 09:40:57 -07:00
nodes Add pg_constraint rows for not-null constraints 2024-11-08 13:28:48 +01:00
optimizer Reordering DISTINCT keys to match input path's pathkeys 2024-11-26 09:25:18 +09:00
parser Track more precisely query locations for nested statements 2024-10-24 09:29:54 +09:00
partitioning Revert support for ALTER TABLE ... MERGE/SPLIT PARTITION(S) commands 2024-08-24 18:48:48 +03:00
pch Update copyright for 2024 2024-01-03 20:49:05 -05:00
port Fix sign-compare warnings in pg_iovec.h. 2024-11-08 16:11:08 -06:00
portability Fix datatypes in comments in instr_time.h 2024-08-06 22:15:55 +03:00
postmaster Pass MyPMChildSlot as an explicit argument to child process 2024-11-14 16:12:32 +02:00
regex Avoid assertion due to disconnected NFA sub-graphs in regex parsing. 2024-11-15 18:23:38 -05:00
replication Clean up newlines following left parentheses 2024-11-26 17:10:07 +01:00
rewrite Support MERGE into updatable views. 2024-02-29 15:56:59 +00:00
snowball Update copyright for 2024 2024-01-03 20:49:05 -05:00
statistics Add functions pg_restore_relation_stats(), pg_restore_attribute_stats(). 2024-10-24 12:08:00 -07:00
storage Improve InitShmemAccess() prototype 2024-11-26 08:46:22 +01:00
tcop Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:33 -07:00
tsearch Constify fields and parameters in spell.c 2024-08-06 23:04:51 +03:00
utils Look up backend type in pg_signal_backend() more cheaply. 2024-11-27 10:32:25 -06:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Require sizeof(bool) == 1. 2024-11-28 12:01:14 +13:00
fmgr.h Remove _PG_fini() 2024-08-21 07:24:03 +09:00
funcapi.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
getopt_long.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
Makefile Put genbki.pl output into src/include/catalog/ directly 2024-03-14 07:11:21 +01:00
meson.build meson: Restore implicit warning/debug/optimize flags for extensions 2024-06-07 09:36:26 +02:00
miscadmin.h Replace postmaster.c's own backend type codes with BackendType 2024-11-14 16:06:16 +02:00
pg_config.h.in Require sizeof(bool) == 1. 2024-11-28 12:01:14 +13:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_ext.h.meson meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
pg_config_manual.h Add prefetching support on macOS 2024-08-28 07:28:27 +02:00
pg_getopt.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_trace.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgstat.h Add two attributes to pg_stat_database for parallel workers activity 2024-11-11 10:40:48 +09:00
pgtar.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
pgtime.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
port.h More use of getpwuid_r() directly 2024-09-02 09:04:30 +02:00
postgres.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
postgres_ext.h Move RelFileNumber declarations to common/relpath.h. 2022-09-27 12:01:57 -04:00
postgres_fe.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
varatt.h Update copyright for 2024 2024-01-03 20:49:05 -05:00
windowapi.h Update copyright for 2024 2024-01-03 20:49:05 -05:00