Enable -Wshadow always
Variable shadowing is, according to the C standard, permitted and valid
behaviour. However, allowing a local variable to take the same name as a
global one can cause confusion and can make refactoring and bug hunting
more difficult.
This patch moves -Wshadow from WARNING2 into the general warning group
so it is always used. It also fixes all warnings that this introduces
by simply renaming the local variable to a new name
Change-Id: I6b71bdce6580c6e58b5e0b41e4704ab0aa38576e
Signed-off-by: Justin Chadwell <justin.chadwell@arm.com>
diff --git a/Makefile b/Makefile
index 65d4629..0582061 100644
--- a/Makefile
+++ b/Makefile
@@ -230,7 +230,7 @@
# General warnings
WARNINGS := -Wall -Wmissing-include-dirs -Wunused \
- -Wdisabled-optimization -Wvla \
+ -Wdisabled-optimization -Wvla -Wshadow \
-Wno-unused-parameter
# Additional warnings
@@ -242,10 +242,10 @@
WARNING1 += -Wold-style-definition
WARNING1 += -Wunused-const-variable
+# Level 2
WARNING2 := -Waggregate-return
WARNING2 += -Wcast-align
WARNING2 += -Wnested-externs
-WARNING2 += -Wshadow
WARNING2 += -Wlogical-op
WARNING3 := -Wbad-function-cast