summaryrefslogtreecommitdiffstats
path: root/gl/m4/stdalign.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/stdalign.m4')
-rw-r--r--gl/m4/stdalign.m416
1 files changed, 11 insertions, 5 deletions
diff --git a/gl/m4/stdalign.m4 b/gl/m4/stdalign.m4
index 20be01aa..e22d7f78 100644
--- a/gl/m4/stdalign.m4
+++ b/gl/m4/stdalign.m4
@@ -1,6 +1,6 @@
1# Check for stdalign.h that conforms to C11. 1# Check for stdalign.h that conforms to C11.
2 2
3dnl Copyright 2011-2013 Free Software Foundation, Inc. 3dnl Copyright 2011-2021 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation 4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it, 5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved. 6dnl with or without modifications, as long as this notice is preserved.
@@ -13,12 +13,13 @@ AC_DEFUN([gl_STDALIGN_H],
13 [gl_cv_header_working_stdalign_h], 13 [gl_cv_header_working_stdalign_h],
14 [AC_COMPILE_IFELSE( 14 [AC_COMPILE_IFELSE(
15 [AC_LANG_PROGRAM( 15 [AC_LANG_PROGRAM(
16 [[#include <stdalign.h> 16 [[#include <stdint.h>
17 #include <stdalign.h>
17 #include <stddef.h> 18 #include <stddef.h>
18 19
19 /* Test that alignof yields a result consistent with offsetof. 20 /* Test that alignof yields a result consistent with offsetof.
20 This catches GCC bug 52023 21 This catches GCC bug 52023
21 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */ 22 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. */
22 #ifdef __cplusplus 23 #ifdef __cplusplus
23 template <class t> struct alignof_helper { char a; t b; }; 24 template <class t> struct alignof_helper { char a; t b; };
24 # define ao(type) offsetof (alignof_helper<type>, b) 25 # define ao(type) offsetof (alignof_helper<type>, b)
@@ -32,8 +33,13 @@ AC_DEFUN([gl_STDALIGN_H],
32 /* Test _Alignas only on platforms where gnulib can help. */ 33 /* Test _Alignas only on platforms where gnulib can help. */
33 #if \ 34 #if \
34 ((defined __cplusplus && 201103 <= __cplusplus) \ 35 ((defined __cplusplus && 201103 <= __cplusplus) \
35 || __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC \ 36 || (__TINYC__ && defined __attribute__) \
36 || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER) 37 || (defined __APPLE__ && defined __MACH__ \
38 ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \
39 : __GNUC__) \
40 || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \
41 || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__ \
42 || 1300 <= _MSC_VER)
37 struct alignas_test { char c; char alignas (8) alignas_8; }; 43 struct alignas_test { char c; char alignas (8) alignas_8; };
38 char test_alignas[offsetof (struct alignas_test, alignas_8) == 8 44 char test_alignas[offsetof (struct alignas_test, alignas_8) == 8
39 ? 1 : -1]; 45 ? 1 : -1];