1 /**
2  * D header file for C99.
3  *
4  * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_assert.h.html, _assert.h)
5  *
6  * License: Distributed under the
7  *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
8  *    (See accompanying file LICENSE)
9  * Source:    $(DRUNTIMESRC core/stdc/_assert_.d)
10  * Standards: ISO/IEC 9899:1999 (E)
11  */
12 
13 /****************************
14  * These are the various functions called by the assert() macro.
15  * They are all noreturn functions, although D doesn't have a specific attribute for that.
16  */
17 
18 module core.stdc.assert_;
19 
20 version (OSX)
21     version = Darwin;
22 else version (iOS)
23     version = Darwin;
24 else version (TVOS)
25     version = Darwin;
26 else version (WatchOS)
27     version = Darwin;
28 
29 extern (C):
30 @trusted:
31 nothrow:
32 @nogc:
33 
34 version (CRuntime_DigitalMars)
35 {
36     /***
37      * Assert failure function in the Digital Mars C library.
38      */
39     void _assert(const(void)* exp, const(void)* file, uint line);
40 }
41 else version (CRuntime_Microsoft)
42 {
43     /***
44      * Assert failure function in the Microsoft C library.
45      * `_assert` is not in assert.h, but it is in the library.
46      */
47     void _wassert(const(wchar)* exp, const(wchar)* file, uint line);
48     ///
49     void _assert(const(char)* exp, const(char)* file, uint line);
50 }
51 else version (Darwin)
52 {
53     /***
54      * Assert failure function in the Darwin C library.
55      */
56     void __assert_rtn(const(char)* func, const(char)* file, uint line, const(char)* exp);
57 }
58 else version (FreeBSD)
59 {
60     /***
61      * Assert failure function in the FreeBSD C library.
62      */
63     void __assert(const(char)* func, const(char)* file, uint line, const(char)* exp);
64 }
65 else version (NetBSD)
66 {
67     /***
68      * Assert failure function in the NetBSD C library.
69      */
70     void __assert(const(char)* file, int line, const(char)* exp);
71 }
72 else version (OpenBSD)
73 {
74     /***
75      * Assert failure function in the OpenBSD C library.
76      */
77     void __assert(const(char)* file, int line, const(char)* exp);
78     ///
79     void __assert2(const(char)* file, int line, const(char)* func, const(char)* exp);
80 }
81 else version (DragonFlyBSD)
82 {
83     /***
84      * Assert failure function in the DragonFlyBSD C library.
85      */
86     void __assert(const(char)* func, const(char)* file, uint line, const(char)* exp);
87 }
88 else version (CRuntime_Glibc)
89 {
90     /***
91      * Assert failure functions in the GLIBC library.
92      */
93     void __assert(const(char)* exp, const(char)* file, uint line);
94     ///
95     void __assert_fail(const(char)* exp, const(char)* file, uint line, const(char)* func);
96     ///
97     void __assert_perror_fail(int errnum, const(char)* file, uint line, const(char)* func);
98 }
99 else version (CRuntime_Bionic)
100 {
101     void __assert(const(char)* __file, int __line, const(char)* __msg);
102 }
103 else version (CRuntime_Musl)
104 {
105      /***
106      * Assert failure function in the Musl C library.
107      */
108     void __assert_fail(const(char)* exp, const(char)* file, uint line, const(char)* func);
109 }
110 else version (CRuntime_UClibc)
111 {
112     void __assert(const(char)* exp, const(char)* file, uint line, const(char)* func);
113 }
114 else version (Solaris)
115 {
116     void __assert_c99(const(char)* exp, const(char)* file, uint line, const(char)* func);
117 }
118 else
119 {
120     static assert(0);
121 }