cdefs.h (d0b3c59b) cdefs.h (154972af)
1/*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at

--- 41 unchanged lines hidden (view full) ---

50#define __packed __attribute__((__packed__))
51#define __aligned(x) __attribute__((__aligned__(x)))
52#define __section(x) __attribute__((__section__(x)))
53#define __weak_symbol __attribute__((__weak__))
54#endif
55
56#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L || defined(lint)
57
1/*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at

--- 41 unchanged lines hidden (view full) ---

50#define __packed __attribute__((__packed__))
51#define __aligned(x) __attribute__((__aligned__(x)))
52#define __section(x) __attribute__((__section__(x)))
53#define __weak_symbol __attribute__((__weak__))
54#endif
55
56#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L || defined(lint)
57
58#if defined(__cplusplus) && __cplusplus >= 201103L
59#define _Alignof(x) alignof(x)
60#else
61#define _Alignof(x) __alignof(x)
62#endif
63
58#if !__has_extension(c_static_assert)
59#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
60 __has_extension(cxx_static_assert)
61#define _Static_assert(x, y) static_assert(x, y)
62#elif __GNUC_PREREQ__(4,6)
63/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
64#elif defined(__COUNTER__)
65#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
66#define __Static_assert(x, y) ___Static_assert(x, y)
67#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \
68 __unused
69#else
70#define _Static_assert(x, y) struct __hack
71#endif
72#endif
73#define static_assert(x, y) _Static_assert(x, y)
74
75#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
76
64#if !__has_extension(c_static_assert)
65#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
66 __has_extension(cxx_static_assert)
67#define _Static_assert(x, y) static_assert(x, y)
68#elif __GNUC_PREREQ__(4,6)
69/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
70#elif defined(__COUNTER__)
71#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
72#define __Static_assert(x, y) ___Static_assert(x, y)
73#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \
74 __unused
75#else
76#define _Static_assert(x, y) struct __hack
77#endif
78#endif
79#define static_assert(x, y) _Static_assert(x, y)
80
81#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
82
83#if __GNUC_PREREQ__(4, 1)
84#define __offsetof(type, field) __builtin_offsetof(type, field)
85#else
86#ifndef __cplusplus
87#define __offsetof(type, field) \
88 ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field))
89#else
90#define __offsetof(type, field) \
91 (__offsetof__ (reinterpret_cast <__size_t> \
92 (&reinterpret_cast <const volatile char &> \
93 (static_cast<type *> (0)->field))))
94#endif
95#endif
96
77#endif /* _COMPAT_FREEBSD_SYS_CDEFS_H_ */
97#endif /* _COMPAT_FREEBSD_SYS_CDEFS_H_ */