You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
352 B
18 lines
352 B
6 years ago
|
// sadly, assert.h must be its own file so that NDEBUG works
|
||
|
#pragma once
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
#ifdef NDEBUG
|
||
|
#define assert(ignore) ((void) 0)
|
||
|
#else
|
||
|
#define assert(x) __assert(x, __FILE__, __LINE__)
|
||
|
#define __assert(x, y, z) \
|
||
|
do { \
|
||
|
if (!(x)) { \
|
||
|
fprintf(stderr, "assertion failed (" #x ") at %s:%d\n", y, z);\
|
||
|
abort();\
|
||
|
} \
|
||
|
} while (0)
|
||
|
#endif
|