166d00febSPaula Toth //===-- Internal header for assert ------------------------------*- C++ -*-===// 2b47c9f53SAlex Brachet // 3b47c9f53SAlex Brachet // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4b47c9f53SAlex Brachet // See https://llvm.org/LICENSE.txt for license information. 5b47c9f53SAlex Brachet // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6b47c9f53SAlex Brachet // 7b47c9f53SAlex Brachet //===----------------------------------------------------------------------===// 8b47c9f53SAlex Brachet 9*5080840dSMichael Jones #include "src/assert/__assert_fail.h" 10b47c9f53SAlex Brachet 11*5080840dSMichael Jones // There is no header guard here since assert is intended to be able to be 12*5080840dSMichael Jones // able to be included multiple times with NDEBUG defined differently, causing 13*5080840dSMichael Jones // different behavior. 14b47c9f53SAlex Brachet 15b47c9f53SAlex Brachet #undef assert 16b47c9f53SAlex Brachet 17b47c9f53SAlex Brachet #ifdef NDEBUG 18b47c9f53SAlex Brachet #define assert(e) (void)0 19b47c9f53SAlex Brachet #else 20b47c9f53SAlex Brachet #define assert(e) \ 21b47c9f53SAlex Brachet ((e) ? (void)0 : \ 22b47c9f53SAlex Brachet __llvm_libc::__assert_fail(#e, __FILE__, __LINE__, __PRETTY_FUNCTION__)) 23b47c9f53SAlex Brachet #endif 24