Re: [PATCH] sparse: add support for __VA_OPT__

Ben Dooks <[email protected]> Tue, 24 Feb 2026 11:16:48 +0000
Newsgroups org.kernel.vger.linux-sparse
Organization Codethink Limited.
Message-ID <[email protected]>
On 24/02/2026 11:07, Dan Carpenter wrote:
> The linux kernel has started using __VA_OPT__ so lets add support for it.
> 
> What it does is it adds an optional thing, normally a comma, if the
> __VA_ARGS__ parameter is not empty.  So if you have at least one argument
> but possibly more then you could create a macro like:
> 
> #define test_args(a, ...) printf(a __VA_OPT__(,) __VA_ARGS__)
> 
> If you call test_args("foo\n") it expands to:
> 
> printf("foo\n");
> 
> but if you pass two arguments test_args("foo %d\n", 2) it expands to:
> 
> printf("foo\n" , 2);
> 
> I guess if you wanted instead of a comma then you could have an empty
> __VA_OPT__() or you could pass random things like __VA_OPT__(a b c).  I
> don't know why you would do that.  In this case, "a" is a macro argument
> so that has to be expanded out.
> 
> Signed-off-by: Dan Carpenter <[email protected]>
> 
This wouldn't apply to the current tree using git-am.
Current head for me is 37156835e3d725b6d750f000be33ba3814bb2310

$ git am  < \[PATCH\]\ sparse\:\ add\ support\ for\ __VA_OPT__\ -\ Dan\ 
Carpenter\ \<[email protected]\>\ -\ 2026-02-24\ 1107.eml
Applying: sparse: add support for __VA_OPT__
error: patch failed: ident-list.h:66
error: ident-list.h: patch does not apply
error: patch failed: pre-process.c:643
error: pre-process.c: patch does not apply
Patch failed at 0001 sparse: add support for __VA_OPT__


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html