Re: Sparse not supporting kzalloc_obj() and friends
Linus Torvalds <[email protected]> Mon, 23 Feb 2026 08:19:55 -0800
| Newsgroups | org.kernel.vger.linux-sparse |
|---|---|
| Message-ID | <CAHk-=wgxgo8SugrnA4s=Pz0TPj32Ea0pdO=uU_N+-V6Y826spg@mail.gmail.com> |
On Mon, 23 Feb 2026 at 02:52, Ricardo Ribalda <[email protected]> wrote: > > The culprit seems to be the new kzalloc_obj and friends. Argh. The culprit is the use of __VA_OPT__, which apparently sparse never got taught. We already use __VA_OPT__ elsewhere in the kernel, but it's fairly rare, so it apparently hasn't been noticed much. For example, btrfs uses it, but apparently only under CONFIG_BTRFS_ASSERT The btrfs use has a comment about _why_ the use of __VA_OPT__ is actually needed: * As ##__VA_ARGS__ cannot be at the beginning of the macro the __VA_OPT__ is needed * and supported since GCC 8 and Clang 12. and that's why I used it in the new alloc_obj helpers too - not only is it the more modern "standard C" model, it's actually a bit more user friendly than the traditional ## gcc trick. Ho humm. I guess I should look at the sparse pre-processor code, unless somebody already implemented __VA_OPT__ somewhere? Linus