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 extern (C):
21 @trusted:
22 nothrow:
23 @nogc:
24 
version(CRuntime_DigitalMars)25 version (CRuntime_DigitalMars)
26 {
27     /***
28      * Assert failure function in the Digital Mars C library.
29      */
30     void _assert(const(void)* exp, const(void)* file, uint line);
31 }
version(CRuntime_Microsoft)32 else version (CRuntime_Microsoft)
33 {
34     /***
35      * Assert failure function in the Microsoft C library.
36      * `_assert` is not in assert.h, but it is in the library.
37      */
38     void _wassert(const(wchar)* exp, const(wchar)* file, uint line);
39     ///
40     void _assert(const(char)* exp, const(char)* file, uint line);
41 }
version(OSX)42 else version (OSX)
43 {
44     /***
45      * Assert failure function in the OSX C library.
46      */
47     void __assert_rtn(const(char)* func, const(char)* file, uint line, const(char)* exp);
48 }
version(FreeBSD)49 else version (FreeBSD)
50 {
51     /***
52      * Assert failure function in the FreeBSD C library.
53      */
54     void __assert(const(char)* exp, const(char)* file, uint line);
55 }
version(NetBSD)56 else version (NetBSD)
57 {
58     /***
59      * Assert failure function in the NetBSD C library.
60      */
61     void __assert(const(char)* file, int line, const(char)* exp);
62 }
version(DragonFlyBSD)63 else version (DragonFlyBSD)
64 {
65     /***
66      * Assert failure function in the DragonFlyBSD C library.
67      */
68     void __assert(const(char)* exp, const(char)* file, uint line);
69 }
version(CRuntime_Glibc)70 else version (CRuntime_Glibc)
71 {
72     /***
73      * Assert failure functions in the GLIBC library.
74      */
75     void __assert(const(char)* exp, const(char)* file, uint line);
76     ///
77     void __assert_fail(const(char)* exp, const(char)* file, uint line, const(char)* func);
78     ///
79     void __assert_perror_fail(int errnum, const(char)* file, uint line, const(char)* func);
80 }
version(CRuntime_Bionic)81 else version (CRuntime_Bionic)
82 {
83     void __assert(const(char)* __file, int __line, const(char)* __msg);
84 }
version(CRuntime_Musl)85 else version (CRuntime_Musl)
86 {
87      /***
88      * Assert failure function in the Musl C library.
89      */
90     void __assert_fail(const(char)* exp, const(char)* file, uint line, const(char)* func);
91 }
version(CRuntime_UClibc)92 else version (CRuntime_UClibc)
93 {
94     void __assert(const(char)* exp, const(char)* file, uint line, const(char)* func);
95 }
version(Solaris)96 else version (Solaris)
97 {
98     void __assert_c99(const(char)* exp, const(char)* file, uint line, const(char)* func);
99 }
100 else
101 {
102     static assert(0);
103 }
104