| 1 |
/* |
| 2 |
* assert.h |
| 3 |
* This file has no copyright assigned and is placed in the Public Domain. |
| 4 |
* This file is a part of the mingw-runtime package. |
| 5 |
* No warranty is given; refer to the file DISCLAIMER within the package. |
| 6 |
* |
| 7 |
* Define the assert macro for debug output. |
| 8 |
* |
| 9 |
*/ |
| 10 |
|
| 11 |
/* We should be able to include this file multiple times to allow the assert |
| 12 |
macro to be enabled/disabled for different parts of code. So don't add a |
| 13 |
header guard. */ |
| 14 |
|
| 15 |
#ifndef RC_INVOKED |
| 16 |
|
| 17 |
/* All the headers include this file. */ |
| 18 |
#include <_mingw.h> |
| 19 |
|
| 20 |
#undef assert |
| 21 |
|
| 22 |
#ifdef __cplusplus |
| 23 |
extern "C" { |
| 24 |
#endif |
| 25 |
|
| 26 |
#ifdef NDEBUG |
| 27 |
/* |
| 28 |
* If not debugging, assert does nothing. |
| 29 |
*/ |
| 30 |
#define assert(x) ((void)0) |
| 31 |
|
| 32 |
#else /* debugging enabled */ |
| 33 |
|
| 34 |
/* |
| 35 |
* CRTDLL nicely supplies a function which does the actual output and |
| 36 |
* call to abort. |
| 37 |
*/ |
| 38 |
_CRTIMP void __cdecl __MINGW_NOTHROW _assert (const char*, const char*, int) __MINGW_ATTRIB_NORETURN; |
| 39 |
|
| 40 |
/* |
| 41 |
* Definition of the assert macro. |
| 42 |
*/ |
| 43 |
#define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__)) |
| 44 |
|
| 45 |
#endif /* NDEBUG */ |
| 46 |
|
| 47 |
#ifdef __cplusplus |
| 48 |
} |
| 49 |
#endif |
| 50 |
|
| 51 |
#endif /* Not RC_INVOKED */ |