std-aux: fix build error due to __assert_fail() missing with NDEBUG

<assert.h> only defines __assert_fail() if NDEBUG is not on.
Fix that.

Fixes: 8e3299498d ('std-aux,glib-aux: rework nm_assert() implementations')
This commit is contained in:
Thomas Haller
2022-10-29 21:42:06 +02:00
parent a13fa05754
commit 0ffe391f82

View File

@@ -213,11 +213,15 @@ _nm_assert_fail_internal(const char *assertion,
#define __assert_fail _nm_assert_fail_internal
#endif
#define _nm_assert_fail(msg) __assert_fail((msg), __FILE__, __LINE__, __func__)
#ifndef NDEBUG
#define _NM_ASSERT_FAIL_ENABLED 1
#define _nm_assert_fail(msg) __assert_fail((msg), __FILE__, __LINE__, __func__)
#else
#define _NM_ASSERT_FAIL_ENABLED 1
#define _nm_assert_fail(msg) \
do { \
_nm_unused const char *_msg = (msg); \
} while (0)
#endif
#define NM_MORE_ASSERTS_EFFECTIVE (_NM_ASSERT_FAIL_ENABLED ? NM_MORE_ASSERTS : 0)