diff options
author | Petr Hosek <phosek@google.com> | 2024-07-20 00:56:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-20 00:56:52 -0700 |
commit | d386a5582b286bbd8a52f2fd3dbc5c8f70a8f60d (patch) | |
tree | 9382d56f0fb14d4d8798f2171fde199bea4cf3f0 /libc/include | |
parent | 867ff2d4268ca7eed89a24f100b67b68f5329439 (diff) | |
download | llvm-d386a5582b286bbd8a52f2fd3dbc5c8f70a8f60d.zip llvm-d386a5582b286bbd8a52f2fd3dbc5c8f70a8f60d.tar.gz llvm-d386a5582b286bbd8a52f2fd3dbc5c8f70a8f60d.tar.bz2 |
[libc] Make static_assert available even if NDEBUG is set (#99742)
This addresses an issue introduced in #98826 where static_assert was
made defined only when NDEBUG is not set which is different from all
other C libraries and breaks any code that uses static_assert and
doesn't guard it with NDEBUG.
Diffstat (limited to 'libc/include')
-rw-r--r-- | libc/include/assert.h.def | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/libc/include/assert.h.def b/libc/include/assert.h.def index 9c924c7..d5ae14a 100644 --- a/libc/include/assert.h.def +++ b/libc/include/assert.h.def @@ -12,22 +12,19 @@ // This file may be usefully included multiple times to change assert()'s // definition based on NDEBUG. - -#undef assert -#ifdef NDEBUG -#define assert(e) (void)0 -#else - #ifndef __cplusplus #undef static_assert #define static_assert _Static_assert #endif +#undef assert +#ifdef NDEBUG +#define assert(e) (void)0 +#else #ifdef __cplusplus extern "C" #endif _Noreturn void __assert_fail(const char *, const char *, unsigned, const char *) __NOEXCEPT; - #define assert(e) \ ((e) ? (void)0 : __assert_fail(#e, __FILE__, __LINE__, __PRETTY_FUNCTION__)) #endif |