Hello Bruce, After reading through your email, I think it's best to fix things using the following patch. Essentially it does the following:
- It makes sure __alignof() is always present, by defining it as a macro for GCC < 2.95. - All the C1X macros can now be implemented using the ones we already had (__dead2, etc). This means we don't need to repeat all the compiler version specific checks. - While there, add struct __hack to the _Static_assert, as it always requires a semicolon. Thanks for your feedback. | Index: sys/sys/cdefs.h | =================================================================== | --- sys/sys/cdefs.h (revision 228504) | +++ sys/sys/cdefs.h (working copy) | @@ -230,27 +230,24 @@ | #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L | /* Do nothing. They are language keywords. */ | #else | -/* Not supported. Implement them manually. */ | -#ifdef __GNUC__ | -#define _Alignas(e) __attribute__((__aligned__(e))) | -#define _Alignof(e) __alignof__(e) | -#define _Noreturn __attribute__((__noreturn__)) | +/* Not supported. Implement them using our versions. */ | +#define _Alignas(e) __aligned(e) | +#define _Alignof(e) __alignof(e) | +#define _Noreturn __dead2 | #define _Thread_local __thread | -#else | -#define _Alignas(e) | -#define _Alignof(e) __offsetof(struct { char __a; e __b; }, __b) | -#define _Noreturn | -#define _Thread_local | -#endif | #ifdef __COUNTER__ | #define _Static_assert(e, s) __Static_assert(e, __COUNTER__) | #define __Static_assert(e, c) ___Static_assert(e, c) | #define ___Static_assert(e, c) typedef char __assert ## c[(e) ? 1 : -1] | #else | -#define _Static_assert(e, s) | +#define _Static_assert(e, s) struct __hack | #endif | #endif | | +#if !__GNUC_PREREQ__(2, 95) | +#define __alignof(x) __offsetof(struct { char __a; e __b; }, __b) | +#endif | + | #if __GNUC_PREREQ__(2, 96) | #define __malloc_like __attribute__((__malloc__)) | #define __pure __attribute__((__pure__)) -- Ed Schouten <e...@80386.nl> WWW: http://80386.nl/
pgpqRKfxjmZ6B.pgp
Description: PGP signature