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 18module core.stdc.assert_; 19 20version (OSX) 21 version = Darwin; 22else version (iOS) 23 version = Darwin; 24else version (TVOS) 25 version = Darwin; 26else version (WatchOS) 27 version = Darwin; 28 29extern (C): 30@trusted: 31nothrow: 32@nogc: 33 34version (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} 41else 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} 51else 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} 58else version (FreeBSD) 59{ 60 /*** 61 * Assert failure function in the FreeBSD C library. 62 */ 63 void __assert(const(char)* exp, const(char)* file, uint line); 64} 65else 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} 72else 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} 81else version (DragonFlyBSD) 82{ 83 /*** 84 * Assert failure function in the DragonFlyBSD C library. 85 */ 86 void __assert(const(char)* exp, const(char)* file, uint line); 87} 88else 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} 99else version (CRuntime_Bionic) 100{ 101 void __assert(const(char)* __file, int __line, const(char)* __msg); 102} 103else 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} 110else version (CRuntime_UClibc) 111{ 112 void __assert(const(char)* exp, const(char)* file, uint line, const(char)* func); 113} 114else version (Solaris) 115{ 116 void __assert_c99(const(char)* exp, const(char)* file, uint line, const(char)* func); 117} 118else 119{ 120 static assert(0); 121} 122