diff options
| author | David Gibson <david@gibson.dropbear.id.au> | 2026-05-15 11:12:23 +1000 |
|---|---|---|
| committer | David Gibson <david@gibson.dropbear.id.au> | 2026-05-15 14:11:23 +1000 |
| commit | 93b6f3ef4c3349df7bb4443a389a07662fe02478 (patch) | |
| tree | 1581a6443608bbcb43b3a1e6ebee58440d2d53c9 | |
| parent | 6cab5e3713acf94c8304feb332714cb93942c29c (diff) | |
| download | passt-93b6f3ef4c3349df7bb4443a389a07662fe02478.tar passt-93b6f3ef4c3349df7bb4443a389a07662fe02478.tar.gz passt-93b6f3ef4c3349df7bb4443a389a07662fe02478.tar.bz2 passt-93b6f3ef4c3349df7bb4443a389a07662fe02478.tar.lz passt-93b6f3ef4c3349df7bb4443a389a07662fe02478.tar.xz passt-93b6f3ef4c3349df7bb4443a389a07662fe02478.tar.zst passt-93b6f3ef4c3349df7bb4443a389a07662fe02478.zip | |
Fix build with -DNDEBUG
Since bc872d91765d, our assert() statements are omitted if we compile with
-DNDEBUG, like the standard library assert(3). Unfortunately a trivial but
embarrassing mistake in that patch means that instead of never aborting in
this case, assert_with_msg() *always* aborts, breaking pretty much
everything.
There's also a missing #include that breaks the build with -DNDEBUG on at
least some library versions.
Reported-by: Jan Palus <jpalus@fastmail.com>
Fixes: bc872d91765d ("treewide: Spell ASSERT() as assert()")
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
| -rw-r--r-- | util.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -6,6 +6,7 @@ #ifndef UTIL_H #define UTIL_H +#include <assert.h> #include <stdlib.h> #include <stdarg.h> #include <stdbool.h> @@ -60,7 +61,7 @@ void abort_with_msg(const char *fmt, ...) __func__, __FILE__, __LINE__, STRINGIFY(expr)) #else #define assert_with_msg(expr, ...) \ - ((void)(expr), 0 ? (void)0 : abort_with_msg(__VA_ARGS__)) + ((void)(expr), 1 ? (void)0 : abort_with_msg(__VA_ARGS__)) #endif #ifdef P_tmpdir |
