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  */
16 
17 module core.stdc.assert_;
18 
19 version (OSX)
20     version = Darwin;
21 else version (iOS)
22     version = Darwin;
23 else version (TVOS)
24     version = Darwin;
25 else version (WatchOS)
26     version = Darwin;
27 
28 extern (C):
29 @trusted:
30 nothrow:
31 @nogc:
32 
33 version (CRuntime_LIBWASM)
34 {
35     noreturn _assert(const(void)* exp, const(void)* file, uint line);
36 }
37 version (CRuntime_DigitalMars)
38 {
39     /***
40      * Assert failure function in the Digital Mars C library.
41      */
42     noreturn _assert(const(void)* exp, const(void)* file, uint line);
43 }
44 else version (CRuntime_Microsoft)
45 {
46     /***
47      * Assert failure function in the Microsoft C library.
48      * `_assert` is not in assert.h, but it is in the library.
49      */
50     noreturn _wassert(const(wchar)* exp, const(wchar)* file, uint line);
51     ///
52     noreturn _assert(const(char)* exp, const(char)* file, uint line);
53 }
54 else version (Darwin)
55 {
56     /***
57      * Assert failure function in the Darwin C library.
58      */
59     noreturn __assert_rtn(const(char)* func, const(char)* file, uint line, const(char)* exp);
60 }
61 else version (FreeBSD)
62 {
63     /***
64      * Assert failure function in the FreeBSD C library.
65      */
66     noreturn __assert(const(char)* func, const(char)* file, uint line, const(char)* exp);
67 }
68 else version (NetBSD)
69 {
70     /***
71      * Assert failure function in the NetBSD C library.
72      */
73     noreturn __assert(const(char)* file, int line, const(char)* exp);
74     ///
75     noreturn __assert13(const(char)* file, int line, const(char)* func, const(char)* exp);
76 }
77 else version (OpenBSD)
78 {
79     /***
80      * Assert failure function in the OpenBSD C library.
81      */
82     noreturn __assert(const(char)* file, int line, const(char)* exp);
83     ///
84     noreturn __assert2(const(char)* file, int line, const(char)* func, const(char)* exp);
85 }
86 else version (DragonFlyBSD)
87 {
88     /***
89      * Assert failure function in the DragonFlyBSD C library.
90      */
91     noreturn __assert(const(char)* func, const(char)* file, uint line, const(char)* exp);
92 }
93 else version (CRuntime_Glibc)
94 {
95     /***
96      * Assert failure functions in the GLIBC library.
97      */
98     noreturn __assert(const(char)* exp, const(char)* file, uint line);
99     ///
100     noreturn __assert_fail(const(char)* exp, const(char)* file, uint line, const(char)* func);
101     ///
102     noreturn __assert_perror_fail(int errnum, const(char)* file, uint line, const(char)* func);
103 }
104 else version (CRuntime_Bionic)
105 {
106     /***
107      * Assert failure functions in the Bionic library.
108      */
109     noreturn __assert(const(char)* __file, int __line, const(char)* __msg);
110     ///
111     noreturn __assert2(const(char)* __file, int __line, const(char)* __function, const(char)* __msg);
112 }
113 else version (CRuntime_Musl)
114 {
115      /***
116      * Assert failure function in the Musl C library.
117      */
118     noreturn __assert_fail(const(char)* exp, const(char)* file, uint line, const(char)* func);
119 }
120 else version (CRuntime_UClibc)
121 {
122     noreturn __assert(const(char)* exp, const(char)* file, uint line, const(char)* func);
123 }
124 else version (Solaris)
125 {
126     noreturn __assert_c99(const(char)* exp, const(char)* file, uint line, const(char)* func);
127 }
128 else version (CRuntime_LIBWASM) {
129     /***
130      * Assert failure functions in the LIBWASM library.
131      */
132     noreturn __assert(const(char)* exp, const(char)* file, uint line);
133     ///
134     noreturn __assert_fail(const(char)* exp, const(char)* file, uint line, const(char)* func);
135     ///
136     noreturn __assert_perror_fail(int errnum, const(char)* file, uint line, const(char)* func);
137 
138 }
139 else
140 {
141     static assert(0);
142 }