Messages in this thread | | | From | "Matthew Wilcox (Oracle)" <> | Subject | [PATCH 00/19] Enable -Wshadow=local for kernel/sched | Date | Wed, 2 Mar 2022 04:34:32 +0000 |
| |
I thought I'd choose one of the more core parts of the kernel to demonstrate the value of -Wshadow. It found two places where there are shadowed variables that are at least confusing. For all I know they're buggy and my resolution of these warnings is wrong.
The first 12 patches just untangle the unclean uses of __ret in wait.h & friends. Then 4 patches to fix problems in headers that are noticed by kernel/sched. Two patches fix the two places in kernel/sched/ with shadowed variables and the final patch adds -Wshadow=local to the Makefile.
I'm quite certain this patch series isn't going in as-is. But maybe it'll inspire some patches that can go in.
Matthew Wilcox (Oracle) (19): wait: Parameterize the return variable to ___wait_event() swait: Parameterize the return variable to __swait_event_timeout() swait: Parameterize the return variable to __swait_event_interruptible_timeout() swait: Parameterize the return variable to __swait_event_idle_timeout() wait: Parameterize the return variable to __wait_event_timeout() wait: Parameterize the return variable to __wait_event_freezable_timeout() wait: Parameterize the return variable to __wait_event_interruptible_timeout() wait: Parameterize the return variable to __wait_event_idle_timeout() wait: Parameterize the return variable to __wait_event_idle_exclusive_timeout() wait: Parameterize the return variable to __wait_event_killable_timeout() wait: Parameterize the return variable to __wait_event_lock_irq_timeout() wait_bit: Parameterize the return variable to __wait_var_event_timeout() Add UNIQUE_ID wait: Add a unique identifier to ___wait_event() x86: Use a unique identifier in __WARN_FLAGS() x86: Pass a unique identifier to __xchg_op() sched/rt: Rename a shadowed variable sched/topology: Rename the cpu parameter sched: Enable -Wshadow=local
arch/x86/include/asm/bug.h | 4 +- arch/x86/include/asm/cmpxchg.h | 6 +- include/linux/compiler.h | 1 + include/linux/swait.h | 24 ++-- include/linux/wait.h | 223 ++++++++++++++++----------------- include/linux/wait_bit.h | 9 +- kernel/sched/Makefile | 1 + kernel/sched/rt.c | 4 +- kernel/sched/topology.c | 6 +- 9 files changed, 138 insertions(+), 140 deletions(-)
-- 2.34.1
| |