The OpenD Programming Language

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_DigitalMars)
34 {
35     /***
36      * Assert failure function in the Digital Mars C library.
37      */
38     noreturn _assert(const(void)* exp, const(void)* file, uint line);
39 }
40 else version (CRuntime_Microsoft)
41 {
42     /***
43      * Assert failure function in the Microsoft C library.
44      * `_assert` is not in assert.h, but it is in the library.
45      */
46     noreturn _wassert(const(wchar)* exp, const(wchar)* file, uint line);
47     ///
48     noreturn _assert(const(char)* exp, const(char)* file, uint line);
49 }
50 else version (Darwin)
51 {
52     /***
53      * Assert failure function in the Darwin C library.
54      */
55     noreturn __assert_rtn(const(char)* func, const(char)* file, uint line, const(char)* exp);
56 }
57 else version (FreeBSD)
58 {
59     /***
60      * Assert failure function in the FreeBSD C library.
61      */
62     noreturn __assert(const(char)* func, const(char)* file, uint line, const(char)* exp);
63 }
64 else version (NetBSD)
65 {
66     /***
67      * Assert failure function in the NetBSD C library.
68      */
69     noreturn __assert(const(char)* file, int line, const(char)* exp);
70     ///
71     noreturn __assert13(const(char)* file, int line, const(char)* func, const(char)* exp);
72 }
73 else version (OpenBSD)
74 {
75     /***
76      * Assert failure function in the OpenBSD C library.
77      */
78     noreturn __assert(const(char)* file, int line, const(char)* exp);
79     ///
80     noreturn __assert2(const(char)* file, int line, const(char)* func, const(char)* exp);
81 }
82 else version (DragonFlyBSD)
83 {
84     /***
85      * Assert failure function in the DragonFlyBSD C library.
86      */
87     noreturn __assert(const(char)* func, const(char)* file, uint line, const(char)* exp);
88 }
89 else version (CRuntime_Glibc)
90 {
91     /***
92      * Assert failure functions in the GLIBC library.
93      */
94     noreturn __assert(const(char)* exp, const(char)* file, uint line);
95     ///
96     noreturn __assert_fail(const(char)* exp, const(char)* file, uint line, const(char)* func);
97     ///
98     noreturn __assert_perror_fail(int errnum, const(char)* file, uint line, const(char)* func);
99 }
100 else version (CRuntime_Bionic)
101 {
102     /***
103      * Assert failure functions in the Bionic library.
104      */
105     noreturn __assert(const(char)* __file, int __line, const(char)* __msg);
106     ///
107     noreturn __assert2(const(char)* __file, int __line, const(char)* __function, const(char)* __msg);
108 }
109 else version (CRuntime_Musl)
110 {
111      /***
112      * Assert failure function in the Musl C library.
113      */
114     noreturn __assert_fail(const(char)* exp, const(char)* file, uint line, const(char)* func);
115 }
116 else version (CRuntime_UClibc)
117 {
118     noreturn __assert(const(char)* exp, const(char)* file, uint line, const(char)* func);
119 }
120 else version (Solaris)
121 {
122     noreturn __assert_c99(const(char)* exp, const(char)* file, uint line, const(char)* func);
123 }
124 else
125 {
126     static assert(0);
127 }