diff m4/stdalign.m4 @ 17364:7524d97ae56f

stdalign: port to stricter ISO C11 ISO C11 says that _Alignof's operand must be a parenthesized type. Problem reported by Eli Zaretskii in <http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00960.html>. * doc/posix-headers/stdalign.texi (stdalign.h): Document this. * m4/stdalign.m4 (gl_STDALIGN_H): Don't use _Alignof (expr).
author Paul Eggert <eggert@cs.ucla.edu>
date Fri, 29 Mar 2013 19:47:13 -0700
parents e542fd46ad6f
children 6b7c1e9c98d6
line wrap: on
line diff
--- a/m4/stdalign.m4	Tue Mar 19 09:08:47 2013 -0700
+++ b/m4/stdalign.m4	Fri Mar 29 19:47:13 2013 -0700
@@ -33,8 +33,9 @@
             #if \
                 (__GNUC__ || __IBMC__ || __IBMCPP__ \
                  || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
-              int alignas (8) alignas_int = 1;
-              char test_alignas[_Alignof (alignas_int) == 8 ? 1 : -1];
+              struct alignas_test { char c; char alignas (8) alignas_8; };
+              char test_alignas[offsetof (struct alignas_test, alignas_8) == 8
+                                ? 1 : -1];
             #endif
           ]])],
        [gl_cv_header_working_stdalign_h=yes],