* [PATCH v2] util: Fix changes to assert_with_msg()
@ 2026-05-17 1:07 David Gibson
2026-05-17 1:09 ` Ignore " David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: David Gibson @ 2026-05-17 1:07 UTC (permalink / raw)
To: Stefano Brivio, passt-dev; +Cc: David Gibson
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>
---
util.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util.h b/util.h
index a9dcc04c..144dc1e6 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
--
2.54.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Ignore Re: [PATCH v2] util: Fix changes to assert_with_msg()
2026-05-17 1:07 [PATCH v2] util: Fix changes to assert_with_msg() David Gibson
@ 2026-05-17 1:09 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2026-05-17 1:09 UTC (permalink / raw)
To: Stefano Brivio, passt-dev
[-- Attachment #1: Type: text/plain, Size: 840 bytes --]
On Sun, May 17, 2026 at 11:07:47AM +1000, David Gibson wrote:
> 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>
Sorry, sent this (identical) "v2" with a mistype.
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-17 1:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-17 1:07 [PATCH v2] util: Fix changes to assert_with_msg() David Gibson
2026-05-17 1:09 ` Ignore " David Gibson
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).