+2025-01-18 Paul Eggert <eggert@cs.ucla.edu>
+
+ alignasof: port to IBM XL C 16.1
+ * doc/gnulib.texi (alignof):
+ Improve doc to match implementation better.
+ * m4/stdalign.m4 (alignas): Do not define to _Alignas
+ if __xlC__ claims to conform to C11, because _Alignas fails with
+ weird diagnostics "Unexpected text %1$s encountered."
+ * tests/test-alignasof.c (TEST_ALIGNMENT, alignas):
+ Follow doc advice.
+
2025-01-18 Collin Funk <collin.funk1@gmail.com>
renameatu: Work around a GNU/Hurd bug.
Portability problems fixed by Gnulib:
@itemize
-@item
-Pre-C11 platforms lack @code{alignas} and @code{alignof}.
-
@item
On pre-C23 platforms, @code{<stdalign.h>} must be included before
using @code{alignas} or @code{alignof}.
Portability problems not fixed by Gnulib:
@itemize
+@item
+The set of alignments supported by @code{alignas} is implementation
+dependent, and implementations need not support alignments greater
+than @code{alignof (max_align_t)}.
+
+@item
+Some older platforms do not support @code{alignas}.
+To test this, use the @code{alignasof} module
+along with the @code{#if} conditional
+@code{(defined alignas || defined __alignas_is_defined
+|| 202311 <= __STDC_VERSION__ || 201103 <= __cplusplus)}.
+Platforms where @code{alignas} does not work include:
+IBM XL C for AIX V16.1.
+
+@item
+On some platforms, the argument of @code{alignas} must be an integer
+constant like @samp{8}, instead of an integer constant expression
+like @samp{4 + 4} that evaluates to 8:
+GCC 4.9.
+
@item
On pre-C23 platforms, @code{alignas} and @code{alignof} are macros.
@end itemize
# stdalign.m4
-# serial 2
+# serial 3
dnl Copyright 2011-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# if ((defined _Alignas \
&& !(defined __cplusplus \
&& (201103 <= __cplusplus || defined _MSC_VER))) \
- || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
+ || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__ \
+ && !defined __xlC__))
# define alignas _Alignas
# endif
# endif
/* Test of alignasof module.
- Copyright 2009-2024 Free Software Foundation, Inc.
+ Copyright 2009-2025 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
typedef struct { char a[3]; } struct3;
typedef struct { char a[4]; } struct4;
-#if (202311 <= __STDC_VERSION__ || __alignas_is_defined \
- || 201103 <= __cplusplus)
+#if (defined alignas || __alignas_is_defined \
+ || 202311 <= __STDC_VERSION__ || 201103 <= __cplusplus)
/* mingw can go up only to 8. 8 is all that GNU Emacs needs, so let's
limit the test to 8 for now. */
# define TEST_ALIGNMENT 8
#else
-# undef alignas
# define alignas(alignment)
# define TEST_ALIGNMENT 1
#endif