On 01.03.2024 15:37, Juergen Gross wrote:
> On 29.02.24 16:32, Jan Beulich wrote:
>> On 12.12.2023 10:47, Juergen Gross wrote:
>>> +#define nrspin_lock_irqsave(l, f)                               \
>>> +    ({                                                          \
>>> +        BUILD_BUG_ON(sizeof(f) != sizeof(unsigned long));       \
>>> +        ((f) = __nrspin_lock_irqsave(l));                       \
>>
>> I don't think the outer pair of parentheses is needed here.
> 
> Turns out it is needed. Otherwise something like:
> 
> 
> if ( a )
>      nrspin_lock_irqsave(l, f);
> else
>      ...
> 
> will fail with "else without a previous if".

That's for "outer" in the whole #define I suppose, when I commented on
just a specific line inside the construct. The ({ ... }) may better be
avoided here too, for there being no reason to use a compiler
extension when do { ... } while ( false ) would also do. Things would
be different in the construct "returned" the flags value, in a more
function-like manner. But that would be inconsistent with related
similar functions.

Jan

Reply via email to