perf jevents: Enable build warnings
v2 cover perf jevents: Enable build warnings
Currently jevents builds without any complier warning flags enabled. So use newly-defined HOSTCFLAGS, which comes from EXTRA_WARNINGS.
Changes for v2:
- Add Werror, Wall, and Wextra (James Clark suggestion)
Baseline is acme perf/core + mainline commit b94729919db2 ("perf jevents:
Free the sys_event_tables list after processing entries"):
680453e63302 perf jevents: Free the sys_event_tables list after processing entries be8ecc57f180 (origin/perf/core) perf srcline: Use long-running addr2line per DSO 2b775152bbe8 perf tests vmlinux-kallsyms: Ignore hidden symbols
John Garry (2):
perf jevents: Fix some would-be warnings perf jevents: Enable warnings through HOSTCFLAGS
tools/perf/Makefile.config | 5 +++++ tools/perf/Makefile.perf | 2 +- tools/perf/pmu-events/Build | 2 +- tools/perf/pmu-events/jevents.c | 10 ++++------ 4 files changed, 11 insertions(+), 8 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/2 perf jevents: Fix some would-be warnings
Before enabling warnings through HOSTCFLAGS, fix the would-be warnings:
HOSTCC pmu-events/jevents.opmu-events/jevents.c:74:22: warning: no previous prototype for ‘convert’ [-Wmissing-prototypes]
74 | enum aggr_mode_class convert(const char *aggr_mode)
| ^~~~~~~
pmu-events/jevents.c: In function ‘print_events_table_entry’:
pmu-events/jevents.c:373:8: warning: declaration of ‘topic’ shadows a global declaration [-Wshadow]
373 | char *topic = pd->topic;
| ^~~~~
pmu-events/jevents.c:316:14: note: shadowed declaration is here
316 | static char *topic;
| ^~~~~
pmu-events/jevents.c: In function ‘json_events’:
pmu-events/jevents.c:554:9: warning: declaration of ‘func’ shadows a global declaration [-Wshadow]
554 | int (*func)(void *data, struct json_event *je),
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~pmu-events/jevents.c:85:15: note: shadowed declaration is here
85 | typedef int (*func)(void *data, struct json_event *je);
| ^~~~pmu-events/jevents.c: In function ‘main’:pmu-events/jevents.c:1211:25: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1211 | char *err_string_ext = "";
| ^~pmu-events/jevents.c:1304:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1304 | err_string_ext = " for std arch event";
| ^
--- tools/perf/pmu-events/jevents.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
tools/perf/pmu-events/jevents.c +4 -6
@@ -71,7 +71,7 @@ struct json_event {char *metric_constraint; }; -enum aggr_mode_class convert (const char *aggr_mode) +static enum aggr_mode_class convert (const char *aggr_mode) {if (!strcmp (aggr_mode,"PerCore" ))return PerCore;
@@ -82,8 +82,6 @@ enum aggr_mode_class convert(const char *aggr_mode)return -1 ; } -typedef int (*func )(void *data,struct json_event *je); -static LIST_HEAD (sys_event_tables);struct sys_event_table {
@@ -370,7 +368,7 @@ static int print_events_table_entry(void *data, struct json_event *je) {struct perf_entry_data *pd = data;FILE *outfp = pd->outfp; -char *topic = pd->topic; +char *topic_local = pd->topic;/* * TODO: Remove formatting chars after debugging to reduce
@@ -385,7 +383,7 @@ static int print_events_table_entry(void *data, struct json_event *je)fprintf (outfp,"\t.desc = \"%s\",\n" , je->desc);if (je->compat)fprintf (outfp,"\t.compat = \"%s\",\n" , je->compat); -fprintf (outfp,"\t.topic = \"%s\",\n" , topic); +fprintf (outfp,"\t.topic = \"%s\",\n" , topic_local);if (je->long_desc && je->long_desc[0 ])fprintf (outfp,"\t.long_desc = \"%s\",\n" , je->long_desc);if (je->pmu)
@@ -1208,7 +1206,7 @@ int main(int argc, char *argv[])const char *arch;const char *output_file;const char *start_dirname; -char *err_string_ext ="" ; +const char *err_string_ext ="" ;struct stat stbuf; prog =basename (argv[0 ]);
Signature · 1 line
2.17.1
PATCH v2 2/2 perf jevents: Enable warnings through HOSTCFLAGS
In reply to John GarryCurrently no compiler warnings at all are enabled for building jevents, so help catch bugs at compile time by enabling through HOSTCFLAGS.
--- tools/perf/Makefile.config | 5 +++++ tools/perf/Makefile.perf | 2 +- tools/perf/pmu-events/Build | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-)
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
tools/perf/pmu-events/Build +1 -1
@@ -1,7 +1,7 @@ hostprogs := jevents jevents-y += json.o jsmn.o jevents.o -HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include +HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include $(HOSTCFLAGS) pmu-events-y += pmu-events.o JDIR = pmu-events/arch/$(SRCARCH) JSON = $(shell [ -d $(JDIR) ] && \
Signature · 1 line
2.17.1
Re: [PATCH v2 2/2] perf jevents: Enable warnings through HOSTCFLAGS
Quoted 58 lines · John Garry
Currently no compiler warnings at all are enabled for building jevents, so help catch bugs at compile time by enabling through HOSTCFLAGS.
Signed-off-by John Garry <[email protected]>--- tools/perf/Makefile.config | 5 +++++ tools/perf/Makefile.perf | 2 +- tools/perf/pmu-events/Build | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-)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.includetools/perf/pmu-events/Build +0
-0
tools/perf/pmu-events/Build line 4
Quoted 5 lines
tools/perf/pmu-events/Build +1
-1@@ -1,7 +1,7 @@ hostprogs := jevents jevents-y += json.o jsmn.o jevents.o -HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include +HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include $(HOSTCFLAGS)
so the the host cflags are made of:
host_c_flags = -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))
can't you use KBUILD_HOSTCFLAGS?
also perhaps we could rename KBUILD_HOSTCFLAGS to HOSTCFLAGS? the name seems like leftover from kbuild move
jirka
Quoted 6 lines
tools/perf/pmu-events/Build +0
-0pmu-events-y += pmu-events.o JDIR = pmu-events/arch/$(SRCARCH) JSON = $(shell [ -d $(JDIR) ] && \Signature · 1 line
2.17.1
Re: [PATCH v2 2/2] perf jevents: Enable warnings through HOSTCFLAGS
Quoted 26 lines · Jiri Olsa
Quoted 26 lines
tools/perf/Makefile.config +3
-0+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.includetools/perf/pmu-events/Build +0
-0@@ -1,7 +1,7 @@ hostprogs := jevents
Quoted 8 lines
tools/perf/pmu-events/Build line 4
Quoted 3 lines
tools/perf/pmu-events/Build +1
-1jevents-y += json.o jsmn.o jevents.o -HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include +HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include $(HOSTCFLAGS)so the the host cflags are made of:
host_c_flags= -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))can't you use
KBUILD_HOSTCFLAGS?
Maybe. However, it seems to be empty when building perf/pmu-events. Even in building tools/objtool - which currently references it - it is empty AFAICS. I'm not sure if it's being imported properly.
Thanks,
John
Quoted 3 lines
also perhaps we could rename
KBUILD_HOSTCFLAGSto HOSTCFLAGS? the name seems like leftover from kbuild move
Re: [PATCH v2 2/2] perf jevents: Enable warnings through HOSTCFLAGS
Quoted 28 lines · John Garry
Quoted 27 lines · Jiri Olsa
Quoted 21 lines
(quoted diff) +3
-0+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.includetools/perf/pmu-events/Build +0
-0tools/perf/pmu-events/Build line 3
Quoted 4 lines
tools/perf/pmu-events/Build +1
-1@@ -1,7 +1,7 @@ hostprogs := jevents jevents-y += json.o jsmn.o jevents.o -HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include +HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include $(HOSTCFLAGS)so the the host cflags are made of:
Quoted 8 lines
Quoted 3 lines
host_c_flags= -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))can't you use
KBUILD_HOSTCFLAGS?Maybe. However, it seems to be empty when building perf/pmu-events. Even in building
tools/objtool- which currently references it - it is empty AFAICS. I'm not sure if it's being imported properly.
I meant change like this (on top of yours)
jirka
---
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
Re: [PATCH v2 2/2] perf jevents: Enable warnings through HOSTCFLAGS
In reply to Jiri OlsaQuoted 26 lines · Jiri Olsa
Quoted 26 lines
tools/perf/Makefile.config +3
-0+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.includetools/perf/pmu-events/Build +0
-0@@ -1,7 +1,7 @@ hostprogs := jevents
Quoted 7 lines
tools/perf/pmu-events/Build line 4
Quoted 3 lines
tools/perf/pmu-events/Build +1
-1jevents-y += json.o jsmn.o jevents.o -HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include +HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include $(HOSTCFLAGS)so the the host cflags are made of:
host_c_flags= -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))
ok, so IIRC, then the rule for building .o from .c in tools/build/Makefile.build will pick up HOSTCFLAGS through this variable, so we then don't need to explicitly mention it in the per-target rule, so can have this as before in pmu-events/Build
HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include
right?
(Indeed I guess that we can get rid of -I$(srctree)/tools/include as well)
Thanks,
John
Quoted 10 lines
can't you use
KBUILD_HOSTCFLAGS?also perhaps we could rename
KBUILD_HOSTCFLAGSto HOSTCFLAGS? the name seems like leftover from kbuild movejirka
Quoted 3 lines
tools/perf/pmu-events/Build +0
-0pmu-events-y += pmu-events.o JDIR = pmu-events/arch/$(SRCARCH) JSON = $(shell [ -d $(JDIR) ] &&
Re: [PATCH v2 2/2] perf jevents: Enable warnings through HOSTCFLAGS
Quoted 36 lines · John Garry
Quoted 27 lines · Jiri Olsa
Quoted 21 lines
(quoted diff) +3
-0+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.includetools/perf/pmu-events/Build +0
-0tools/perf/pmu-events/Build line 3
Quoted 4 lines
tools/perf/pmu-events/Build +1
-1@@ -1,7 +1,7 @@ hostprogs := jevents jevents-y += json.o jsmn.o jevents.o -HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include +HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include $(HOSTCFLAGS)so the the host cflags are made of:
Quoted 2 lines
host_c_flags= -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))ok, so IIRC, then the rule for building .o from .c in
tools/build/Makefile.buildwill pick up HOSTCFLAGS through this variable, so we then don't need to explicitly mention it in the per-target rule, so can have this as before in pmu-events/Build
Quoted 5 lines
HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include
right?
(Indeed I guess that we can get rid of -I$(srctree)/tools/include as well)
hm, the -I.. should stay no? I don't see that
it's being added soem other way
jirka
---
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
Arnaldo Carvalho de Melo
maintainerRe: [PATCH v2 2/2] perf jevents: Enable warnings through HOSTCFLAGS
Em Mon, Oct 25, 2021 at 01:40:44PM +0200, Jiri Olsa escreveu:
Quoted 39 lines · John Garry
Quoted 38 lines · Jiri Olsa
Quoted 27 lines
Quoted 21 lines
tools/perf/Makefile.config +3
-0+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.includetools/perf/pmu-events/Build +0
-0tools/perf/pmu-events/Build line 3
Quoted 4 lines
tools/perf/pmu-events/Build +1
-1@@ -1,7 +1,7 @@ hostprogs := jevents jevents-y += json.o jsmn.o jevents.o -HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include +HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include $(HOSTCFLAGS)so the the host cflags are made of:
Quoted 2 lines
host_c_flags= -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))ok, so IIRC, then the rule for building .o from .c in
tools/build/Makefile.buildwill pick up HOSTCFLAGS through this variable, so we then don't need to explicitly mention it in the per-target rule, so can have this as before in pmu-events/BuildHOSTCFLAGS_jevents.o = -I$(srctree)/tools/include
Quoted 9 lines
Quoted 3 lines
right?
(Indeed I guess that we can get rid of -I$(srctree)/tools/include as well)
hm, the -I.. should stay no? I don't see that
it's being added soem other wayjirka
Probably this change from KBUILD_HOSTCFLAGS back to HOSTCFLAGS should come with this;
Right?
- Arnaldo
Quoted 57 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.include
Signature · 1 line
- Arnaldo
Re: [PATCH v2 2/2] perf jevents: Enable warnings through HOSTCFLAGS
Quoted 50 lines · Arnaldo Carvalho de Melo
Em Mon, Oct 25, 2021 at 01:40:44PM +0200, Jiri Olsa escreveu:
Quoted 39 lines · John Garry
Quoted 38 lines · Jiri Olsa
Quoted 27 lines
Quoted 21 lines
tools/perf/Makefile.config +3
-0+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.includetools/perf/pmu-events/Build +0
-0tools/perf/pmu-events/Build line 3
Quoted 4 lines
tools/perf/pmu-events/Build +1
-1@@ -1,7 +1,7 @@ hostprogs := jevents jevents-y += json.o jsmn.o jevents.o -HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include +HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include $(HOSTCFLAGS)so the the host cflags are made of:
Quoted 2 lines
host_c_flags= -Wp,-MD,$(depfile) -Wp,-MT,$@ $(KBUILD_HOSTCFLAGS) -D"BUILD_STR(s)=\#s" $(HOSTCFLAGS_$(basetarget).o) $(HOSTCFLAGS_$(obj))ok, so IIRC, then the rule for building .o from .c in
tools/build/Makefile.buildwill pick up HOSTCFLAGS through this variable, so we then don't need to explicitly mention it in the per-target rule, so can have this as before in pmu-events/BuildHOSTCFLAGS_jevents.o = -I$(srctree)/tools/include
Quoted 9 lines
Quoted 3 lines
right?
(Indeed I guess that we can get rid of -I$(srctree)/tools/include as well)
hm, the -I.. should stay no? I don't see that
it's being added soem other wayjirka
Quoted 8 lines
Probably this change from
KBUILD_HOSTCFLAGSback to HOSTCFLAGS should come with this;Cc Laura Abbott <[email protected]>Cc Masahiro Yamada <[email protected]>Fixes 96f14fe738b69dd9 ("kbuild: Rename HOSTCFLAGS to KBUILD_HOSTCFLAGS")Right?
Maybe, but then renaming back from KBUILD_HOSTCFLAGS -> HOSTCFLAGS seems odd as a fix
Anyway, now that this original series is in perf/core, I'll send patches on top with this change, cc'ing Laura and Masahiro
Thanks!
Arnaldo Carvalho de Melo
maintainerRe: [PATCH v2 2/2] perf jevents: Enable warnings through HOSTCFLAGS
Em Thu, Oct 28, 2021 at 09:23:58AM +0100, John Garry escreveu:
Quoted 25 lines · Arnaldo Carvalho de Melo
Quoted 23 lines
Em Mon, Oct 25, 2021 at 01:40:44PM +0200, Jiri Olsa escreveu:
Quoted 7 lines · John Garry
Quoted 5 lines · Jiri Olsa
ok, so IIRC, then the rule for building .o from .c in
tools/build/Makefile.buildwill pick up HOSTCFLAGS through this variable, so we then don't need to explicitly mention it in the per-target rule, so can have this as before in pmu-events/BuildQuoted 8 lines
Quoted 5 lines
HOSTCFLAGS_jevents.o = -I$(srctree)/tools/include
right?
(Indeed I guess that we can get rid of -I$(srctree)/tools/include as well)
hm, the -I.. should stay no? I don't see that
it's being added soem other wayProbably this change from
KBUILD_HOSTCFLAGSback to HOSTCFLAGS should come with this;Cc Laura Abbott <[email protected]>Cc Masahiro Yamada <[email protected]>Fixes 96f14fe738b69dd9 ("kbuild: Rename HOSTCFLAGS to KBUILD_HOSTCFLAGS")
Quoted 6 lines
Quoted 1 line
Right?
Maybe, but then renaming back from
KBUILD_HOSTCFLAGS-> HOSTCFLAGS seems odd as a fixAnyway, now that this original series is in perf/core,
Nope, just this one landed:
commit 342cb7ebf5e29fff4dc09ab2c8f37d710f8f5206
Author: John Garry <[email protected]> Date: Thu Oct 21 17:16:44 2021 +0800
perf jevents: Fix some would-be warnings
---
The one you asked to wait for further discussion wasn't merged.
- Arnaldo
Quoted 1 line
I'll send patches on top with this change, cc'ing Laura and Masahiro
Re: [PATCH v2 2/2] perf jevents: Enable warnings through HOSTCFLAGS
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 4 lines
Maybe, but then renaming back from
KBUILD_HOSTCFLAGS-> HOSTCFLAGS seems odd as a fixAnyway, now that this original series is in perf/core,
Nope, just this one landed:
commit
342cb7ebf5e29fff4dc09ab2c8f37d710f8f5206
Quoted 8 lines
Author: John Garry<[email protected]> Date: Thu Oct 21 17:16:44 2021 +0800perf jevents: Fix some would-be warnings
---
The one you asked to wait for further discussion wasn't merged.
ah, at I glance I saw my name and this patch and assumed both were in.
OK, so I'll put together a new series soon and post that.
Thanks
Em Thu, Oct 21, 2021 at 05:16:43PM +0800, John Garry escreveu:
Quoted 5 lines
Currently jevents builds without any complier warning flags enabled. So use newly-defined HOSTCFLAGS, which comes from
EXTRA_WARNINGS.Changes for v2:
- Add Werror, Wall, and Wextra (James Clark suggestion)
Thanks, applied.
- Arnaldo
Quoted 19 lines
Baseline is acme perf/core + mainline commit
b94729919db2("perf jevents:
Free thesys_event_tableslist after processing entries"):
680453e63302perf jevents: Free thesys_event_tableslist after processing entriesbe8ecc57f180(origin/perf/core) perf srcline: Use long-running addr2line per DSO2b775152bbe8perf tests vmlinux-kallsyms: Ignore hidden symbolsJohn Garry (2):
perf jevents: Fix some would-be warnings perf jevents: Enable warnings through HOSTCFLAGStools/perf/Makefile.config | 5 +++++ tools/perf/Makefile.perf | 2 +- tools/perf/pmu-events/Build | 2 +- tools/perf/pmu-events/jevents.c | 10 ++++------ 4 files changed, 11 insertions(+), 8 deletions(-)Signature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
Quoted 9 lines · Arnaldo Carvalho de Melo
Em Thu, Oct 21, 2021 at 05:16:43PM +0800, John Garry escreveu:
Quoted 5 lines
Currently jevents builds without any complier warning flags enabled. So use newly-defined HOSTCFLAGS, which comes from
EXTRA_WARNINGS.Changes for v2:
- Add Werror, Wall, and Wextra (James Clark suggestion)Thanks, applied.
Hi Arnaldo,
Can you please wait until I check the review response from jirka?
Thanks
Quoted 23 lines
- Arnaldo
Quoted 19 lines
Baseline is acme perf/core + mainline commit
b94729919db2("perf jevents:
Free thesys_event_tableslist after processing entries"):
680453e63302perf jevents: Free thesys_event_tableslist after processing entriesbe8ecc57f180(origin/perf/core) perf srcline: Use long-running addr2line per DSO2b775152bbe8perf tests vmlinux-kallsyms: Ignore hidden symbolsJohn Garry (2):
perf jevents: Fix some would-be warnings perf jevents: Enable warnings through HOSTCFLAGStools/perf/Makefile.config | 5 +++++ tools/perf/Makefile.perf | 2 +- tools/perf/pmu-events/Build | 2 +- tools/perf/pmu-events/jevents.c | 10 ++++------ 4 files changed, 11 insertions(+), 8 deletions(-)Signature · 1 line
2.17.1
Quoted 8 lines · John Garry
Quoted 7 lines · Arnaldo Carvalho de Melo
Em Thu, Oct 21, 2021 at 05:16:43PM +0800, John Garry escreveu:
Quoted 5 lines
Currently jevents builds without any complier warning flags enabled. So use newly-defined HOSTCFLAGS, which comes from
EXTRA_WARNINGS.Changes for v2:
- Add Werror, Wall, and Wextra (James Clark suggestion)
Quoted 6 lines
Quoted 2 lines
Thanks, applied.
Hi Arnaldo,
Can you please wait until I check the review response from jirka?
Sure, it's not published, and will not be until some fixes are made. Having it in my local tree gets it tested together with the whole shebang in lots of containers.
I collect reviewed-by, etc as they appear.
- Arnaldo
Quoted 23 lines
Quoted 22 lines
Quoted 21 lines
Baseline is acme perf/core + mainline commit
b94729919db2("perf jevents:
Free thesys_event_tableslist after processing entries"):
680453e63302perf jevents: Free thesys_event_tableslist after processing entriesbe8ecc57f180(origin/perf/core) perf srcline: Use long-running addr2line per DSO2b775152bbe8perf tests vmlinux-kallsyms: Ignore hidden symbolsJohn Garry (2):
perf jevents: Fix some would-be warnings perf jevents: Enable warnings through HOSTCFLAGStools/perf/Makefile.config | 5 +++++ tools/perf/Makefile.perf | 2 +- tools/perf/pmu-events/Build | 2 +- tools/perf/pmu-events/jevents.c | 10 ++++------ 4 files changed, 11 insertions(+), 8 deletions(-)Signature · 1 line
2.17.1