mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-03-22 06:17:04 +00:00
Expensive check declaration
Intended to be run at every operation with complex data structures to check their consistency and validity.
This commit is contained in:
parent
a4ee61b66d
commit
2e6bc86beb
13
configure.ac
13
configure.ac
@ -18,6 +18,12 @@ AC_ARG_ENABLE([debug],
|
|||||||
[enable_debug=no]
|
[enable_debug=no]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([debug-expensive],
|
||||||
|
[AS_HELP_STRING([--enable-debug-expensive], [enable expensive consistency checks (implies --enable-debug) @<:@no@:>@])],
|
||||||
|
[],
|
||||||
|
[enable_debug_expensive=no]
|
||||||
|
)
|
||||||
|
|
||||||
AC_ARG_ENABLE([memcheck],
|
AC_ARG_ENABLE([memcheck],
|
||||||
[AS_HELP_STRING([--enable-memcheck], [check memory allocations when debugging @<:@yes@:>@])],
|
[AS_HELP_STRING([--enable-memcheck], [check memory allocations when debugging @<:@yes@:>@])],
|
||||||
[],
|
[],
|
||||||
@ -68,6 +74,9 @@ AC_ARG_VAR([FLEX], [location of the Flex program])
|
|||||||
AC_ARG_VAR([BISON], [location of the Bison program])
|
AC_ARG_VAR([BISON], [location of the Bison program])
|
||||||
AC_ARG_VAR([M4], [location of the M4 program])
|
AC_ARG_VAR([M4], [location of the M4 program])
|
||||||
|
|
||||||
|
if test "$enable_debug_expensive" = yes; then
|
||||||
|
enable_debug=yes
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$srcdir" = . ; then
|
if test "$srcdir" = . ; then
|
||||||
# Building in current directory => create obj directory holding all objects
|
# Building in current directory => create obj directory holding all objects
|
||||||
@ -336,6 +345,10 @@ if test "$enable_debug" = yes ; then
|
|||||||
AC_CHECK_LIB([efence], [malloc])
|
AC_CHECK_LIB([efence], [malloc])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "enable_debug_expensive" = yes ; then
|
||||||
|
AC_DEFINE([ENABLE_EXPENSIVE_CHECKS], [1], [Define to 1 if you want to run expensive consistency checks.])
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLIENT=birdcl
|
CLIENT=birdcl
|
||||||
|
@ -161,15 +161,22 @@ 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 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
|
#ifdef DEBUGGING
|
||||||
#define ASSERT(x) ASSERT_DIE(x)
|
#define ASSERT(x) ASSERT_DIE(x)
|
||||||
#define ASSUME(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
|
#else
|
||||||
#define ASSERT(x) do { if (!(x)) log(L_BUG "Assertion '%s' failed at %s:%d", #x, __FILE__, __LINE__); } while(0)
|
#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 */
|
#define ASSUME(x) /* intentionally left blank */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Pseudorandom numbers */
|
/* Pseudorandom numbers */
|
||||||
|
|
||||||
u32 random_u32(void);
|
u32 random_u32(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user