[PATCH] log.h: Avoid unnecessary GNU extension for token pasting
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.
Signed-off-by: Stefano Brivio
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
--- 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
participants (2)
-
David Gibson
-
Stefano Brivio