zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

cdefs.h (2137B) - Raw


      1 #ifndef _SYS_CDEFS_H
      2 
      3 /* This is outside of _ISOMAC to enforce that _Static_assert always
      4    uses the two-argument form.  This can be removed once the minimum
      5    GCC version used to compile glibc is GCC 9.1.  */
      6 #ifndef __cplusplus
      7 # define _Static_assert(expr, diagnostic) _Static_assert (expr, diagnostic)
      8 #endif
      9 
     10 #include <misc/sys/cdefs.h>
     11 
     12 #ifndef _ISOMAC
     13 /* The compiler will optimize based on the knowledge the parameter is
     14    not NULL.  This will omit tests.  A robust implementation cannot allow
     15    this so when compiling glibc itself we ignore this attribute.  */
     16 # undef __nonnull
     17 # define __nonnull(params)
     18 
     19 extern void __chk_fail (void) __attribute__ ((__noreturn__));
     20 libc_hidden_proto (__chk_fail)
     21 rtld_hidden_proto (__chk_fail)
     22 
     23 /* If we are using redirects internally to support long double,
     24    we need to tweak some macros to ensure the PLT bypass tricks
     25    continue to work in libc. */
     26 #if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
     27 
     28 # undef __LDBL_REDIR_DECL
     29 # define __LDBL_REDIR_DECL(func) \
     30    extern __typeof(func) func __asm (__ASMNAME ("__GI____ieee128_" #func));
     31 
     32 # undef libc_hidden_ldbl_proto
     33 # define libc_hidden_ldbl_proto(func, attrs...) \
     34    extern __typeof(func) ___ieee128_ ## func; \
     35    libc_hidden_proto (___ieee128_ ## func, ##attrs);
     36 
     37 # undef __LDBL_REDIR2_DECL
     38 # define __LDBL_REDIR2_DECL(func) \
     39    extern __typeof(__ ## func) __ ## func __asm (__ASMNAME ("__GI____ieee128___" #func));
     40 
     41 #endif
     42 
     43 #if defined SHARED
     44 #if IS_IN (libc) && __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
     45 
     46 #undef __REDIRECT_FORTIFY
     47 #define __REDIRECT_FORTIFY(name, proto, alias) \
     48   __REDIRECT(name, proto, __GI_##alias)
     49 
     50 #undef __REDIRECT_FORTIFY_NTH
     51 #define __REDIRECT_FORTIFY_NTH(name, proto, alias) \
     52   __REDIRECT_NTH(name, proto, __GI_##alias)
     53 
     54 #endif
     55 #endif /* defined SHARED */
     56 
     57 #endif /* !defined _ISOMAC */
     58 
     59 /*  Prevents a function from being considered for inlining and cloning.  */
     60 #ifdef __clang__
     61 # define __attribute_optimization_barrier__ __attribute__ ((optnone))
     62 #else
     63 # define __attribute_optimization_barrier__ __attribute__ ((noinline, noclone))
     64 #endif
     65 
     66 #endif