Recent Linux distributions ship with compilers that introduce a built-in
'bool' type (size=1) which conflicts with Postfix's bool (size=4). I have
updated the Postfix 3.11 adopt the built-in bool type, but this change
would be too large for the stable releases.

For Postfix 3.0..3.10, the patch below adds a compiler command-line
option to restore past compatibility if needed. It will be part of
the next release.

        Wietse

diff '--exclude=man' '--exclude=html' '--exclude=README_FILES' 
'--exclude=INSTALL' --no-dereference -r -ur /var/tmp/postfix-3.10.6/makedefs 
./makedefs
--- /var/tmp/postfix-3.10.6/makedefs    2025-02-17 12:41:56.000000000 -0500
+++ ./makedefs  2025-12-02 09:37:55.391830291 -0500
@@ -1235,6 +1235,25 @@
        -Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
        -Wunused -Wno-missing-braces -fno-common'}
 
+# C23 introduces a built-in type 'bool' (size 1) which breaks past Postfix
+# practice where 'bool' is an alias for 'int' (typically, size 4).
+# Fortunately, -std=gnu17 works with both gcc and clang.
+cat >makedefs.test.c <<'EOF'
+/* This appears in mail_params.h */
+typedef int bool;
+EOF
+
+if ${CC} ${CCARGS} -c makedefs.test.c >/dev/null 2>&1
+then
+    : No further action needed.
+elif ${CC} -std=gnu17 ${CCARGS} -c makedefs.test.c >/dev/null 2>&1
+then
+    CCARGS="-std=gnu17 $CCARGS"
+else
+    echo "Please specify CC or CCARGS option to disable C23" 1>&2; exit 1
+fi
+rm -f makedefs.test.[co]
+
 # Extract map type names from -DHAS_XXX compiler options.  We avoid
 # problems with tr(1) range syntax by using enumerations instead,
 # and we don't try to figure out which awk versions have tolower().
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to