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