aboutgitcodebugslistschat
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2026-05-17 11:07:40 +1000
committerStefano Brivio <sbrivio@redhat.com>2026-05-17 13:29:04 +0200
commitbcc3d37a6e010b9340d085482f98caab21833776 (patch)
tree5555bf7f5312dd56878608456276fde5d0a30299
parent296d7e32ec93f7534fcbf94b922a19eaea6e217c (diff)
downloadpasst-bcc3d37a6e010b9340d085482f98caab21833776.tar
passt-bcc3d37a6e010b9340d085482f98caab21833776.tar.gz
passt-bcc3d37a6e010b9340d085482f98caab21833776.tar.bz2
passt-bcc3d37a6e010b9340d085482f98caab21833776.tar.lz
passt-bcc3d37a6e010b9340d085482f98caab21833776.tar.xz
passt-bcc3d37a6e010b9340d085482f98caab21833776.tar.zst
passt-bcc3d37a6e010b9340d085482f98caab21833776.zip
util: Fix changes to assert_with_msg()
A last minute fixup to commit e51494552b78 was misapplied. Instead of improving the implementation of assert_with_msg() for the case where NDEBUG is defined, it effectively eliminated assert_with_msg() in the normal case where NDEBUG is _not_ defined. As well as removing assert()s which protect us in case of certian types of bug, this introduces some cppcheck and clang-tidy regressions. Fixes: e51494552b78 ("Fix build with -DNDEBUG") Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r--util.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/util.h b/util.h
index a9dcc04..144dc1e 100644
--- a/util.h
+++ b/util.h
@@ -51,7 +51,7 @@ void abort_with_msg(const char *fmt, ...)
*/
#ifndef NDEBUG
#define assert_with_msg(expr, ...) \
- (1 ? (void)0 : ((void)(expr), abort_with_msg(__VA_ARGS__)))
+ ((expr) ? (void)0 : abort_with_msg(__VA_ARGS__))
/* The standard library assert() hits our seccomp filter and dies before it can
* actually print a message. So, replace it with our own version.
*/
@@ -61,7 +61,7 @@ void abort_with_msg(const char *fmt, ...)
__func__, __FILE__, __LINE__, STRINGIFY(expr))
#else
#define assert_with_msg(expr, ...) \
- ((void)(expr), 1 ? (void)0 : abort_with_msg(__VA_ARGS__))
+ (1 ? (void)0 : ((void)(expr), abort_with_msg(__VA_ARGS__)))
#endif
#ifdef P_tmpdir