diff options
| author | Craig Barnes <craigbarnes@protonmail.com> | 2021-01-15 20:39:45 +0000 |
|---|---|---|
| committer | Craig Barnes <craigbarnes@protonmail.com> | 2021-01-16 19:56:33 +0000 |
| commit | 22f25a9e4feddbc093ae01cd53bdda3c2c3a82e9 (patch) | |
| tree | 4d0c9bce90d0f0d04c22e9f88b52f910695cfaf6 /macros.h | |
| parent | Merge branch 'decset-1047-and-1048' (diff) | |
Print stack trace on assert() failure or when calling fatal_error()
Note: this uses the __sanitizer_print_stack_trace() function from the
AddressSanitizer runtime, so it only works when AddressSanitizer is
in use.
Diffstat (limited to 'macros.h')
| -rw-r--r-- | macros.h | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -27,6 +27,21 @@ #define HAS_BUILTIN(x) 0 #endif +#ifdef __has_feature + #define HAS_FEATURE(x) __has_feature(x) +#else + #define HAS_FEATURE(x) 0 +#endif + +// __has_extension() is a Clang macro used to determine if a feature is +// available even if not standardized in the current "-std" mode. +#ifdef __has_extension + #define HAS_EXTENSION(x) __has_extension(x) +#else + // Clang versions prior to 3.0 only supported __has_feature() + #define HAS_EXTENSION(x) HAS_FEATURE(x) +#endif + #if GNUC_AT_LEAST(3, 0) || HAS_ATTRIBUTE(unused) || defined(__TINYC__) #define UNUSED __attribute__((__unused__)) #else @@ -139,11 +154,11 @@ #define XSTRDUP XMALLOC NONNULL_ARGS #if __STDC_VERSION__ >= 201112L - #define NORETURN _Noreturn + #define noreturn _Noreturn #elif GNUC_AT_LEAST(3, 0) - #define NORETURN __attribute__((__noreturn__)) + #define noreturn __attribute__((__noreturn__)) #else - #define NORETURN + #define noreturn #endif #if CLANG_AT_LEAST(3, 6) |
