source:
examples/gc_no_raii/src/tools/checks.h
@
d2b5d2d
Last change on this file since d2b5d2d was bf71cfd, checked in by , 6 years ago | |
---|---|
|
|
File size: 473 bytes |
Rev | Line | |
---|---|---|
[15db1ab] | 1 | #pragma once |
2 | ||
[46f1d20] | 3 | #ifdef NDEBUG |
4 | ||
5 | #define check(x) | |
6 | ||
7 | #define checkf(x, format, ...) | |
8 | ||
9 | #warning no debug checks | |
10 | ||
11 | #else | |
[15db1ab] | 12 | |
13 | #include <stdlib.h> | |
14 | #include <stdio.h> | |
15 | ||
16 | #define check(x) do {\ | |
17 | if(!(x)) {\ | |
18 | printf("CHECK failed : %s at %s:%i\n", #x, __FILE__, __LINE__);\ | |
19 | abort();\ | |
[46f1d20] | 20 | }}while( (int)0 )\ |
[15db1ab] | 21 | |
22 | #define checkf(x, ...) do {\ | |
23 | if(!(x)) {\ | |
24 | printf("CHECK failed : %s at %s:%i\n", #x, __FILE__, __LINE__);\ | |
25 | printf(__VA_ARGS__);\ | |
26 | abort();\ | |
[46f1d20] | 27 | }}while( (int)0 )\ |
[15db1ab] | 28 | |
29 | #endif //NO_CHECKS |
Note: See TracBrowser
for help on using the repository browser.