diff options
author | Maria Matejka <mq@ucw.cz> | 2019-08-14 16:22:39 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2020-05-01 15:19:12 +0200 |
commit | a0d0a71a1828cce725c3132f8c243bf0c537786f (patch) | |
tree | 8a879a5265bf3b3bd435c45d049daad297796387 /lib | |
parent | a1b61a271af40a9d6ef0837424ab2c98d29f1575 (diff) |
Expensive check declaration
Intended to be run at every operation with complex data structures
to check their consistency and validity.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/birdlib.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/birdlib.h b/lib/birdlib.h index caa26b94..23036c1b 100644 --- a/lib/birdlib.h +++ b/lib/birdlib.h @@ -165,14 +165,21 @@ void debug(const char *msg, ...); /* Printf to debug output */ #define ASSERT_DIE(x) do { if (!(x)) bug("Assertion '%s' failed at %s:%d", #x, __FILE__, __LINE__); } while(0) +#define EXPENSIVE_CHECK(x) /* intentionally left blank */ + #ifdef DEBUGGING #define ASSERT(x) ASSERT_DIE(x) #define ASSUME(x) ASSERT_DIE(x) +#ifdef ENABLE_EXPENSIVE_CHECKS +#undef EXPENSIVE_CHECK +#define EXPENSIVE_CHECK(x) ASSERT_DIE(x) +#endif #else #define ASSERT(x) do { if (!(x)) log(L_BUG "Assertion '%s' failed at %s:%d", #x, __FILE__, __LINE__); } while(0) #define ASSUME(x) /* intentionally left blank */ #endif + #ifdef DEBUGGING asm( ".pushsection \".debug_gdb_scripts\", \"MS\",@progbits,1\n" |