perf tools: Enable warnings through HOSTCFLAGS
PATCH 1/1 perf tools: Enable warnings through HOSTCFLAGS
The tools build system uses KBUILD_HOSTCFLAGS symbol for obvious purposes.
However this is not set for anything under tools/
As such, host tools apps built have no compiler warnings enabled.
Declare HOSTCFLAGS for perf tools build, and also use that symbol in declaration of host_c_flags. HOSTCFLAGS comes from EXTRA_WARNINGS, which is independent of target platform/arch warning flags.
--
Using HOSTCFLAGS, as opposed to KBUILD_HOSTCFLAGS, is going opposite direction to commit 96f14fe738b6 ("kbuild: Rename HOSTCFLAGS to KBUILD_HOSTCFLAGS"), so would like further opinion from Laura and Masahiro.
tools/build/Build.include +1 -1
@@ -99,7 +99,7 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXX ### ## HOSTCC C flags -host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) +host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) # output directory for tests below TMPOUT = .tmp_$$$$
tools/perf/Makefile.config +5 -0
@@ -17,6 +17,7 @@ detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) +HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) include $(srctree)/tools/scripts/Makefile.arch
@@ -211,6 +212,7 @@ endif ifneq ($(WERROR),0) CORE_CFLAGS += -Werror CXXFLAGS += -Werror + HOSTCFLAGS += -Werror endif ifndef DEBUG
@@ -292,6 +294,9 @@ CXXFLAGS += -ggdb3 CXXFLAGS += -funwind-tables CXXFLAGS += -Wno-strict-aliasing +HOSTCFLAGS += -Wall +HOSTCFLAGS += -Wextra + # Enforce a non-executable stack, as we may regress (again) in the future by # adding assembler files missing the .GNU-stack linker note. LDFLAGS += -Wl,-z,noexecstack
tools/perf/Makefile.perf +1 -1
@@ -226,7 +226,7 @@ else endif export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK -export HOSTCC HOSTLD HOSTAR +export HOSTCC HOSTLD HOSTAR HOSTCFLAGS include $(srctree)/tools/build/Makefile.include
Signature · 1 line
2.17.1
Arnaldo Carvalho de Melo
maintainerEm Sat, Oct 30, 2021 at 12:30:41AM +0800, John Garry escreveu:
Quoted 4 lines
The tools build system uses
KBUILD_HOSTCFLAGSsymbol for obvious purposes.However this is not set for anything under
tools/
Quoted 8 lines
As such, host tools apps built have no compiler warnings enabled.
Declare HOSTCFLAGS for perf tools build, and also use that symbol in declaration of
host_c_flags. HOSTCFLAGS comes fromEXTRA_WARNINGS, which is independent of target platform/arch warning flags.Suggested-by Jiri Olsa <[email protected]>Signed-off-by John Garry <[email protected]>
Jiri, does this implements your suggestion?
- Arnaldo
Quoted 64 lines
--
Using HOSTCFLAGS, as opposed toKBUILD_HOSTCFLAGS, is going opposite direction to commit96f14fe738b6("kbuild: Rename HOSTCFLAGS toKBUILD_HOSTCFLAGS"), so would like further opinion from Laura and Masahiro.tools/build/Build.include +1
-1@@ -99,7 +99,7 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXX ### ## HOSTCC C flags -host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) +host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) # output directory for tests below TMPOUT = .tmp_$$$$tools/perf/Makefile.config +5
-0@@ -17,6 +17,7 @@ detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) +HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) include $(srctree)/tools/scripts/Makefile.arch@@ -211,6 +212,7 @@ endif ifneq ($(WERROR),0) CORE_CFLAGS += -Werror CXXFLAGS += -Werror + HOSTCFLAGS += -Werror endif ifndef DEBUG@@ -292,6 +294,9 @@ CXXFLAGS += -ggdb3 CXXFLAGS += -funwind-tables CXXFLAGS += -Wno-strict-aliasing +HOSTCFLAGS += -Wall +HOSTCFLAGS += -Wextra + # Enforce a non-executable stack, as we may regress (again) in the future by # adding assembler files missing the .GNU-stack linker note. LDFLAGS += -Wl,-z,noexecstacktools/perf/Makefile.perf +1
-1@@ -226,7 +226,7 @@ else endif export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK -export HOSTCC HOSTLD HOSTAR +export HOSTCC HOSTLD HOSTAR HOSTCFLAGS include $(srctree)/tools/build/Makefile.includeSignature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
Arnaldo Carvalho de Melo
maintainerEm Sat, Oct 30, 2021 at 12:30:41AM +0800, John Garry escreveu:
Quoted 10 lines
The tools build system uses
KBUILD_HOSTCFLAGSsymbol for obvious purposes.However this is not set for anything under
tools/As such, host tools apps built have no compiler warnings enabled.
Declare HOSTCFLAGS for perf tools build, and also use that symbol in declaration of
host_c_flags. HOSTCFLAGS comes fromEXTRA_WARNINGS, which is independent of target platform/arch warning flags.
Quoted 7 lines
Suggested-by Jiri Olsa <[email protected]>Signed-off-by John Garry <[email protected]>--
Using HOSTCFLAGS, as opposed toKBUILD_HOSTCFLAGS, is going opposite direction to commit96f14fe738b6("kbuild: Rename HOSTCFLAGS toKBUILD_HOSTCFLAGS"), so would like further opinion from Laura and Masahiro.
Laura's redhat e-mail bouncedm updated it to her kernel.org one, Laura, Masahiro, would you please comment? Jiri?
- Arnaldo
Quoted 58 lines
tools/build/Build.include +1
-1@@ -99,7 +99,7 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXX ### ## HOSTCC C flags -host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) +host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) # output directory for tests below TMPOUT = .tmp_$$$$tools/perf/Makefile.config +5
-0@@ -17,6 +17,7 @@ detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) +HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) include $(srctree)/tools/scripts/Makefile.arch@@ -211,6 +212,7 @@ endif ifneq ($(WERROR),0) CORE_CFLAGS += -Werror CXXFLAGS += -Werror + HOSTCFLAGS += -Werror endif ifndef DEBUG@@ -292,6 +294,9 @@ CXXFLAGS += -ggdb3 CXXFLAGS += -funwind-tables CXXFLAGS += -Wno-strict-aliasing +HOSTCFLAGS += -Wall +HOSTCFLAGS += -Wextra + # Enforce a non-executable stack, as we may regress (again) in the future by # adding assembler files missing the .GNU-stack linker note. LDFLAGS += -Wl,-z,noexecstacktools/perf/Makefile.perf +1
-1@@ -226,7 +226,7 @@ else endif export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK -export HOSTCC HOSTLD HOSTAR +export HOSTCC HOSTLD HOSTAR HOSTCFLAGS include $(srctree)/tools/build/Makefile.includeSignature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
Quoted 19 lines · Arnaldo Carvalho de Melo
Em Sat, Oct 30, 2021 at 12:30:41AM +0800, John Garry escreveu:
Quoted 10 lines
The tools build system uses
KBUILD_HOSTCFLAGSsymbol for obvious purposes.However this is not set for anything under
tools/As such, host tools apps built have no compiler warnings enabled.
Declare HOSTCFLAGS for perf tools build, and also use that symbol in declaration of
host_c_flags. HOSTCFLAGS comes fromEXTRA_WARNINGS, which is independent of target platform/arch warning flags.Quoted 7 lines
Suggested-by Jiri Olsa <[email protected]>Signed-off-by John Garry <[email protected]>--
Using HOSTCFLAGS, as opposed toKBUILD_HOSTCFLAGS, is going opposite direction to commit96f14fe738b6("kbuild: Rename HOSTCFLAGS toKBUILD_HOSTCFLAGS"), so would like further opinion from Laura and Masahiro.
Quoted 2 lines
Laura's redhat e-mail bouncedm updated it to her kernel.org one, Laura, Masahiro, would you please comment? Jiri?
Any opinion on this one? Shall I just resend ... ? or just apply it if no one cares too much :)
Thanks,
John
Quoted 62 lines
- Arnaldo
Quoted 58 lines
tools/build/Build.include +1
-1@@ -99,7 +99,7 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXX ### ## HOSTCC C flags -host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) +host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) # output directory for tests below TMPOUT = .tmp_$$$$tools/perf/Makefile.config +5
-0@@ -17,6 +17,7 @@ detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) +HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) include $(srctree)/tools/scripts/Makefile.arch@@ -211,6 +212,7 @@ endif ifneq ($(WERROR),0) CORE_CFLAGS += -Werror CXXFLAGS += -Werror + HOSTCFLAGS += -Werror endif ifndef DEBUG@@ -292,6 +294,9 @@ CXXFLAGS += -ggdb3 CXXFLAGS += -funwind-tables CXXFLAGS += -Wno-strict-aliasing +HOSTCFLAGS += -Wall +HOSTCFLAGS += -Wextra + # Enforce a non-executable stack, as we may regress (again) in the future by # adding assembler files missing the .GNU-stack linker note. LDFLAGS += -Wl,-z,noexecstacktools/perf/Makefile.perf +1
-1@@ -226,7 +226,7 @@ else endif export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK -export HOSTCC HOSTLD HOSTAR +export HOSTCC HOSTLD HOSTAR HOSTCFLAGS include $(srctree)/tools/build/Makefile.includeSignature · 1 line
2.17.1
Quoted 20 lines · John Garry
Quoted 19 lines · Arnaldo Carvalho de Melo
Em Sat, Oct 30, 2021 at 12:30:41AM +0800, John Garry escreveu:
Quoted 17 lines
The tools build system uses
KBUILD_HOSTCFLAGSsymbol for obvious purposes.However this is not set for anything under
tools/As such, host tools apps built have no compiler warnings enabled.
Declare HOSTCFLAGS for perf tools build, and also use that symbol in declaration of
host_c_flags. HOSTCFLAGS comes fromEXTRA_WARNINGS, which is independent of target platform/arch warning flags.Suggested-by Jiri Olsa <[email protected]>Signed-off-by John Garry <[email protected]>--
Using HOSTCFLAGS, as opposed toKBUILD_HOSTCFLAGS, is going opposite direction to commit96f14fe738b6("kbuild: Rename HOSTCFLAGS toKBUILD_HOSTCFLAGS"), so would like further opinion from Laura and Masahiro.
Quoted 5 lines
Quoted 2 lines
Laura's redhat e-mail bouncedm updated it to her kernel.org one, Laura, Masahiro, would you please comment? Jiri?
Any opinion on this one? Shall I just resend ... ? or just apply it if no one cares too much :)
I'll apply it now that everybody got enough time to review it . :-)
- Arnaldo
Quoted 67 lines
Thanks,
JohnQuoted 62 lines
- Arnaldo
Quoted 58 lines
tools/build/Build.include +1
-1@@ -99,7 +99,7 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXX ### ## HOSTCC C flags -host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) +host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) # output directory for tests below TMPOUT = .tmp_$$$$tools/perf/Makefile.config +5
-0@@ -17,6 +17,7 @@ detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) +HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) include $(srctree)/tools/scripts/Makefile.arch@@ -211,6 +212,7 @@ endif ifneq ($(WERROR),0) CORE_CFLAGS += -Werror CXXFLAGS += -Werror + HOSTCFLAGS += -Werror endif ifndef DEBUG@@ -292,6 +294,9 @@ CXXFLAGS += -ggdb3 CXXFLAGS += -funwind-tables CXXFLAGS += -Wno-strict-aliasing +HOSTCFLAGS += -Wall +HOSTCFLAGS += -Wextra + # Enforce a non-executable stack, as we may regress (again) in the future by # adding assembler files missing the .GNU-stack linker note. LDFLAGS += -Wl,-z,noexecstacktools/perf/Makefile.perf +1
-1@@ -226,7 +226,7 @@ else endif export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK -export HOSTCC HOSTLD HOSTAR +export HOSTCC HOSTLD HOSTAR HOSTCFLAGS include $(srctree)/tools/build/Makefile.includeSignature · 1 line
2.17.1
Jiri Olsa
Acked-byQuoted 23 lines · Arnaldo Carvalho de Melo
Quoted 20 lines · John Garry
Quoted 19 lines · Arnaldo Carvalho de Melo
Em Sat, Oct 30, 2021 at 12:30:41AM +0800, John Garry escreveu:
Quoted 17 lines
The tools build system uses
KBUILD_HOSTCFLAGSsymbol for obvious purposes.However this is not set for anything under
tools/As such, host tools apps built have no compiler warnings enabled.
Declare HOSTCFLAGS for perf tools build, and also use that symbol in declaration of
host_c_flags. HOSTCFLAGS comes fromEXTRA_WARNINGS, which is independent of target platform/arch warning flags.Suggested-by Jiri Olsa <[email protected]>Signed-off-by John Garry <[email protected]>--
Using HOSTCFLAGS, as opposed toKBUILD_HOSTCFLAGS, is going opposite direction to commit96f14fe738b6("kbuild: Rename HOSTCFLAGS toKBUILD_HOSTCFLAGS"), so would like further opinion from Laura and Masahiro.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Laura's redhat e-mail bouncedm updated it to her kernel.org one, Laura, Masahiro, would you please comment? Jiri?
Any opinion on this one? Shall I just resend ... ? or just apply it if no one cares too much :)
I'll apply it now that everybody got enough time to review it . :-)
sorry, overlooked this one, looks good
thanks,
jirka
Quoted 70 lines
- Arnaldo
Quoted 67 lines
Thanks,
JohnQuoted 62 lines
- Arnaldo
Quoted 58 lines
tools/build/Build.include +1
-1@@ -99,7 +99,7 @@ cxx_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(CXXFLAGS) -D"BUILD_STR(s)=\#s" $(CXX ### ## HOSTCC C flags -host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) +host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj)) # output directory for tests below TMPOUT = .tmp_$$$$tools/perf/Makefile.config +5
-0@@ -17,6 +17,7 @@ detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) CFLAGS := $(EXTRA_CFLAGS) $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) +HOSTCFLAGS := $(filter-out -Wnested-externs,$(EXTRA_WARNINGS)) include $(srctree)/tools/scripts/Makefile.arch@@ -211,6 +212,7 @@ endif ifneq ($(WERROR),0) CORE_CFLAGS += -Werror CXXFLAGS += -Werror + HOSTCFLAGS += -Werror endif ifndef DEBUG@@ -292,6 +294,9 @@ CXXFLAGS += -ggdb3 CXXFLAGS += -funwind-tables CXXFLAGS += -Wno-strict-aliasing +HOSTCFLAGS += -Wall +HOSTCFLAGS += -Wextra + # Enforce a non-executable stack, as we may regress (again) in the future by # adding assembler files missing the .GNU-stack linker note. LDFLAGS += -Wl,-z,noexecstacktools/perf/Makefile.perf +1
-1@@ -226,7 +226,7 @@ else endif export srctree OUTPUT RM CC CXX LD AR CFLAGS CXXFLAGS V BISON FLEX AWK -export HOSTCC HOSTLD HOSTAR +export HOSTCC HOSTLD HOSTAR HOSTCFLAGS include $(srctree)/tools/build/Makefile.includeSignature · 1 line
2.17.1