lkml.org 
[lkml]   [2020]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] seqlock: avoid -Wshadow warnings
From
Date
On 28/10/2020 00.34, Arnd Bergmann wrote:
> On Mon, Oct 26, 2020 at 5:58 PM Peter Zijlstra <peterz@infradead.org> wrote:
>>
>> On Mon, Oct 26, 2020 at 05:50:38PM +0100, Arnd Bergmann wrote:
>>
>>> - unsigned seq; \
>>> + unsigned __seq; \
>>
>>> - unsigned seq = __read_seqcount_begin(s); \
>>> + unsigned _seq = __read_seqcount_begin(s); \
>>
>>> - unsigned seq = __seqcount_sequence(s); \
>>> + unsigned __seq = __seqcount_sequence(s); \
>>
>> Can we have a consistent number of leading '_' ?
>
> Not really ;-)
>
> The warning comes from raw_read_seqcount_begin() calling
> __read_seqcount_begin() and both using the same variable
> name. I could rename one of them and use double-underscores
> for both, but I haven't come up with a good alternative name
> that wouldn't make it less consistent in the process.

At least x86's put_user and get_user use _pu/_gu suffixes on their local
variables, so perhaps that could be made a weak default convention?

__seq_rsb
__seq_rrsb
__seq_rrs

Hm, or perhaps not. But it's still better than triplicating each macro
to do a UNIQUE_ID dance.

Rasmus

\
 
 \ /
  Last update: 2020-10-28 22:56    [W:0.055 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site