2013-09-12 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/sys/cdefs.h: Synchronize with latest FreeBSD version. * libc/include/stdatomic.h: Likewise.
This commit is contained in:
@ -66,6 +66,23 @@
|
||||
# define __ptrvalue /* nothing */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Testing against Clang-specific extensions.
|
||||
*/
|
||||
|
||||
#ifndef __has_extension
|
||||
#define __has_extension __has_feature
|
||||
#endif
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(x) 0
|
||||
#endif
|
||||
#ifndef __has_include
|
||||
#define __has_include(x) 0
|
||||
#endif
|
||||
#ifndef __has_builtin
|
||||
#define __has_builtin(x) 0
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define __BEGIN_DECLS extern "C" {
|
||||
#define __END_DECLS }
|
||||
@ -252,23 +269,45 @@
|
||||
/*
|
||||
* Keywords added in C11.
|
||||
*/
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
#define _Alignas(e) alignas(e)
|
||||
#define _Alignof(e) alignof(e)
|
||||
#define _Noreturn [[noreturn]]
|
||||
#define _Static_assert(e, s) static_assert(e, s)
|
||||
/* FIXME: change this to thread_local when clang in base supports it */
|
||||
#define _Thread_local __thread
|
||||
#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
|
||||
/* Do nothing. They are language keywords. */
|
||||
|
||||
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L
|
||||
|
||||
#if !__has_extension(c_alignas)
|
||||
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
|
||||
__has_extension(cxx_alignas)
|
||||
#define _Alignas(x) alignas(x)
|
||||
#else
|
||||
/* Not supported. Implement them using our versions. */
|
||||
/* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */
|
||||
#define _Alignas(x) __aligned(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
#define _Alignof(x) alignof(x)
|
||||
#else
|
||||
#define _Alignof(x) __alignof(x)
|
||||
#endif
|
||||
|
||||
#if !__has_extension(c_atomic) && !__has_extension(cxx_atomic)
|
||||
/*
|
||||
* No native support for _Atomic(). Place object in structure to prevent
|
||||
* most forms of direct non-atomic access.
|
||||
*/
|
||||
#define _Atomic(T) struct { T volatile __val; }
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
#define _Noreturn [[noreturn]]
|
||||
#else
|
||||
#define _Noreturn __dead2
|
||||
#define _Thread_local __thread
|
||||
#endif
|
||||
|
||||
#if __GNUC_PREREQ__(4, 6) && !defined(__cplusplus)
|
||||
/* Do nothing: _Static_assert() works as per C11 */
|
||||
#elif !__has_extension(c_static_assert)
|
||||
#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
|
||||
__has_extension(cxx_static_assert)
|
||||
#define _Static_assert(x, y) static_assert(x, y)
|
||||
#elif defined(__COUNTER__)
|
||||
#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
|
||||
#define __Static_assert(x, y) ___Static_assert(x, y)
|
||||
@ -278,6 +317,18 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !__has_extension(c_thread_local)
|
||||
/* XXX: Change this to test against C++11 when clang in base supports it. */
|
||||
#if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \
|
||||
__has_extension(cxx_thread_local)
|
||||
#define _Thread_local thread_local
|
||||
#else
|
||||
#define _Thread_local __thread
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
|
||||
|
||||
/*
|
||||
* Emulation of C11 _Generic(). Unlike the previously defined C11
|
||||
* keywords, it is not possible to implement this using exactly the same
|
||||
@ -650,17 +701,4 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __has_extension
|
||||
#define __has_extension __has_feature
|
||||
#endif
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(x) 0
|
||||
#endif
|
||||
#ifndef __has_include
|
||||
#define __has_include(x) 0
|
||||
#endif
|
||||
#ifndef __has_builtin
|
||||
#define __has_builtin(x) 0
|
||||
#endif
|
||||
|
||||
#endif /* !_SYS_CDEFS_H_ */
|
||||
|
Reference in New Issue
Block a user