> Date: 2026-11-03 14:27:11+0100 > From: Alejandro Colomar > > It needs __VA_OPT__, which is a C23 feature, but it's provided by GCC > and Clang in GNU-C mode as an extension even without C23. __VA_OPT__ > was implemented in GCC 9 and Clang 6, I think, so it should be widely Actually, it seems it was implemented in Clang 12, not Clang 6. I got that 6 from llvmorg-6.0.0-rc1, but that version number seems to not be the same as the Clang version number. Anyway, Clang 12 should be fine, I think. Cheers, Alex > available. > > Here's a small example program showing how this works: > > alx@devuan:~/tmp$ cat d.c > #define D__(x, ...) (x) > #define D_(x, ...) D__(__VA_ARGS__ __VA_OPT__(,) x) > #define D(a, b) D_(a, b) > D(1, 2) > D(1, ) > D(, 2) > D(,) > alx@devuan:~/tmp$ gcc -E -Wall -Wextra d.c | grep '^[^#]' > (2) > (1) > (2) > () > > Signed-off-by: Alejandro Colomar > --- > include/linux/args.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/include/linux/args.h b/include/linux/args.h > index 0562dc51435e..5886011cf791 100644 > --- a/include/linux/args.h > +++ b/include/linux/args.h > @@ -3,6 +3,11 @@ > #ifndef _LINUX_ARGS_H > #define _LINUX_ARGS_H > > +/* Expand to 'arg' if non-empty, or to 'def' if 'arg' is empty. */ > +#define ___DEFARG(x, ...) (x) > +#define __DEFARG(def, ...) ___DEFARG(__VA_ARGS__ __VA_OPT__(,) def) > +#define DEFARG(def, arg) __DEFARG(def, arg) > + > /* > * How do these macros work? > * > -- > 2.55.0 > --