On Wed, Mar 16, 2016 at 09:14:44AM +0100, Ingo Molnar wrote:
> Yeah, so in the perf tooling build we do have -Wshadow to catch such mishaps,
> but not in the main kernel build.
> 
> ... and yes, if I add it via the patch below the bug gets warned about:
> 
>  include/linux/atomic.h:561:15: note: shadowed declaration is here
>    typeof(ptr)  __ptr  = (ptr);     \
>                ^
>  kernel/sched/core.c:332:11: note: in expansion of macro ‘xchg_or’
>    return !(xchg_or(&ti->flags, _TIF_NEED_RESCHED) & _TIF_POLLING_NRFLA
> 
> ... but I also get a ton of other warnings, just when building a single 
> kernel/sched/core.o file:
> 
>  ./arch/x86/include/asm/bitops.h:396:28: warning: declaration of ‘ffs’ 
> shadows a built-in function [-Wshadow]
>  ./arch/x86/include/asm/bitops.h:396:28: warning: declaration of ‘ffs’ 
> shadows a built-in function [-Wshadow]
>  include/linux/jiffies.h:422:60: warning: declaration of ‘jiffies’ shadows a 
> global declaration [-Wshadow]
>  ./arch/x86/include/asm/io_apic.h:187:54: warning: declaration of ‘apic’ 
> shadows a global declaration [-Wshadow]
>  ./arch/x86/include/asm/bitops.h:396:28: warning: declaration of ‘ffs’ 
> shadows a built-in function [-Wshadow]
>  include/linux/jiffies.h:422:60: warning: declaration of ‘jiffies’ shadows a 
> global declaration [-Wshadow]
>  ./arch/x86/include/asm/io_apic.h:187:54: warning: declaration of ‘apic’ 
> shadows a global declaration [-Wshadow]
>  include/linux/kernel.h:750:12: warning: declaration of ‘_min1’ shadows a 
> previous local [-Wshadow]
>  include/linux/kernel.h:750:12: warning: declaration of ‘_min1’ shadows a 
> previous local [-Wshadow]
>  include/linux/kernel.h:751:12: warning: declaration of ‘_min2’ shadows a 
> previous local [-Wshadow]
>  kernel/sched/sched.h:308:43: warning: declaration of ‘down’ shadows a global 
> declaration [-Wshadow]
>  kernel/sched/sched.h:308:60: warning: declaration of ‘up’ shadows a global 
> declaration [-Wshadow]
>  kernel/sched/auto_group.h:44:55: warning: declaration of ‘init_task’ shadows 
> a global declaration [-Wshadow]
>  kernel/sched/core.c:635:20: warning: declaration of ‘down’ shadows a global 
> declaration [-Wshadow]
>  kernel/sched/core.c:635:37: warning: declaration of ‘up’ shadows a global 
> declaration [-Wshadow]

Heh, what else can we expect from global functions named up() and down() in a 
millions-lines C project :-)

> 
> and yes, I'd say most of these are signatures of sloppy macros and sloppy 
> variable 
> names - but it would be a ton of work to eliminate these warnings.

Yeah that's what I was afraid of.

Thanks for trying it though!

Reply via email to