summaryrefslogtreecommitdiff
path: root/gl/stdalign.in.h
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-07-14 13:52:58 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-07-14 13:53:22 +0200
commit5efa7d64818114bbef4896d3824425917b45e909 (patch)
tree166bb14196a233382b80570c746ae20cf3723fe0 /gl/stdalign.in.h
parent142eddc0b8eb696fcadedd9d9c6f387fafa560f8 (diff)
downloadgnutls-5efa7d64818114bbef4896d3824425917b45e909.tar.gz
updated gnulib
Diffstat (limited to 'gl/stdalign.in.h')
-rw-r--r--gl/stdalign.in.h39
1 files changed, 29 insertions, 10 deletions
diff --git a/gl/stdalign.in.h b/gl/stdalign.in.h
index c3a67321b0..7254a3dec1 100644
--- a/gl/stdalign.in.h
+++ b/gl/stdalign.in.h
@@ -41,13 +41,28 @@
are 4 unless the option '-malign-double' is used.
The result cannot be used as a value for an 'enum' constant, if you
- want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */
+ want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.
+
+ Include <stddef.h> for offsetof. */
#include <stddef.h>
-#if defined __cplusplus
+
+/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
+ standard headers, defines conflicting implementations of _Alignas
+ and _Alignof that are no better than ours; override them. */
+#undef _Alignas
+#undef _Alignof
+
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+# ifdef __cplusplus
+# if 201103 <= __cplusplus
+# define _Alignof(type) alignof (type)
+# else
template <class __t> struct __alignof_helper { char __a; __t __b; };
-# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
-#else
-# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
+# endif
+# else
+# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+# endif
#endif
#define alignof _Alignof
#define __alignof_is_defined 1
@@ -77,12 +92,16 @@
*/
-#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C
-# define _Alignas(a) __attribute__ ((__aligned__ (a)))
-#elif 1300 <= _MSC_VER
-# define _Alignas(a) __declspec (align (a))
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
+# if defined __cplusplus && 201103 <= __cplusplus
+# define _Alignas(a) alignas (a)
+# elif __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC || 0x5110 <= __SUNPRO_C
+# define _Alignas(a) __attribute__ ((__aligned__ (a)))
+# elif 1300 <= _MSC_VER
+# define _Alignas(a) __declspec (align (a))
+# endif
#endif
-#ifdef _Alignas
+#if defined _Alignas || (defined __STDC_VERSION && 201112 <= __STDC_VERSION__)
# define alignas _Alignas
# define __alignas_is_defined 1
#endif