[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251118055850.GB22733@lst.de>
Date: Tue, 18 Nov 2025 06:58:50 +0100
From: Christoph Hellwig <hch@....de>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Christoph Hellwig <hch@....de>, Carlos Maiolino <cem@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Chris Li <sparse@...isli.org>, linux-sparse@...r.kernel.org,
linux-xfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] lockref: add a __cond_lock annotation for
lockref_put_or_lock
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.
Powered by blists - more mailing lists