33 lines · plain
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-exception6//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()'s13// definition based on NDEBUG.14 15#ifndef __cplusplus16#undef static_assert17#define static_assert _Static_assert18#endif19 20#undef assert21#ifdef NDEBUG22#define assert(...) ((void)0)23#else24#ifdef __cplusplus25extern "C"26#endif27_Noreturn void __assert_fail(const char *, const char *, unsigned, const char *) __NOEXCEPT;28#define assert(...) \29 ((__VA_ARGS__) ? ((void)0) : __assert_fail(#__VA_ARGS__, __FILE__, __LINE__, __PRETTY_FUNCTION__))30#endif31 32%%public_api()33