summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2023-01-15 11:48:43 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2023-01-15 11:51:07 -0800
commitc593e834e1c17daf5c151ec2bdadbccc65b9efd4 (patch)
tree9095a76a29ccd67017ce08910e86644fbed7253c /doc
parent8bec309111411a2fdb51f149af2ff4d8d5226dfd (diff)
downloadgnulib-c593e834e1c17daf5c151ec2bdadbccc65b9efd4.tar.gz
alignasof: new module
This splits off support for the C23 keywords alignas and alignof, from the now-deprecated stdalign module. The latter now merely provides C11 support. * MODULES.html.sh, NEWS, doc/gnulib.texi: * doc/posix-headers/stdalign.texi: Document the change. * lib/stdalign.in.h: Remove most of the definitions (which are now supplied by the alignasof module), leaving only __alignas_is_defined and __alignof_is_defined. * modules/alignasof, modules/alignasof-tests: New files. * m4/stdalign.m4 (gl_ALIGNASOF): New macro, with most of the contents of the old gl_STDALIGN_H. Do not define __alignas_is_defined or __alignof_is_defined. (gl_STDALIGN_H): Rely on gl_ALIGNASOF for most of the work. * modules/alignalloc, modules/alignof, modules/argp: * modules/crypto/md4-buffer, modules/crypto/md5-buffer: * modules/crypto/sha1-buffer, modules/crypto/sha256-buffer: * modules/crypto/sha512-buffer, modules/crypto/sm3-buffer: * modules/fts, modules/rawmemchr, modules/relocatable-prog-wrapper: * modules/stddef-tests, modules/sys_socket: Depend on alignasof, not stdalign. * modules/stdalign: Deprecate. Depend on alignasof. * modules/stdalign-tests: Move most contents to the new module alignasof-tests, and depend on that.
Diffstat (limited to 'doc')
-rw-r--r--doc/gnulib.texi7
-rw-r--r--doc/posix-headers/stdalign.texi31
2 files changed, 23 insertions, 15 deletions
diff --git a/doc/gnulib.texi b/doc/gnulib.texi
index 0f645206bf..7388fb0b45 100644
--- a/doc/gnulib.texi
+++ b/doc/gnulib.texi
@@ -873,10 +873,10 @@ substituted by Gnulib.
@node alignof
@section @code{alignof} and @code{alignas}
-Gnulib module: stdalign
+Gnulib module: alignasof
-The @code{stdalign} module arranges for @code{alignas}, @code{alignof}, and
-@code{<stdalign.h>} to be more like standard C@. @xref{stdalign.h}.
+The @code{alignasof} module arranges for @code{alignas} and @code{alignof}
+to be more like standard C@.
Portability problems fixed by Gnulib:
@itemize
@@ -886,6 +886,7 @@ 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}.
+@xref{stdalign.h}.
@end itemize
Portability problems not fixed by Gnulib:
diff --git a/doc/posix-headers/stdalign.texi b/doc/posix-headers/stdalign.texi
index be3cec80d1..7f75a15540 100644
--- a/doc/posix-headers/stdalign.texi
+++ b/doc/posix-headers/stdalign.texi
@@ -1,15 +1,17 @@
@node stdalign.h
@section @file{stdalign.h}
-POSIX specification:@* Not in POSIX yet, but we expect it will be.
-ISO C11 (latest free draft
-@url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf})
+POSIX specification:@* Not in POSIX yet, but we expect it will be,
+at least temporarily until it becomes obsolete due to its phasing
+out starting in C23.
+ISO C23 (latest free draft
+@url{http://www.open-std.org/jtc1/sc22/wg14/www/docs/n3047.pdf})
sections 6.5.3.4, 6.7.5, 7.15.
C++11 (latest free draft
@url{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf})
section 18.10.
-Gnulib module: stdalign
+Gnulib module: alignasof
Portability problems fixed by Gnulib:
@itemize
@@ -17,6 +19,10 @@ Portability problems fixed by Gnulib:
On older C platforms @code{<stdalign.h>} must be included before using
@code{alignas} or @code{alignof}. For example, GCC versions before 13 do not
support these keywords, which were standardized by C23.
+On C23 and later platforms, @code{<stdalign.h>} has no effect and need
+not be included. (Gnulib-using code should not include
+@code{<stdalign.h>} without also employing Gnulib's now-deprecated
+@code{stdalign} module.)
@item
This header file is missing on many platforms:
FreeBSD 6.4, NetBSD 7.1, OpenBSD 6.7, Minix 3.3.0, AIX 7.1, HP-UX 11.31, IRIX 6.5, Solaris 11.3, mingw, MSVC 14, Android 9.0.
@@ -30,6 +36,15 @@ Older C platforms might not support the obsolescent
@code{_Alignas} and @code{_Alignof} keywords or macros.
This portability problem should not matter with code using this module,
as such code should use @code{alignas} and @code{alignof} instead.
+@item
+In C11 and C17, @code{<stdalign.h>} defines the macros
+@code{__alignas_is_defined} and
+@code{__alignof_is_defined} to 1.
+In C23, these macros are not defined.
+This portability problem should not matter with code using Gnulib's
+@code{alignasof} module, as such code should use @code{alignas} and
+@code{alignof} without checking these two macros. (Gnulib's
+now-deprecated @code{stdalign} module defines these two macros.)
@end itemize
Portability problems not fixed by Gnulib:
@@ -66,14 +81,6 @@ external variables that are declared close together with
@code{alignas}. The bug is fixed in Sun C 5.15, also known as Oracle
Developer Studio 12.6 (2017).
@item
-@code{<stdalign.h>} must be #included before @code{_Alignas} and
-@code{_Alignof} can be used.
-@item
-In C11 and C17, @code{<stdalign.h>} defines the macros
-@code{__alignas_is_defined} and
-@code{__alignof_is_defined} to 1.
-In C23, these macros are not defined.
-@item
You cannot assume that @code{alignas} and @code{alignof} are reserved words;
they might be macros.
@end itemize