2020-04-08 10:16:30 -07:00
|
|
|
//===-- C standard library header assert.h --------------------------------===//
|
2020-03-11 23:45:58 -04:00
|
|
|
//
|
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
|
//
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
2024-03-22 08:24:08 -07:00
|
|
|
#include "__llvm-libc-common.h"
|
2024-04-25 01:31:16 +05:30
|
|
|
#include "llvm-libc-macros/assert-macros.h"
|
2020-03-11 23:45:58 -04:00
|
|
|
|
|
|
|
|
// This file may be usefully included multiple times to change assert()'s
|
|
|
|
|
// definition based on NDEBUG.
|
|
|
|
|
|
2024-07-15 16:52:32 -07:00
|
|
|
#ifndef __cplusplus
|
|
|
|
|
#undef static_assert
|
|
|
|
|
#define static_assert _Static_assert
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-07-20 00:56:52 -07:00
|
|
|
#undef assert
|
|
|
|
|
#ifdef NDEBUG
|
2025-04-28 12:06:52 -07:00
|
|
|
#define assert(...) ((void)0)
|
2024-07-20 00:56:52 -07:00
|
|
|
#else
|
2024-07-15 16:52:32 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C"
|
|
|
|
|
#endif
|
|
|
|
|
_Noreturn void __assert_fail(const char *, const char *, unsigned, const char *) __NOEXCEPT;
|
2025-04-28 12:06:52 -07:00
|
|
|
#define assert(...) \
|
|
|
|
|
((__VA_ARGS__) ? ((void)0) : __assert_fail(#__VA_ARGS__, __FILE__, __LINE__, __PRETTY_FUNCTION__))
|
2024-07-15 16:52:32 -07:00
|
|
|
#endif
|
|
|
|
|
|
2020-03-11 23:45:58 -04:00
|
|
|
%%public_api()
|