diff --git a/configure.ac b/configure.ac index ee58d44cf..ce3ea7b6a 100644 --- a/configure.ac +++ b/configure.ac @@ -850,6 +850,12 @@ AM_CONDITIONAL(BUILD_NMTUI, test "$build_nmtui" = yes) NM_COMPILER_WARNINGS +AC_ARG_ENABLE(more-asserts, + AS_HELP_STRING([--enable-more-asserts], [Enable more assertions for debugging (default: no)])) +if test "${enable_more_asserts}" = "yes"; then + AC_DEFINE(NM_MORE_ASSERTS, [1], [Define if more asserts are enabled]) +fi + AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto], [Enable Link Time Optimization for smaller size (default: no)])) if (test "${enable_lto}" = "yes"); then CFLAGS="-flto $CFLAGS" diff --git a/include/nm-utils-internal.h b/include/nm-utils-internal.h index 7ca44f3c4..49991cfa0 100644 --- a/include/nm-utils-internal.h +++ b/include/nm-utils-internal.h @@ -102,6 +102,14 @@ /*****************************************************************************/ +#ifdef NM_MORE_ASSERTS +#define nm_assert(cond) G_STMT_START { g_assert (cond); } G_STMT_END +#else +#define nm_assert(cond) G_STMT_START { (void) 0; } G_STMT_END +#endif + +/*****************************************************************************/ + #define NM_DEFINE_SINGLETON_INSTANCE(TYPE) \ static TYPE *singleton_instance