Re: [PATCH 1/3] lockref: add a __cond_lock annotation for lockref_put_or_lock
Christoph Hellwig <[email protected]>
| Newsgroups | org.kernel.vger.linux-sparse,org.kernel.vger.linux-kernel,org.kernel.vger.linux-xfs |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Nov 14, 2025 at 10:18:24AM -0800, Linus Torvalds wrote: > Macro expansion isn't recursive, and having > > #define a(x) something-something a(x) > > is actually perfectly fine, and something we do intentionally for > other reasons (typically because it also allows us to then use "#ifdef > a" to check whether there is some architecture-specific implementation > of 'a()') > > And yes, you do need that "#undef" to then not get crazy parse errors > in the actual definition and export of the function, but it would > allow us to avoid yet another "underscore version of the function". > > I dunno. Not a big deal, but it seems annoying to make up a new name > for this. I know you can redefine names using macros, and now that you remind me I remember that you like that. I personally hate it as it means there are two things with the same name, which makes understanding the code much harder and confuses tools like cscope. But I can switch to that approach if you prefer.