Re: [PATCH v2] atomic: Fix bugs in 'fetch_or()' and rename it to 'xchg_or()'
From: Frederic Weisbecker
Date: Wed Mar 16 2016 - 20:54:44 EST
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!