[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZF4crs8iKBGH3lJe@smile.fi.intel.com>
Date: Fri, 12 May 2023 14:02:06 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
David Howells <dhowells@...hat.com>,
Ricardo Martinez <ricardo.martinez@...ux.intel.com>
Subject: Re: [RFC PATCH 05/13] list.h: Fix parentheses around macro pointer
parameter use
On Mon, May 08, 2023 at 09:46:40AM -0400, Mathieu Desnoyers wrote:
> On 2023-05-08 08:16, Andy Shevchenko wrote:
...
> The only use I found that would break is as follows:
>
> LIST_HEAD(testlist);
>
> int f2(void)
> {
> return 1;
> }
>
> #define eval(...) __VA_ARGS__
>
> void f(void)
> {
> struct list_head *pos;
>
> list_for_each(pos, eval(f2(), &testlist)) {
> //...
> }
> }
>
> Because "eval()" will evaluate "f(), &testlist" with comma and all, without
> enclosing parentheses.
>
> So the question is: do we want to support this kind-of-odd macro evaluation,
> considering that it requires adding parentheses around pretty much all macro
> parameters when used as expressions between commas?
Similar question can be asked for your initial motivation to support indirect
pointers. I found the double pointer as weird as this macro case. But it can be
only me. Hence I left this to the more experienced developers to express their
opinions.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists