diff options
Diffstat (limited to 'libc/include/sys/cdefs.h')
-rw-r--r-- | libc/include/sys/cdefs.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h index a919a7922..dceb1165c 100644 --- a/libc/include/sys/cdefs.h +++ b/libc/include/sys/cdefs.h @@ -86,6 +86,7 @@ #define __noreturn __attribute__((__noreturn__)) #define __mallocfunc __attribute__((__malloc__)) #define __packed __attribute__((__packed__)) +#define __returns_twice __attribute__((__returns_twice__)) #define __unused __attribute__((__unused__)) #define __used __attribute__((__used__)) @@ -288,6 +289,30 @@ #define __pass_object_size __pass_object_size_n(__bos_level) #define __pass_object_size0 __pass_object_size_n(0) +/* Intended for use in unevaluated contexts, e.g. diagnose_if conditions. */ +#define __bos_unevaluated_lt(bos_val, val) \ + ((bos_val) != __BIONIC_FORTIFY_UNKNOWN_SIZE && (bos_val) < (val)) + +#define __bos_unevaluated_le(bos_val, val) \ + ((bos_val) != __BIONIC_FORTIFY_UNKNOWN_SIZE && (bos_val) <= (val)) + +/* Intended for use in evaluated contexts. */ +#define __bos_dynamic_check_impl_and(bos_val, op, index, cond) \ + (bos_val == __BIONIC_FORTIFY_UNKNOWN_SIZE || \ + (__builtin_constant_p(index) && bos_val op index && (cond))) + +#define __bos_dynamic_check_impl(bos_val, op, index) \ + __bos_dynamic_check_impl_and(bos_val, op, index, 1) + +#define __bos_trivially_ge(bos_val, index) __bos_dynamic_check_impl((bos_val), >=, (index)) + +#define __bos_trivially_gt(bos_val, index) __bos_dynamic_check_impl((bos_val), >, (index)) + +/* The names here are meant to match nicely with the __bos_unevaluated macros above. */ +#define __bos_trivially_not_lt __bos_trivially_ge +#define __bos_trivially_not_le __bos_trivially_gt + + #if defined(__BIONIC_FORTIFY) || defined(__BIONIC_DECLARE_FORTIFY_HELPERS) # define __BIONIC_INCLUDE_FORTIFY_HEADERS 1 #endif |