Skip to content

Commit 39e7317

Browse files
committed
perf build: Do not use -Wshadow on gcc < 4.8
As it is too strict, see https://lkml.org/lkml/2006/11/28/253 and https://gcc.gnu.org/gcc-4.8/changes.html, that takes into account Linus's comments (search for Wshadow) for the reasoning about -Wshadow not being interesting before gcc 4.8. Acked-by: Andrii Nakryiko <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent d95daf5 commit 39e7317

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/scripts/Makefile.include

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ EXTRA_WARNINGS += -Wno-system-headers
3232
EXTRA_WARNINGS += -Wold-style-definition
3333
EXTRA_WARNINGS += -Wpacked
3434
EXTRA_WARNINGS += -Wredundant-decls
35-
EXTRA_WARNINGS += -Wshadow
3635
EXTRA_WARNINGS += -Wstrict-prototypes
3736
EXTRA_WARNINGS += -Wswitch-default
3837
EXTRA_WARNINGS += -Wswitch-enum
@@ -69,8 +68,16 @@ endif
6968
# will do for now and keep the above -Wstrict-aliasing=3 in place
7069
# in newer systems.
7170
# Needed for the __raw_cmpxchg in tools/arch/x86/include/asm/cmpxchg.h
71+
#
72+
# See https://lkml.org/lkml/2006/11/28/253 and https://gcc.gnu.org/gcc-4.8/changes.html,
73+
# that takes into account Linus's comments (search for Wshadow) for the reasoning about
74+
# -Wshadow not being interesting before gcc 4.8.
75+
7276
ifneq ($(filter 3.%,$(MAKE_VERSION)),) # make-3
7377
EXTRA_WARNINGS += -fno-strict-aliasing
78+
EXTRA_WARNINGS += -Wno-shadow
79+
else
80+
EXTRA_WARNINGS += -Wshadow
7481
endif
7582

7683
ifneq ($(findstring $(MAKEFLAGS), w),w)

0 commit comments

Comments
 (0)