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=XCyHKgrB; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 0B67E5A061B for ; Sun, 17 May 2026 03:08:24 +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=XCyHKgrBsTZRzh7HXKrKF5vphAOdxU5jAbAkr+syNm4wwia5/4q3YsErByLgL+uvB 8sd3uu3FDzuHJJ57HE8h1YLfvzscTQIcrwAFMkSc9PAr/Twva+dkMSksA5AR6LMkEW w3Aa3AEylq5W55QzIH6t37ZS00z7ig1QA4iBglmqMjoQfEZs1ahbXYDidYdJUFwKX1 Km9Rgbv3gGsxaTwb8iqDxJgrdHd/sKPWAROXfaLDoo+NXMEuuZEVxdcFKZVzZoCXSN FYyAXtL25NG42Iv0wgr0ubg9qadVVRMwtyQWnCA51NXHrfvNp15oURuzPtekcWCScf yguNO11XgryhQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4gJ2ql60MCz4wGG; Sun, 17 May 2026 11:08:19 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2] util: Fix changes to assert_with_msg() Date: Sun, 17 May 2026 11:07:47 +1000 Message-ID: <20260517010747.138489-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: 3QWATGDKMIP5I57LF5J2WR5UWYZUFOUM X-Message-ID-Hash: 3QWATGDKMIP5I57LF5J2WR5UWYZUFOUM 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