On AIX 7.3.1, with gcc in 64-bit mode, I see many compilation errors like the
following one:
$ gmake memchr.o
...
In file included from ./stddef.h:80,
from ./string.h:55,
from ../../gllib/memchr.c:30:
/opt/freeware/lib/gcc/powerpc-ibm-aix7.3.0.0/10/include/stddef.h:426:3: error:
conflicting types for 'max_align_t'
426 | } max_align_t;
| ^~~~~~~~~~~
In file included from ./string.h:55,
from ../../gllib/memchr.c:30:
./stddef.h:70:14: note: previous declaration of 'max_align_t' was here
70 | typedef long max_align_t;
| ^~~~~~~~~~~
gmake: *** [Makefile:11116: memchr.o] Error 1
The problem here is a workaround for AIX 7.2, where 'configure' determined
checking for good max_align_t... no
and thus we enabled an override of max_align_t. But on AIX 7.3.1, configure
determines
checking for good max_align_t... yes
and thus the workaround is not needed. Thus, this patch fixes it.
2023-08-18 Bruno Haible <[email protected]>
stddef: Don't unnecessarily override max_align_t on AIX 7.3 with gcc.
* lib/stddef.in.h (max_align_t, GNULIB_defined_max_align_t): Don't
define or override if HAVE_MAX_ALIGN_T is 1.
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index 431e819b8b..bb18198c98 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -58,7 +58,7 @@
/* On AIX 7.2, with xlc in 64-bit mode, <stddef.h> defines max_align_t to a
type with alignment 4, but 'long' has alignment 8. */
-# if defined _AIX && defined __LP64__
+# if defined _AIX && defined __LP64__ && !@HAVE_MAX_ALIGN_T@
# if !GNULIB_defined_max_align_t
# ifdef _MAX_ALIGN_T
/* /usr/include/stddef.h has already defined max_align_t. Override it. */