/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1992, 19934* The Regents of the University of California. All rights reserved.5* (c) UNIX System Laboratories, Inc.6* All or some portions of this file are derived from material licensed7* to the University of California by American Telephone and Telegraph8* Co. or Unix System Laboratories, Inc. and are reproduced herein with9* the permission of UNIX System Laboratories, Inc.10*11* Redistribution and use in source and binary forms, with or without12* modification, are permitted provided that the following conditions13* are met:14* 1. Redistributions of source code must retain the above copyright15* notice, this list of conditions and the following disclaimer.16* 2. Redistributions in binary form must reproduce the above copyright17* notice, this list of conditions and the following disclaimer in the18* documentation and/or other materials provided with the distribution.19* 3. Neither the name of the University nor the names of its contributors20* may be used to endorse or promote products derived from this software21* without specific prior written permission.22*23* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND24* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE25* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE26* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE27* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL28* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS29* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)30* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT31* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY32* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF33* SUCH DAMAGE.34*/3536#include <sys/cdefs.h>3738/*39* Unlike other ANSI header files, <assert.h> may usefully be included40* multiple times, with and without NDEBUG defined.41*/4243#undef assert44#undef _assert45#undef __assert_unreachable4647#ifdef NDEBUG48#define assert(e) ((void)0)49#define _assert(e) ((void)0)50#if __BSD_VISIBLE51#define __assert_unreachable() __unreachable()52#endif /* __BSD_VISIBLE */53#else54#define _assert(e) assert(e)5556#define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \57__LINE__, #e))58#if __BSD_VISIBLE59#define __assert_unreachable() assert(0 && "unreachable segment reached")60#endif /* __BSD_VISIBLE */61#endif /* NDEBUG */6263#ifndef _ASSERT_H_64#define _ASSERT_H_6566/*67* Static assertions. In principle we could define static_assert for68* C++ older than C++11, but this breaks if _Static_assert is69* implemented as a macro.70*71* C++ template parameters may contain commas, even if not enclosed in72* parentheses, causing the _Static_assert macro to be invoked with more73* than two parameters.74*/75#if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus)76#define static_assert _Static_assert77#endif7879__BEGIN_DECLS80void __assert(const char *, const char *, int, const char *) __dead2;81__END_DECLS8283#endif /* !_ASSERT_H_ */848586