summary refs log tree commit diff
path: root/src/libnm-std-aux
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2023-02-23 17:11:22 +0100
committerMichael Biebl <biebl@debian.org>2023-02-23 17:11:22 +0100
commitb22a7b55d0bc5a7999dccaeacdde745f5ace9d66 (patch)
tree597d2716cfa4b904c98717b874371e0e7b5e0c71 /src/libnm-std-aux
parent1372848511cb896b80b51ed1a3e9606bd9816631 (diff)
New upstream version 1.42.2 upstream/1.42.2
Diffstat (limited to 'src/libnm-std-aux')
-rw-r--r--src/libnm-std-aux/nm-std-aux.h32
1 files changed, 6 insertions, 26 deletions
diff --git a/src/libnm-std-aux/nm-std-aux.h b/src/libnm-std-aux/nm-std-aux.h
index e556aa4b..a5e5abd3 100644
--- a/src/libnm-std-aux/nm-std-aux.h
+++ b/src/libnm-std-aux/nm-std-aux.h
@@ -219,36 +219,16 @@ typedef uint64_t _nm_bitwise nm_be64_t;
 #define NM_MORE_ASSERTS 0
 #endif
 
-#if NM_MORE_ASSERTS == 0
-/* The string with the assertion check and the function name blows up the
- * binary size. In production mode, let's drop those, similar to
- * g_assertion_message_expr.
- *
- * Note that <assert.h> can be included multiple times. We can thus
- * not redefine __assert_fail(...). Instead, just redefine the name
- * __assert_fail. */
-_nm_noreturn static inline void
-_nm_assert_fail_internal(const char  *assertion,
-                         const char  *file,
-                         unsigned int line,
-                         const char  *function)
-{
-    __assert_fail("<dropped>", file, line, "<unknown-fcn>");
-}
-#define __assert_fail _nm_assert_fail_internal
-#endif
-
 #ifndef NDEBUG
 #define _NM_ASSERT_FAIL_ENABLED 1
-#define _nm_assert_fail(msg)    __assert_fail((msg), __FILE__, __LINE__, __func__)
+#define _nm_assert_fail(msg)                                     \
+    __assert_fail(((NM_MORE_ASSERTS) ? "" msg "" : "<dropped>"), \
+                  __FILE__,                                      \
+                  __LINE__,                                      \
+                  ((NM_MORE_ASSERTS) ? __func__ : "<unknown-fcn>"))
 #else
 #define _NM_ASSERT_FAIL_ENABLED 0
-#define _nm_assert_fail(msg)                 \
-    do {                                     \
-        _nm_unused const char *_msg = (msg); \
-                                             \
-        _nm_unreachable_code();              \
-    } while (0)
+#define _nm_assert_fail(msg)    ((void) ("" msg ""), _nm_unreachable_code())
 #endif
 
 #define NM_MORE_ASSERTS_EFFECTIVE (_NM_ASSERT_FAIL_ENABLED ? NM_MORE_ASSERTS : 0)