xref: /llvm-project/libc/include/assert.h.def (revision d386a5582b286bbd8a52f2fd3dbc5c8f70a8f60d)
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//===----------------------------------------------------------------------===//
8
9#include "__llvm-libc-common.h"
10#include "llvm-libc-macros/assert-macros.h"
11
12// This file may be usefully included multiple times to change assert()'s
13// definition based on NDEBUG.
14
15#ifndef __cplusplus
16#undef static_assert
17#define static_assert _Static_assert
18#endif
19
20#undef assert
21#ifdef NDEBUG
22#define assert(e) (void)0
23#else
24#ifdef __cplusplus
25extern "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
31
32%%public_api()
33