[libc++][Android] Allow testing libc++ with clang-r536225 (#116149)
[llvm-project.git] / libc / include / assert.h.def
blobd5ae14a1cd8101f3cfef2fa372ae962f0e49fb65
1 //===-- C standard library header assert.h --------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "__llvm-libc-common.h"
10 #include "llvm-libc-macros/assert-macros.h"
12 // This file may be usefully included multiple times to change assert()'s
13 // definition based on NDEBUG.
15 #ifndef __cplusplus
16 #undef static_assert
17 #define static_assert _Static_assert
18 #endif
20 #undef assert
21 #ifdef NDEBUG
22 #define assert(e) (void)0
23 #else
24 #ifdef __cplusplus
25 extern "C"
26 #endif
27 _Noreturn void __assert_fail(const char *, const char *, unsigned, const char *) __NOEXCEPT;
28 #define assert(e) \
29 ((e) ? (void)0 : __assert_fail(#e, __FILE__, __LINE__, __PRETTY_FUNCTION__))
30 #endif
32 %%public_api()