aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdalign.in.h
diff options
context:
space:
mode:
authorPaul Eggert2013-07-07 23:15:38 -0700
committerPaul Eggert2013-07-07 23:15:38 -0700
commit2a74a90a033ec2bf2580ca1c7163209f1cd3faed (patch)
tree888b313d913d9ac5da8161784a39c85b4ca5241e /lib/stdalign.in.h
parent6602769357bba5616c4d36a12d2dce254f4b5fee (diff)
downloademacs-2a74a90a033ec2bf2580ca1c7163209f1cd3faed.tar.gz
emacs-2a74a90a033ec2bf2580ca1c7163209f1cd3faed.zip
Try to fix FreeBSD 9.1 porting problem.
This incorporates the following merge from gnulib: 2013-07-07 stdalign, verify: port to FreeBSD 9.1, to C11, and to C++11 Fixes: debbugs:14812
Diffstat (limited to 'lib/stdalign.in.h')
-rw-r--r--lib/stdalign.in.h39
1 files changed, 29 insertions, 10 deletions
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
index c3a67321b0e..7254a3dec17 100644
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -41,13 +41,28 @@
41 are 4 unless the option '-malign-double' is used. 41 are 4 unless the option '-malign-double' is used.
42 42
43 The result cannot be used as a value for an 'enum' constant, if you 43 The result cannot be used as a value for an 'enum' constant, if you
44 want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ 44 want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.
45
46 Include <stddef.h> for offsetof. */
45#include <stddef.h> 47#include <stddef.h>
46#if defined __cplusplus 48
49/* FreeBSD 9.1 <sys/cdefs.h>, included by <stddef.h> and lots of other
50 standard headers, defines conflicting implementations of _Alignas
51 and _Alignof that are no better than ours; override them. */
52#undef _Alignas
53#undef _Alignof
54
55#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
56# ifdef __cplusplus
57# if 201103 <= __cplusplus
58# define _Alignof(type) alignof (type)
59# else
47 template <class __t> struct __alignof_helper { char __a; __t __b; }; 60 template <class __t> struct __alignof_helper { char __a; __t __b; };
48# define _Alignof(type) offsetof (__alignof_helper<type>, __b) 61# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
49#else 62# endif
50# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) 63# else
64# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
65# endif
51#endif 66#endif
52#define alignof _Alignof 67#define alignof _Alignof
53#define __alignof_is_defined 1 68#define __alignof_is_defined 1
@@ -77,12 +92,16 @@
77 92
78 */ 93 */
79 94
80#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C 95#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112
81# define _Alignas(a) __attribute__ ((__aligned__ (a))) 96# if defined __cplusplus && 201103 <= __cplusplus
82#elif 1300 <= _MSC_VER 97# define _Alignas(a) alignas (a)
83# define _Alignas(a) __declspec (align (a)) 98# elif __GNUC__ || __IBMC__ || __IBMCPP__ || __ICC || 0x5110 <= __SUNPRO_C
99# define _Alignas(a) __attribute__ ((__aligned__ (a)))
100# elif 1300 <= _MSC_VER
101# define _Alignas(a) __declspec (align (a))
102# endif
84#endif 103#endif
85#ifdef _Alignas 104#if defined _Alignas || (defined __STDC_VERSION && 201112 <= __STDC_VERSION__)
86# define alignas _Alignas 105# define alignas _Alignas
87# define __alignas_is_defined 1 106# define __alignas_is_defined 1
88#endif 107#endif