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