public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top, Jan Palus <jpalus@fastmail.com>
Subject: Re: [PATCH] util: Fix changes to assert_with_msg()
Date: Sun, 17 May 2026 14:49:17 +0200 (CEST)	[thread overview]
Message-ID: <20260517144916.0bf00ebc@elisabeth> (raw)
In-Reply-To: <20260517010740.138400-1-david@gibson.dropbear.id.au>

[Cc: Jan with full quote]

On Sun, 17 May 2026 11:07:40 +1000
David Gibson <david@gibson.dropbear.id.au> 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>

Oops, sorry, I think I misread the "#ifndef NDEBUG" and read it as
"#ifdef NDEBUG". :(

Applied, thanks for spotting this.

> ---
>  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

-- 
Stefano


      reply	other threads:[~2026-05-17 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-17  1:07 David Gibson
2026-05-17 12:49 ` Stefano Brivio [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260517144916.0bf00ebc@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=jpalus@fastmail.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).