From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] log.h: Avoid unnecessary GNU extension for token pasting
Date: Thu, 13 Oct 2022 12:13:50 +1100 [thread overview]
Message-ID: <Y0dmTldy4JVq5/Mi@yekko> (raw)
In-Reply-To: <20221012154536.1650577-1-sbrivio@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1248 bytes --]
On Wed, Oct 12, 2022 at 05:45:36PM +0200, Stefano Brivio wrote:
> clang says:
>
> ./log.h:23:18: warning: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Wgnu-zero-variadic-macro-arguments]
>
> ...but we don't actually need token pasting there.
Actually, we kinda do. Without token pasting this would be incorrect
if there were any calls to trace() with just a string and no further
parameters.
We could, however, avoid the need by making it simply trace(...),
rather than trace(format, ...).
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> ---
> log.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/log.h b/log.h
> index f92394c..5abbfc5 100644
> --- a/log.h
> +++ b/log.h
> @@ -20,7 +20,7 @@ void trace_init(int enable);
> #define trace(format, ...) \
> do { \
> if (log_trace) \
> - debug(format, ##__VA_ARGS__); \
> + debug(format, __VA_ARGS__); \
> } while (0)
>
> void __openlog(const char *ident, int option, int facility);
--
David Gibson | 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 --]
prev parent reply other threads:[~2022-10-13 4:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 15:45 [PATCH] log.h: Avoid unnecessary GNU extension for token pasting Stefano Brivio
2022-10-13 1:13 ` David Gibson [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=Y0dmTldy4JVq5/Mi@yekko \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/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).