4 #define empty_body do {} while(0)
5 #if defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)
7 #elif defined(__x86) || defined(__x86__) || defined(__i386) || defined(__i386__) || defined(_M_IX86)
11 //#define NO_BREAKPOINTS
13 # define breakpoint() empty_body
17 # define breakpoint() __asm__("int3")
18 # elif defined(__POCC__)
19 # define breakpoint() __asm { int3 }
21 # define breakpoint() empty_body
23 # elif defined __unix__
26 # define breakpoint() kill(getpid(), SIGTRAP)
28 # define breakpoint() empty_body
32 #if !defined(__GNUC__) && (defined(__POCC__) || __STDC_VERSION__+0 >= 199901L)
33 #define __FUNCTION__ __func__
38 # define assert_dbg(exp) empty_body
39 # define assert_lt(exp) empty_body
40 # define assert_lte(exp) empty_body
41 # define assert(x) empty_body
44 # define assert_dbg(exp) do { if (!(exp)) breakpoint(); } while(0)
45 # define assert_op(val, op, max) do { if(!((val) op (max))) { \
46 fprintf(stderr, "[%s:%d] %s: assert failed: %s < %s\n", \
47 __FILE__, __LINE__, __FUNCTION__, # val, # max); \
48 breakpoint();}} while(0)
50 # define assert_lt (val, max) assert_op(val, <, max)
51 # define assert_lte(val, max) assert_op(val, <= ,max)