Go to the documentation of this file.
42 #ifndef __has_attribute
43 #define __has_attribute(x) 0
45 #ifndef __has_extension
46 #define __has_extension __has_feature
49 #define __has_feature(x) 0
52 #define __has_include(x) 0
55 #define __has_builtin(x) 0
58 #if defined(__cplusplus)
59 #define __BEGIN_DECLS extern "C" {
72 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
74 #if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
75 #define __GNUCLIKE_ASM 3
76 #define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
78 #define __GNUCLIKE_ASM 2
80 #define __GNUCLIKE___TYPEOF 1
81 #define __GNUCLIKE___OFFSETOF 1
82 #define __GNUCLIKE___SECTION 1
84 #ifndef __INTEL_COMPILER
85 #define __GNUCLIKE_CTOR_SECTION_HANDLING 1
88 #define __GNUCLIKE_BUILTIN_CONSTANT_P 1
89 #if defined(__INTEL_COMPILER) && defined(__cplusplus) && \
90 __INTEL_COMPILER < 800
91 #undef __GNUCLIKE_BUILTIN_CONSTANT_P
94 #if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3)
95 #define __GNUCLIKE_BUILTIN_VARARGS 1
96 #define __GNUCLIKE_BUILTIN_STDARG 1
97 #define __GNUCLIKE_BUILTIN_VAALIST 1
100 #if defined(__GNUC__)
101 #define __GNUC_VA_LIST_COMPATIBILITY 1
107 #if defined(__GNUC__)
108 #define __compiler_membar() __asm __volatile(" " : : : "memory")
111 #ifndef __INTEL_COMPILER
112 #define __GNUCLIKE_BUILTIN_NEXT_ARG 1
113 #define __GNUCLIKE_MATH_BUILTIN_RELOPS
116 #define __GNUCLIKE_BUILTIN_MEMCPY 1
119 #define __CC_SUPPORTS_INLINE 1
120 #define __CC_SUPPORTS___INLINE 1
121 #define __CC_SUPPORTS___INLINE__ 1
123 #define __CC_SUPPORTS___FUNC__ 1
124 #define __CC_SUPPORTS_WARNING 1
126 #define __CC_SUPPORTS_VARADIC_XXX 1
128 #define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
135 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
136 #define __GNUC_PREREQ__(ma, mi) \
137 (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
139 #define __GNUC_PREREQ__(ma, mi) 0
154 #if defined(__STDC__) || defined(__cplusplus)
155 #define __P(protos) protos
156 #define __CONCAT1(x,y) x ## y
157 #define __CONCAT(x,y) __CONCAT1(x,y)
158 #define __STRING(x) #x
159 #define __XSTRING(x) __STRING(x)
161 #define __const const
162 #define __signed signed
163 #define __volatile volatile
164 #if defined(__cplusplus)
165 #define __inline inline
167 #if !(defined(__CC_SUPPORTS___INLINE))
173 #define __P(protos) ()
174 #define __CONCAT(x,y) xy
175 #define __STRING(x) "x"
177 #if !defined(__CC_SUPPORTS___INLINE)
190 #ifndef NO_ANSI_KEYWORDS
214 #define __alloc_align(x)
215 #define __alloc_size(x)
217 #define __weak_symbol
219 #define __weak_symbol __attribute__((__weak__))
220 #if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
225 #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
226 #define __dead2 __attribute__((__noreturn__))
227 #define __pure2 __attribute__((__const__))
231 #if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER)
232 #define __dead2 __attribute__((__noreturn__))
233 #define __pure2 __attribute__((__const__))
234 #define __unused __attribute__((__unused__))
235 #define __used __attribute__((__used__))
236 #define __packed __attribute__((__packed__))
237 #define __aligned(x) __attribute__((__aligned__(x)))
238 #define __section(x) __attribute__((__section__(x)))
240 #if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__)
241 #define __alloc_size(x) __attribute__((__alloc_size__(x)))
243 #define __alloc_size(x)
245 #if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__)
246 #define __alloc_align(x) __attribute__((__alloc_align__(x)))
248 #define __alloc_align(x)
252 #if !__GNUC_PREREQ__(2, 95)
253 #define __alignof(x) __offsetof(struct { char __a; x __b; }, __b)
260 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L || defined(lint)
262 #if !__has_extension(c_alignas)
263 #if (defined(__cplusplus) && __cplusplus >= 201103L) || \
264 __has_extension(cxx_alignas)
265 #define _Alignas(x) alignas(x)
268 #define _Alignas(x) __aligned(x)
272 #if defined(__cplusplus) && __cplusplus >= 201103L
273 #define _Alignof(x) alignof(x)
275 #define _Alignof(x) __alignof(x)
278 #if !defined(__cplusplus) && !__has_extension(c_atomic) && \
279 !__has_extension(cxx_atomic)
284 #define _Atomic(T) struct { T volatile __val; }
287 #if defined(__cplusplus) && __cplusplus >= 201103L
288 #define _Noreturn [[noreturn]]
290 #define _Noreturn __dead2
293 #if !__has_extension(c_static_assert)
294 #if (defined(__cplusplus) && __cplusplus >= 201103L) || \
295 __has_extension(cxx_static_assert)
296 #define _Static_assert(x, y) static_assert(x, y)
297 #elif __GNUC_PREREQ__(4,6)
299 #elif defined(__COUNTER__)
300 #define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
301 #define __Static_assert(x, y) ___Static_assert(x, y)
302 #define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \
305 #define _Static_assert(x, y) struct __hack
309 #if !__has_extension(c_thread_local)
316 __has_extension(cxx_thread_local)
317 #define _Thread_local thread_local
319 #define _Thread_local __thread
334 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
335 __has_extension(c_generic_selections)
336 #define __generic(expr, t, yes, no) \
337 _Generic(expr, t: yes, default: no)
338 #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
339 #define __generic(expr, t, yes, no) \
340 __builtin_choose_expr( \
341 __builtin_types_compatible_p(__typeof(expr), t), yes, no)
351 #if !defined(__cplusplus) && \
352 (defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \
353 (!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901))
354 #define __min_size(x) static (x)
356 #define __min_size(x) (x)
359 #if __GNUC_PREREQ__(2, 96)
360 #define __malloc_like __attribute__((__malloc__))
361 #define __pure __attribute__((__pure__))
363 #define __malloc_like
367 #if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
368 #define __always_inline __attribute__((__always_inline__))
370 #define __always_inline
373 #if __GNUC_PREREQ__(3, 1)
374 #define __noinline __attribute__ ((__noinline__))
379 #if __GNUC_PREREQ__(3, 3)
380 #define __nonnull(x) __attribute__((__nonnull__(x)))
381 #define __nonnull_all __attribute__((__nonnull__))
384 #define __nonnull_all
387 #if __GNUC_PREREQ__(3, 4)
388 #define __fastcall __attribute__((__fastcall__))
389 #define __result_use_check __attribute__((__warn_unused_result__))
392 #define __result_use_check
395 #if __GNUC_PREREQ__(4, 1)
396 #define __returns_twice __attribute__((__returns_twice__))
398 #define __returns_twice
401 #if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable)
402 #define __unreachable() __builtin_unreachable()
404 #define __unreachable() ((void)0)
408 #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
409 #define __func__ NULL
412 #if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
413 #define __LONG_LONG_SUPPORTED
417 #if defined(__cplusplus) && __cplusplus >= 201103L
418 #define __LONG_LONG_SUPPORTED
419 #ifndef __STDC_LIMIT_MACROS
420 #define __STDC_LIMIT_MACROS
422 #ifndef __STDC_CONSTANT_MACROS
423 #define __STDC_CONSTANT_MACROS
433 #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
434 #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
437 #define __restrict restrict
469 #if __GNUC_PREREQ__(2, 96)
470 #define __predict_true(exp) __builtin_expect((exp), 1)
471 #define __predict_false(exp) __builtin_expect((exp), 0)
473 #define __predict_true(exp) (exp)
474 #define __predict_false(exp) (exp)
477 #if __GNUC_PREREQ__(4, 0)
478 #define __null_sentinel __attribute__((__sentinel__))
479 #define __exported __attribute__((__visibility__("default")))
480 #define __hidden __attribute__((__visibility__("hidden")))
482 #define __null_sentinel
491 #if __GNUC_PREREQ__(4, 1)
492 #define __offsetof(type, field) __builtin_offsetof(type, field)
495 #define __offsetof(type, field) \
496 ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field))
498 #define __offsetof(type, field) \
499 (__offsetof__ (reinterpret_cast <__size_t> \
500 (&reinterpret_cast <const volatile char &> \
501 (static_cast<type *> (0)->field))))
504 #define __rangeof(type, start, end) \
505 (__offsetof(type, end) - __offsetof(type, start))
513 #if __GNUC_PREREQ__(3, 1)
514 #define __containerof(x, s, m) ({ \
515 const volatile __typeof(((s *)0)->m) *__x = (x); \
516 __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
519 #define __containerof(x, s, m) \
520 __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
529 #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
530 #define __printflike(fmtarg, firstvararg)
531 #define __scanflike(fmtarg, firstvararg)
532 #define __format_arg(fmtarg)
533 #define __strfmonlike(fmtarg, firstvararg)
534 #define __strftimelike(fmtarg, firstvararg)
536 #define __printflike(fmtarg, firstvararg) \
537 __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
538 #define __scanflike(fmtarg, firstvararg) \
539 __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
540 #define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
541 #define __strfmonlike(fmtarg, firstvararg) \
542 __attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))
543 #define __strftimelike(fmtarg, firstvararg) \
544 __attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
548 #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
549 defined(__GNUC__) && !defined(__INTEL_COMPILER)
550 #define __printf0like(fmtarg, firstvararg) \
551 __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
553 #define __printf0like(fmtarg, firstvararg)
556 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
557 #ifndef __INTEL_COMPILER
558 #define __strong_reference(sym,aliassym) \
559 extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
562 #define __weak_reference(sym,alias) \
563 __asm__(".weak " #alias); \
564 __asm__(".equ " #alias ", " #sym)
565 #define __warn_references(sym,msg) \
566 __asm__(".section .gnu.warning." #sym); \
567 __asm__(".asciz \"" msg "\""); \
569 #define __sym_compat(sym,impl,verid) \
570 __asm__(".symver " #impl ", " #sym "@" #verid)
571 #define __sym_default(sym,impl,verid) \
572 __asm__(".symver " #impl ", " #sym "@@" #verid)
574 #define __weak_reference(sym,alias) \
575 __asm__(".weak alias"); \
576 __asm__(".equ alias, sym")
577 #define __warn_references(sym,msg) \
578 __asm__(".section .gnu.warning.sym"); \
579 __asm__(".asciz \"msg\""); \
581 #define __sym_compat(sym,impl,verid) \
582 __asm__(".symver impl, sym@verid")
583 #define __sym_default(impl,sym,verid) \
584 __asm__(".symver impl, sym@@verid")
588 #define __GLOBL1(sym) __asm__(".globl " #sym)
589 #define __GLOBL(sym) __GLOBL1(sym)
591 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
592 #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
600 #define __IDSTRING(name,string) static const char name[] __unused = string
610 #if !defined(lint) && !defined(STRIP_FBSDID)
611 #define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
613 #define __FBSDID(s) struct __hack
619 #define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
621 #define __RCSID(s) struct __hack
625 #ifndef __RCSID_SOURCE
626 #ifndef NO__RCSID_SOURCE
627 #define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
629 #define __RCSID_SOURCE(s) struct __hack
635 #define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
637 #define __SCCSID(s) struct __hack
642 #ifndef NO__COPYRIGHT
643 #define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
645 #define __COPYRIGHT(s) struct __hack
650 #define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
654 #define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
658 #define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
685 #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
686 #undef _POSIX_C_SOURCE
687 #define _POSIX_C_SOURCE 199009
691 #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
692 #undef _POSIX_C_SOURCE
693 #define _POSIX_C_SOURCE 199209
698 #if _XOPEN_SOURCE - 0 >= 700
699 #define __XSI_VISIBLE 700
700 #undef _POSIX_C_SOURCE
701 #define _POSIX_C_SOURCE 200809
702 #elif _XOPEN_SOURCE - 0 >= 600
703 #define __XSI_VISIBLE 600
704 #undef _POSIX_C_SOURCE
705 #define _POSIX_C_SOURCE 200112
706 #elif _XOPEN_SOURCE - 0 >= 500
707 #define __XSI_VISIBLE 500
708 #undef _POSIX_C_SOURCE
709 #define _POSIX_C_SOURCE 199506
717 #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
718 #define _POSIX_C_SOURCE 198808
720 #ifdef _POSIX_C_SOURCE
721 #if _POSIX_C_SOURCE >= 200809
722 #define __POSIX_VISIBLE 200809
723 #define __ISO_C_VISIBLE 1999
724 #elif _POSIX_C_SOURCE >= 200112
725 #define __POSIX_VISIBLE 200112
726 #define __ISO_C_VISIBLE 1999
727 #elif _POSIX_C_SOURCE >= 199506
728 #define __POSIX_VISIBLE 199506
729 #define __ISO_C_VISIBLE 1990
730 #elif _POSIX_C_SOURCE >= 199309
731 #define __POSIX_VISIBLE 199309
732 #define __ISO_C_VISIBLE 1990
733 #elif _POSIX_C_SOURCE >= 199209
734 #define __POSIX_VISIBLE 199209
735 #define __ISO_C_VISIBLE 1990
736 #elif _POSIX_C_SOURCE >= 199009
737 #define __POSIX_VISIBLE 199009
738 #define __ISO_C_VISIBLE 1990
740 #define __POSIX_VISIBLE 198808
741 #define __ISO_C_VISIBLE 0
756 #if defined(_ANSI_SOURCE)
757 #define __POSIX_VISIBLE 0
758 #define __XSI_VISIBLE 0
759 #define __BSD_VISIBLE 0
760 #define __ISO_C_VISIBLE 1990
761 #define __EXT1_VISIBLE 0
762 #elif defined(_C99_SOURCE)
763 #define __POSIX_VISIBLE 0
764 #define __XSI_VISIBLE 0
765 #define __BSD_VISIBLE 0
766 #define __ISO_C_VISIBLE 1999
767 #define __EXT1_VISIBLE 0
768 #elif defined(_C11_SOURCE)
769 #define __POSIX_VISIBLE 0
770 #define __XSI_VISIBLE 0
771 #define __BSD_VISIBLE 0
772 #define __ISO_C_VISIBLE 2011
773 #define __EXT1_VISIBLE 0
775 #define __POSIX_VISIBLE 200809
776 #define __XSI_VISIBLE 700
777 #define __BSD_VISIBLE 1
778 #define __ISO_C_VISIBLE 2011
779 #define __EXT1_VISIBLE 1
784 #if defined(__STDC_WANT_LIB_EXT1__)
785 #undef __EXT1_VISIBLE
786 #if __STDC_WANT_LIB_EXT1__
787 #define __EXT1_VISIBLE 1
789 #define __EXT1_VISIBLE 0
793 #if defined(__mips) || defined(__powerpc64__) || defined(__riscv__)
801 #if defined(__arm__) && !defined(__ARM_ARCH)
802 #include <machine/acle-compat.h>
808 #if !(defined(__clang__) && __has_feature(nullability))
811 #define _Null_unspecified
812 #define __NULLABILITY_PRAGMA_PUSH
813 #define __NULLABILITY_PRAGMA_POP
815 #define __NULLABILITY_PRAGMA_PUSH _Pragma("clang diagnostic push") \
816 _Pragma("clang diagnostic ignored \"-Wnullability-completeness\"")
817 #define __NULLABILITY_PRAGMA_POP _Pragma("clang diagnostic pop")
827 #if __has_attribute(__argument_with_type_tag__) && \
828 __has_attribute(__type_tag_for_datatype__) && !defined(lint)
829 #define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \
830 __attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx)))
831 #define __datatype_type_tag(kind, type) \
832 __attribute__((__type_tag_for_datatype__(kind, type)))
834 #define __arg_type_tag(arg_kind, arg_idx, type_tag_idx)
835 #define __datatype_type_tag(kind, type)
850 #if __has_extension(c_thread_safety_attributes)
851 #define __lock_annotate(x) __attribute__((x))
853 #define __lock_annotate(x)
857 #define __lockable __lock_annotate(lockable)
860 #define __locks_exclusive(...) \
861 __lock_annotate(exclusive_lock_function(__VA_ARGS__))
862 #define __locks_shared(...) \
863 __lock_annotate(shared_lock_function(__VA_ARGS__))
866 #define __trylocks_exclusive(...) \
867 __lock_annotate(exclusive_trylock_function(__VA_ARGS__))
868 #define __trylocks_shared(...) \
869 __lock_annotate(shared_trylock_function(__VA_ARGS__))
872 #define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__))
875 #define __asserts_exclusive(...) \
876 __lock_annotate(assert_exclusive_lock(__VA_ARGS__))
877 #define __asserts_shared(...) \
878 __lock_annotate(assert_shared_lock(__VA_ARGS__))
881 #define __requires_exclusive(...) \
882 __lock_annotate(exclusive_locks_required(__VA_ARGS__))
883 #define __requires_shared(...) \
884 __lock_annotate(shared_locks_required(__VA_ARGS__))
885 #define __requires_unlocked(...) \
886 __lock_annotate(locks_excluded(__VA_ARGS__))
889 #define __no_lock_analysis __lock_annotate(no_thread_safety_analysis)
892 #define __guarded_by(x) __lock_annotate(guarded_by(x))
893 #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x))