aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2024-10-22 16:26:27 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2024-10-23 19:45:10 +0100
commit5467f5b5ca6f2302573649b4a4f897793a9a6e7f (patch)
tree019cdb8e1d1d0d39cebf18e0a31bed8b517db118 /gcc
parentf342d66d6990b9559dde13e616a2921a7bfae176 (diff)
downloadgcc-5467f5b5ca6f2302573649b4a4f897793a9a6e7f.zip
gcc-5467f5b5ca6f2302573649b4a4f897793a9a6e7f.tar.gz
gcc-5467f5b5ca6f2302573649b4a4f897793a9a6e7f.tar.bz2
ginclude: stdalign.h should define __xxx_is_defined macros for C++
The __alignas_is_defined macro has been required by C++ since C++11, and C++ Library DR 4036 clarified that __alignof_is_defined should be defined too. The whole <stdalign.h> header was deprecated for C++23 (see LWG 3827) and is likely to be removed for C++26 (see P3348), but we can deal with that later. The macros alignas and alignof should not be defined, as they're keywords in C++. gcc/ChangeLog: * ginclude/stdalign.h (__alignas_is_defined): Define for C++. (__alignof_is_defined): Likewise. libstdc++-v3/ChangeLog: * testsuite/18_support/headers/cstdalign/macros.cc: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ginclude/stdalign.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/ginclude/stdalign.h b/gcc/ginclude/stdalign.h
index 5f82f2d..980b1bb 100644
--- a/gcc/ginclude/stdalign.h
+++ b/gcc/ginclude/stdalign.h
@@ -26,12 +26,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#ifndef _STDALIGN_H
#define _STDALIGN_H
-#if (!defined __cplusplus \
- && !(defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L))
+#if !(defined __STDC_VERSION__ && __STDC_VERSION__ > 201710L)
+#ifndef __cplusplus
#define alignas _Alignas
#define alignof _Alignof
+#endif
+/* These are defined for C++, but deprecated in C++23. */
#define __alignas_is_defined 1
#define __alignof_is_defined 1