1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* Copyright (c) 1988 AT&T */ 23 /* All Rights Reserved */ 24 25 /* 26 * Copyright 2016 Joyent, Inc. 27 * Copyright 2025 Oxide Computer Company 28 * 29 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 30 * Use is subject to license terms. 31 */ 32 33 #ifndef _ISO_ASSERT_ISO_H 34 #define _ISO_ASSERT_ISO_H 35 36 /* 37 * This file contains all of the portions of the assert.h implementation that we 38 * wish to be re-entrant safe. This is not in <assert.h> as a number of 39 * third-party applications have tried to use their own wrappers that use a 40 * header guard, which lead to us losing the definitions that we need to have. 41 * While those applications are potentially using the implementation namespace 42 * incorrectly, separating out the two logical uses is helpful nonetheless and 43 * hopefully makes it clearer what is what. 44 * 45 * This header should not be included directly by applications! 46 */ 47 48 #include <sys/feature_tests.h> 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif 53 54 #if defined(_STDC_C99) 55 extern _NORETURN_KYWD void __assert_c99(const char *, const char *, int, 56 const char *) __NORETURN; 57 #else 58 extern _NORETURN_KYWD void __assert(const char *, const char *, int) __NORETURN; 59 #endif /* _STDC_C99 */ 60 61 /* 62 * In C11 the static_assert macro is always defined, unlike the assert macro. 63 * Starting in C23, static_assert is a keyword, so this is no longer required. 64 */ 65 #if defined(_STDC_C11) && !defined(__cplusplus) && !defined(_STDC_C23) 66 #define static_assert _Static_assert 67 #endif /* _STDC_C11 && !defined(__cplusplus) && !_STDC_C23 */ 68 69 #ifdef __cplusplus 70 } 71 #endif 72 73 #endif /* _ISO_ASSERT_ISO_H */ 74