build: make NM_MORE_ASSERTS define numeric for different levels of more-asserts
Allows to enable more-asserts more granularly. Unfortunately, the old check was "${enable_more_asserts} == "yes", thus we cannot extend "--enable-more-assert=level" because that would mean that the same build script cannot set the option on both old and new NetworkManager. Thus, add a new option --with-more-asserts=level. If you put the following in your build script, it will work as expected whether you build a new or an old version of NetworkManager. ./configure --enable-more-asserts --with-more-asserts=5
This commit is contained in:
18
configure.ac
18
configure.ac
@@ -891,10 +891,23 @@ AM_CONDITIONAL(BUILD_NMTUI, test "$build_nmtui" = yes)
|
|||||||
NM_COMPILER_WARNINGS
|
NM_COMPILER_WARNINGS
|
||||||
|
|
||||||
AC_ARG_ENABLE(more-asserts,
|
AC_ARG_ENABLE(more-asserts,
|
||||||
AS_HELP_STRING([--enable-more-asserts], [Enable more assertions for debugging (default: no)]))
|
AS_HELP_STRING([--enable-more-asserts], [Enable more assertions for debugging (default: no). Deprecated option. Use --with-more-asserts=level]))
|
||||||
|
more_asserts=0
|
||||||
if test "${enable_more_asserts}" = "yes"; then
|
if test "${enable_more_asserts}" = "yes"; then
|
||||||
AC_DEFINE(NM_MORE_ASSERTS, [1], [Define if more asserts are enabled])
|
more_asserts=100
|
||||||
fi
|
fi
|
||||||
|
AC_ARG_WITH(more-asserts,
|
||||||
|
AS_HELP_STRING([--with-more-asserts=level], [Enable more assertions for debugging (default: 0)]),
|
||||||
|
[more_asserts=${with_more_asserts}],
|
||||||
|
[])
|
||||||
|
if test "${more_asserts}" = "no"; then
|
||||||
|
more_asserts=0
|
||||||
|
else
|
||||||
|
if test "${more_asserts}" = "yes"; then
|
||||||
|
more_asserts=100
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
AC_DEFINE_UNQUOTED(NM_MORE_ASSERTS, $more_asserts, [Define if more asserts are enabled])
|
||||||
|
|
||||||
AC_ARG_ENABLE(more-logging,
|
AC_ARG_ENABLE(more-logging,
|
||||||
AS_HELP_STRING([--enable-more-logging], [Enable more debug logging (default: no)]))
|
AS_HELP_STRING([--enable-more-logging], [Enable more debug logging (default: no)]))
|
||||||
@@ -1169,6 +1182,7 @@ echo
|
|||||||
echo "Miscellaneous:"
|
echo "Miscellaneous:"
|
||||||
echo " documentation: $enable_gtk_doc"
|
echo " documentation: $enable_gtk_doc"
|
||||||
echo " tests: $enable_tests"
|
echo " tests: $enable_tests"
|
||||||
|
echo " more-asserts: $more_asserts"
|
||||||
echo " valgrind: $with_valgrind $with_valgrind_suppressions"
|
echo " valgrind: $with_valgrind $with_valgrind_suppressions"
|
||||||
echo " code coverage: $enable_code_coverage"
|
echo " code coverage: $enable_code_coverage"
|
||||||
echo " LTO: $enable_lto"
|
echo " LTO: $enable_lto"
|
||||||
|
@@ -179,7 +179,7 @@
|
|||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
#ifdef NM_MORE_ASSERTS
|
#if NM_MORE_ASSERTS
|
||||||
#define nm_assert(cond) G_STMT_START { g_assert (cond); } G_STMT_END
|
#define nm_assert(cond) G_STMT_START { g_assert (cond); } G_STMT_END
|
||||||
#else
|
#else
|
||||||
#define nm_assert(cond) G_STMT_START { if (FALSE) { if (cond) { } } } G_STMT_END
|
#define nm_assert(cond) G_STMT_START { if (FALSE) { if (cond) { } } } G_STMT_END
|
||||||
|
@@ -106,7 +106,7 @@ nm_bus_manager_setup (NMBusManager *instance)
|
|||||||
static void
|
static void
|
||||||
nm_assert_exported (NMBusManager *self, const char *path, NMExportedObject *object)
|
nm_assert_exported (NMBusManager *self, const char *path, NMExportedObject *object)
|
||||||
{
|
{
|
||||||
#ifdef NM_MORE_ASSERTS
|
#if NM_MORE_ASSERTS
|
||||||
NMBusManagerPrivate *priv;
|
NMBusManagerPrivate *priv;
|
||||||
const char *p2, *po;
|
const char *p2, *po;
|
||||||
NMExportedObject *o2;
|
NMExportedObject *o2;
|
||||||
|
@@ -147,7 +147,7 @@ static gboolean _ip4_device_routes_cancel (NMRouteManager *self);
|
|||||||
|
|
||||||
/*********************************************************************************************/
|
/*********************************************************************************************/
|
||||||
|
|
||||||
#if defined (NM_MORE_ASSERTS) && !defined (G_DISABLE_ASSERT)
|
#if NM_MORE_ASSERTS && !defined (G_DISABLE_ASSERT)
|
||||||
inline static void
|
inline static void
|
||||||
ASSERT_route_index_valid (const VTableIP *vtable, const GArray *entries, const RouteIndex *index, gboolean unique_ifindexes)
|
ASSERT_route_index_valid (const VTableIP *vtable, const GArray *entries, const RouteIndex *index, gboolean unique_ifindexes)
|
||||||
{
|
{
|
||||||
|
@@ -1727,7 +1727,7 @@ nmp_cache_free (NMPCache *cache)
|
|||||||
void
|
void
|
||||||
ASSERT_nmp_cache_is_consistent (const NMPCache *cache)
|
ASSERT_nmp_cache_is_consistent (const NMPCache *cache)
|
||||||
{
|
{
|
||||||
#ifdef NM_MORE_ASSERTS
|
#if NM_MORE_ASSERTS
|
||||||
NMMultiIndexIter iter_multi;
|
NMMultiIndexIter iter_multi;
|
||||||
GHashTableIter iter_hash;
|
GHashTableIter iter_hash;
|
||||||
guint i, len;
|
guint i, len;
|
||||||
|
Reference in New Issue
Block a user