123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716 |
- #ifndef _SYS_CDEFS_H_
- #define _SYS_CDEFS_H_
- #include <machine/_default_types.h>
- #include <sys/features.h>
- #include <stddef.h>
- #define __PMT(args) args
- #define __DOTS , ...
- #define __THROW
- #ifdef __GNUC__
- # define __ASMNAME(cname) __XSTRING (__USER_LABEL_PREFIX__) cname
- #endif
- #define __ptr_t void *
- #define __long_double_t long double
- #define __attribute_malloc__
- #define __attribute_pure__
- #define __attribute_format_strfmon__(a,b)
- #define __flexarr [0]
- #ifndef __BOUNDED_POINTERS__
- # define __bounded
- # define __unbounded
- # define __ptrvalue
- #endif
- #ifndef __has_attribute
- #define __has_attribute(x) 0
- #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
- #if defined(__cplusplus)
- #define __BEGIN_DECLS extern "C" {
- #define __END_DECLS }
- #else
- #define __BEGIN_DECLS
- #define __END_DECLS
- #endif
- #if defined(__GNUC__) || defined(__INTEL_COMPILER)
- #if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
- #define __GNUCLIKE_ASM 3
- #define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
- #else
- #define __GNUCLIKE_ASM 2
- #endif
- #define __GNUCLIKE___TYPEOF 1
- #define __GNUCLIKE___OFFSETOF 1
- #define __GNUCLIKE___SECTION 1
- #ifndef __INTEL_COMPILER
- #define __GNUCLIKE_CTOR_SECTION_HANDLING 1
- #endif
- #define __GNUCLIKE_BUILTIN_CONSTANT_P 1
- #if defined(__INTEL_COMPILER) && defined(__cplusplus) && \
- __INTEL_COMPILER < 800
- #undef __GNUCLIKE_BUILTIN_CONSTANT_P
- #endif
- #if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3)
- #define __GNUCLIKE_BUILTIN_VARARGS 1
- #define __GNUCLIKE_BUILTIN_STDARG 1
- #define __GNUCLIKE_BUILTIN_VAALIST 1
- #endif
- #if defined(__GNUC__)
- #define __GNUC_VA_LIST_COMPATIBILITY 1
- #endif
- #if defined(__GNUC__)
- #define __compiler_membar() __asm __volatile(" " : : : "memory")
- #endif
- #ifndef __INTEL_COMPILER
- #define __GNUCLIKE_BUILTIN_NEXT_ARG 1
- #define __GNUCLIKE_MATH_BUILTIN_RELOPS
- #endif
- #define __GNUCLIKE_BUILTIN_MEMCPY 1
- #define __CC_SUPPORTS_INLINE 1
- #define __CC_SUPPORTS___INLINE 1
- #define __CC_SUPPORTS___INLINE__ 1
- #define __CC_SUPPORTS___FUNC__ 1
- #define __CC_SUPPORTS_WARNING 1
- #define __CC_SUPPORTS_VARADIC_XXX 1
- #define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
- #endif
- #if defined(__STDC__) || defined(__cplusplus)
- #define __P(protos) protos
- #define __CONCAT1(x,y) x ## y
- #define __CONCAT(x,y) __CONCAT1(x,y)
- #define __STRING(x) #x
- #define __XSTRING(x) __STRING(x)
- #define __const const
- #define __signed signed
- #define __volatile volatile
- #if defined(__cplusplus)
- #define __inline inline
- #else
- #if !(defined(__CC_SUPPORTS___INLINE))
- #define __inline
- #endif
- #endif
- #else
- #define __P(protos) ()
- #define __CONCAT(x,y) xy
- #define __STRING(x) "x"
- #if !defined(__CC_SUPPORTS___INLINE)
- #define __const
- #define __inline
- #define __signed
- #define __volatile
- #ifndef NO_ANSI_KEYWORDS
- #define const
- #define inline
- #define signed
- #define volatile
- #endif
- #endif
- #endif
- #define __weak_symbol __attribute__((__weak__))
- #if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
- #define __dead2
- #define __pure2
- #define __unused
- #endif
- #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
- #define __dead2 __attribute__((__noreturn__))
- #define __pure2 __attribute__((__const__))
- #define __unused
- #endif
- #if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER)
- #define __dead2 __attribute__((__noreturn__))
- #define __pure2 __attribute__((__const__))
- #define __unused __attribute__((__unused__))
- #define __used __attribute__((__used__))
- #define __packed __attribute__((__packed__))
- #define __aligned(x) __attribute__((__aligned__(x)))
- #define __section(x) __attribute__((__section__(x)))
- #endif
- #if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__)
- #define __alloc_size(x) __attribute__((__alloc_size__(x)))
- #define __alloc_size2(n, x) __attribute__((__alloc_size__(n, x)))
- #else
- #define __alloc_size(x)
- #define __alloc_size2(n, x)
- #endif
- #if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__)
- #define __alloc_align(x) __attribute__((__alloc_align__(x)))
- #else
- #define __alloc_align(x)
- #endif
- #if !__GNUC_PREREQ__(2, 95)
- #define __alignof(x) __offsetof(struct { char __a; x __b; }, __b)
- #endif
- #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
- #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 !defined(__cplusplus) && !__has_extension(c_atomic) && \
- !__has_extension(cxx_atomic)
- #define _Atomic(T) struct { T volatile __val; }
- #endif
- #if defined(__cplusplus) && __cplusplus >= 201103L
- #define _Noreturn [[noreturn]]
- #else
- #define _Noreturn __dead2
- #endif
- #if !__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 __GNUC_PREREQ__(4,6) && !defined(__cplusplus)
- #elif defined(__COUNTER__)
- #define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
- #define __Static_assert(x, y) ___Static_assert(x, y)
- #define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \
- __unused
- #else
- #define _Static_assert(x, y) struct __hack
- #endif
- #endif
- #if !__has_extension(c_thread_local)
- #if \
- __has_extension(cxx_thread_local)
- #define _Thread_local thread_local
- #else
- #define _Thread_local __thread
- #endif
- #endif
- #endif
- #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
- __has_extension(c_generic_selections)
- #define __generic(expr, t, yes, no) \
- _Generic(expr, t: yes, default: no)
- #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
- #define __generic(expr, t, yes, no) \
- __builtin_choose_expr( \
- __builtin_types_compatible_p(__typeof(expr), t), yes, no)
- #endif
- #if !defined(__cplusplus) && \
- (defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \
- (!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901))
- #define __min_size(x) static (x)
- #else
- #define __min_size(x) (x)
- #endif
- #if __GNUC_PREREQ__(2, 96)
- #define __malloc_like __attribute__((__malloc__))
- #define __pure __attribute__((__pure__))
- #else
- #define __malloc_like
- #define __pure
- #endif
- #if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
- #define __always_inline __inline__ __attribute__((__always_inline__))
- #else
- #define __always_inline
- #endif
- #if __GNUC_PREREQ__(3, 1)
- #define __noinline __attribute__ ((__noinline__))
- #else
- #define __noinline
- #endif
- #if __GNUC_PREREQ__(3, 3)
- #define __nonnull(x) __attribute__((__nonnull__ x))
- #define __nonnull_all __attribute__((__nonnull__))
- #else
- #define __nonnull(x)
- #define __nonnull_all
- #endif
- #if __GNUC_PREREQ__(3, 4)
- #define __fastcall __attribute__((__fastcall__))
- #define __result_use_check __attribute__((__warn_unused_result__))
- #else
- #define __fastcall
- #define __result_use_check
- #endif
- #if __GNUC_PREREQ__(4, 1)
- #define __returns_twice __attribute__((__returns_twice__))
- #else
- #define __returns_twice
- #endif
- #if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable)
- #define __unreachable() __builtin_unreachable()
- #else
- #define __unreachable() ((void)0)
- #endif
- #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
- #define __func__ NULL
- #endif
- #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
- #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901
- #define __restrict
- #else
- #define __restrict restrict
- #endif
- #endif
- #if __GNUC_PREREQ__(2, 96)
- #define __predict_true(exp) __builtin_expect((exp), 1)
- #define __predict_false(exp) __builtin_expect((exp), 0)
- #else
- #define __predict_true(exp) (exp)
- #define __predict_false(exp) (exp)
- #endif
- #if __GNUC_PREREQ__(4, 0)
- #define __null_sentinel __attribute__((__sentinel__))
- #define __exported __attribute__((__visibility__("default")))
- #ifndef __CYGWIN__
- #define __hidden __attribute__((__visibility__("hidden")))
- #else
- #define __hidden
- #endif
- #else
- #define __null_sentinel
- #define __exported
- #define __hidden
- #endif
- #define __offsetof(type, field) offsetof(type, field)
- #define __rangeof(type, start, end) \
- (__offsetof(type, end) - __offsetof(type, start))
- #if __GNUC_PREREQ__(3, 1)
- #define __containerof(x, s, m) ({ \
- const volatile __typeof(((s *)0)->m) *__x = (x)
- __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m))
- })
- #else
- #define __containerof(x, s, m) \
- __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
- #endif
- #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
- #define __printflike(fmtarg, firstvararg)
- #define __scanflike(fmtarg, firstvararg)
- #define __format_arg(fmtarg)
- #define __strfmonlike(fmtarg, firstvararg)
- #define __strftimelike(fmtarg, firstvararg)
- #else
- #define __printflike(fmtarg, firstvararg) \
- __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
- #define __scanflike(fmtarg, firstvararg) \
- __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
- #define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
- #define __strfmonlike(fmtarg, firstvararg) \
- __attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))
- #define __strftimelike(fmtarg, firstvararg) \
- __attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
- #endif
- #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
- defined(__GNUC__) && !defined(__INTEL_COMPILER)
- #define __printf0like(fmtarg, firstvararg) \
- __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
- #else
- #define __printf0like(fmtarg, firstvararg)
- #endif
- #if defined(__GNUC__) || defined(__INTEL_COMPILER)
- #ifndef __INTEL_COMPILER
- #define __strong_reference(sym,aliassym) \
- extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
- #endif
- #ifdef __ELF__
- #ifdef __STDC__
- #define __weak_reference(sym,alias) \
- __asm__(".weak " #alias); \
- __asm__(".equ " #alias ", " #sym)
- #define __warn_references(sym,msg) \
- __asm__(".section .gnu.warning." #sym); \
- __asm__(".asciz \"" msg "\"")
- __asm__(".previous")
- #define __sym_compat(sym,impl,verid) \
- __asm__(".symver " #impl ", " #sym "@" #verid)
- #define __sym_default(sym,impl,verid) \
- __asm__(".symver " #impl ", " #sym "@@" #verid)
- #else
- #define __weak_reference(sym,alias) \
- __asm__(".weak alias")
- __asm__(".equ alias, sym")
- #define __warn_references(sym,msg) \
- __asm__(".section .gnu.warning.sym")
- __asm__(".asciz \"msg\"")
- __asm__(".previous")
- #define __sym_compat(sym,impl,verid) \
- __asm__(".symver impl, sym@verid")
- #define __sym_default(impl,sym,verid) \
- __asm__(".symver impl, sym@@verid")
- #endif
- #else
- #ifdef __STDC__
- #define __weak_reference(sym,alias) \
- __asm__(".stabs \"_" #alias "\",11,0,0,0"); \
- __asm__(".stabs \"_" #sym "\",1,0,0,0")
- #define __warn_references(sym,msg) \
- __asm__(".stabs \"" msg "\",30,0,0,0")
- __asm__(".stabs \"_" #sym "\",1,0,0,0")
- #else
- #define __weak_reference(sym,alias) \
- __asm__(".stabs \"_/**/alias\",11,0,0,0")
- __asm__(".stabs \"_/**/sym\",1,0,0,0")
- #define __warn_references(sym,msg) \
- __asm__(".stabs msg,30,0,0,0")
- __asm__(".stabs \"_/**/sym\",1,0,0,0")
- #endif
- #endif
- #endif
- #ifndef __FBSDID
- #define __FBSDID(s) struct __hack
- #endif
- #ifndef __RCSID
- #define __RCSID(s) struct __hack
- #endif
- #ifndef __RCSID_SOURCE
- #define __RCSID_SOURCE(s) struct __hack
- #endif
- #ifndef __SCCSID
- #define __SCCSID(s) struct __hack
- #endif
- #ifndef __COPYRIGHT
- #define __COPYRIGHT(s) struct __hack
- #endif
- #ifndef __DECONST
- #define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
- #endif
- #ifndef __DEVOLATILE
- #define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
- #endif
- #ifndef __DEQUALIFY
- #define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
- #endif
- #if !(defined(__clang__) && __has_feature(nullability))
- #define _Nonnull
- #define _Nullable
- #define _Null_unspecified
- #define __NULLABILITY_PRAGMA_PUSH
- #define __NULLABILITY_PRAGMA_POP
- #else
- #define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \
- _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"")
- #define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop")
- #endif
- #if __has_attribute(__argument_with_type_tag__) && \
- __has_attribute(__type_tag_for_datatype__)
- #define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \
- __attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx)))
- #define __datatype_type_tag(kind, type) \
- __attribute__((__type_tag_for_datatype__(kind, type)))
- #else
- #define __arg_type_tag(arg_kind, arg_idx, type_tag_idx)
- #define __datatype_type_tag(kind, type)
- #endif
- #if __has_extension(c_thread_safety_attributes)
- #define __lock_annotate(x) __attribute__((x))
- #else
- #define __lock_annotate(x)
- #endif
- #define __lockable __lock_annotate(lockable)
- #define __locks_exclusive(...) \
- __lock_annotate(exclusive_lock_function(__VA_ARGS__))
- #define __locks_shared(...) \
- __lock_annotate(shared_lock_function(__VA_ARGS__))
- #define __trylocks_exclusive(...) \
- __lock_annotate(exclusive_trylock_function(__VA_ARGS__))
- #define __trylocks_shared(...) \
- __lock_annotate(shared_trylock_function(__VA_ARGS__))
- #define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__))
- #define __asserts_exclusive(...) \
- __lock_annotate(assert_exclusive_lock(__VA_ARGS__))
- #define __asserts_shared(...) \
- __lock_annotate(assert_shared_lock(__VA_ARGS__))
- #define __requires_exclusive(...) \
- __lock_annotate(exclusive_locks_required(__VA_ARGS__))
- #define __requires_shared(...) \
- __lock_annotate(shared_locks_required(__VA_ARGS__))
- #define __requires_unlocked(...) \
- __lock_annotate(locks_excluded(__VA_ARGS__))
- #define __no_lock_analysis __lock_annotate(no_thread_safety_analysis)
- #define __guarded_by(x) __lock_annotate(guarded_by(x))
- #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x))
- #endif
|