From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=VAzJx5Yp; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 6E0EA5A0275 for ; Sun, 17 May 2026 03:08:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1778980099; bh=5bZCLDP1hgAH+1nJt7t65zmm9QJCegNXRnF6yOW3trA=; h=From:To:Cc:Subject:Date:From; b=VAzJx5Yp3o4pFP54yN7ieHfAzeFy8KAbbzOj4EhyPwGnZ+4zmnPOi8TvGNcZ9W7wx gN5sKJ3a3FolYQvzy6kcTyoJcnr19wYKkxiGlGpeUE8ALSLAT7t7PeK5GuPBc02LNH NogIFNGInrtDyOAXxoa0pCp0PgZ1DO5uDN3mWy2vmdHawSRIUmCYdTv/o6lTxwcJcK QuWyb6t/TCfKEfWKpmAeMDo1q7VjKogiV4ZJi9W9MOjM0sXNFplJRxFUfb6YGFVJIr gjVOFUcujIgQcCUyAUTaruEUIK/5ptjtNL/d6YVBe88vLUYPHO+djHCASR91PEvgPT gYoKbiglgK/fA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4gJ2ql5rkSz4w1l; Sun, 17 May 2026 11:08:19 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH] util: Fix changes to assert_with_msg() Date: Sun, 17 May 2026 11:07:40 +1000 Message-ID: <20260517010740.138400-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: YMKWCD4C6LMUW6KKRFZYZVCPKXEXKKHJ X-Message-ID-Hash: YMKWCD4C6LMUW6KKRFZYZVCPKXEXKKHJ X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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