linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: Enable warnings through HOSTCFLAGS
@ 2021-10-29 16:30 John Garry
  2021-11-01 21:10 ` Arnaldo Carvalho de Melo
  2021-11-06 19:27 ` Arnaldo Carvalho de Melo
  0 siblings, 2 replies; 6+ messages in thread
From: John Garry @ 2021-10-29 16:30 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	masahiroy, labbott
  Cc: linux-kernel, linux-perf-users, irogers, John Garry

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.

Suggested-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: John Garry <john.garry@huawei.com>
--
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.

diff --git a/tools/build/Build.include b/tools/build/Build.include
index 2cf3b1bde86e..c2a95ab47379 100644
--- a/tools/build/Build.include
+++ b/tools/build/Build.include
@@ -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_$$$$
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 4a9baed28f2e..9b95ba09657f 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -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
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a3966f290297..8ca656aa8b06 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -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
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Enable warnings through HOSTCFLAGS
  2021-10-29 16:30 [PATCH] perf tools: Enable warnings through HOSTCFLAGS John Garry
@ 2021-11-01 21:10 ` Arnaldo Carvalho de Melo
  2021-11-06 19:27 ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-11-01 21:10 UTC (permalink / raw)
  To: John Garry
  Cc: peterz, mingo, alexander.shishkin, jolsa, namhyung, masahiroy,
	labbott, linux-kernel, linux-perf-users, irogers

Em Sat, Oct 30, 2021 at 12:30:41AM +0800, John Garry escreveu:
> 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.
> 
> Suggested-by: Jiri Olsa <jolsa@redhat.com>
> Signed-off-by: John Garry <john.garry@huawei.com>

Jiri, does this implements your suggestion?

- Arnaldo

> --
> 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.
> 
> diff --git a/tools/build/Build.include b/tools/build/Build.include
> index 2cf3b1bde86e..c2a95ab47379 100644
> --- a/tools/build/Build.include
> +++ b/tools/build/Build.include
> @@ -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_$$$$
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 4a9baed28f2e..9b95ba09657f 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -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
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index a3966f290297..8ca656aa8b06 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -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
>  
> -- 
> 2.17.1

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Enable warnings through HOSTCFLAGS
  2021-10-29 16:30 [PATCH] perf tools: Enable warnings through HOSTCFLAGS John Garry
  2021-11-01 21:10 ` Arnaldo Carvalho de Melo
@ 2021-11-06 19:27 ` Arnaldo Carvalho de Melo
  2021-11-15 15:53   ` John Garry
  1 sibling, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-11-06 19:27 UTC (permalink / raw)
  To: John Garry
  Cc: peterz, mingo, alexander.shishkin, jolsa, namhyung, masahiroy,
	Laura Abbott, linux-kernel, linux-perf-users, irogers

Em Sat, Oct 30, 2021 at 12:30:41AM +0800, John Garry escreveu:
> 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.
> 
> Suggested-by: Jiri Olsa <jolsa@redhat.com>
> Signed-off-by: John Garry <john.garry@huawei.com>
> --
> 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.

Laura's redhat e-mail bouncedm updated it to her kernel.org one, Laura,
Masahiro, would you please comment? Jiri?

- Arnaldo
 
> diff --git a/tools/build/Build.include b/tools/build/Build.include
> index 2cf3b1bde86e..c2a95ab47379 100644
> --- a/tools/build/Build.include
> +++ b/tools/build/Build.include
> @@ -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_$$$$
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 4a9baed28f2e..9b95ba09657f 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -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
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index a3966f290297..8ca656aa8b06 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -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
>  
> -- 
> 2.17.1

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Enable warnings through HOSTCFLAGS
  2021-11-06 19:27 ` Arnaldo Carvalho de Melo
@ 2021-11-15 15:53   ` John Garry
  2021-11-15 17:44     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 6+ messages in thread
From: John Garry @ 2021-11-15 15:53 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, jolsa, masahiroy, Laura Abbott
  Cc: peterz, mingo, alexander.shishkin, namhyung, linux-kernel,
	linux-perf-users, irogers

On 06/11/2021 19:27, Arnaldo Carvalho de Melo wrote:
> Em Sat, Oct 30, 2021 at 12:30:41AM +0800, John Garry escreveu:
>> 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.
>>
>> Suggested-by: Jiri Olsa <jolsa@redhat.com>
>> Signed-off-by: John Garry <john.garry@huawei.com>
>> --
>> 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.
> 
> 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

> 
> - Arnaldo
>   
>> diff --git a/tools/build/Build.include b/tools/build/Build.include
>> index 2cf3b1bde86e..c2a95ab47379 100644
>> --- a/tools/build/Build.include
>> +++ b/tools/build/Build.include
>> @@ -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_$$$$
>> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
>> index 4a9baed28f2e..9b95ba09657f 100644
>> --- a/tools/perf/Makefile.config
>> +++ b/tools/perf/Makefile.config
>> @@ -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
>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
>> index a3966f290297..8ca656aa8b06 100644
>> --- a/tools/perf/Makefile.perf
>> +++ b/tools/perf/Makefile.perf
>> @@ -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
>>   
>> -- 
>> 2.17.1
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Enable warnings through HOSTCFLAGS
  2021-11-15 15:53   ` John Garry
@ 2021-11-15 17:44     ` Arnaldo Carvalho de Melo
  2021-11-15 21:10       ` Jiri Olsa
  0 siblings, 1 reply; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-11-15 17:44 UTC (permalink / raw)
  To: John Garry, Arnaldo Carvalho de Melo, jolsa, masahiroy, Laura Abbott
  Cc: peterz, mingo, alexander.shishkin, namhyung, linux-kernel,
	linux-perf-users, irogers



On November 15, 2021 12:53:33 PM GMT-03:00, John Garry <john.garry@huawei.com> wrote:
>On 06/11/2021 19:27, Arnaldo Carvalho de Melo wrote:
>> Em Sat, Oct 30, 2021 at 12:30:41AM +0800, John Garry escreveu:
>>> 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.
>>>
>>> Suggested-by: Jiri Olsa <jolsa@redhat.com>
>>> Signed-off-by: John Garry <john.garry@huawei.com>
>>> --
>>> 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.
>> 
>> 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
>
>Thanks,
>John
>
>> 
>> - Arnaldo
>>   
>>> diff --git a/tools/build/Build.include b/tools/build/Build.include
>>> index 2cf3b1bde86e..c2a95ab47379 100644
>>> --- a/tools/build/Build.include
>>> +++ b/tools/build/Build.include
>>> @@ -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_$$$$
>>> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
>>> index 4a9baed28f2e..9b95ba09657f 100644
>>> --- a/tools/perf/Makefile.config
>>> +++ b/tools/perf/Makefile.config
>>> @@ -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
>>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
>>> index a3966f290297..8ca656aa8b06 100644
>>> --- a/tools/perf/Makefile.perf
>>> +++ b/tools/perf/Makefile.perf
>>> @@ -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
>>>   
>>> -- 
>>> 2.17.1
>> 
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] perf tools: Enable warnings through HOSTCFLAGS
  2021-11-15 17:44     ` Arnaldo Carvalho de Melo
@ 2021-11-15 21:10       ` Jiri Olsa
  0 siblings, 0 replies; 6+ messages in thread
From: Jiri Olsa @ 2021-11-15 21:10 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: John Garry, Arnaldo Carvalho de Melo, masahiroy, Laura Abbott,
	peterz, mingo, alexander.shishkin, namhyung, linux-kernel,
	linux-perf-users, irogers

On Mon, Nov 15, 2021 at 02:44:59PM -0300, Arnaldo Carvalho de Melo wrote:
> 
> 
> On November 15, 2021 12:53:33 PM GMT-03:00, John Garry <john.garry@huawei.com> wrote:
> >On 06/11/2021 19:27, Arnaldo Carvalho de Melo wrote:
> >> Em Sat, Oct 30, 2021 at 12:30:41AM +0800, John Garry escreveu:
> >>> 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.
> >>>
> >>> Suggested-by: Jiri Olsa <jolsa@redhat.com>
> >>> Signed-off-by: John Garry <john.garry@huawei.com>
> >>> --
> >>> 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.
> >> 
> >> 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

Acked-by: Jiri Olsa <jolsa@redhat.com>

thanks,
jirka

> 
> - Arnaldo
> >
> >Thanks,
> >John
> >
> >> 
> >> - Arnaldo
> >>   
> >>> diff --git a/tools/build/Build.include b/tools/build/Build.include
> >>> index 2cf3b1bde86e..c2a95ab47379 100644
> >>> --- a/tools/build/Build.include
> >>> +++ b/tools/build/Build.include
> >>> @@ -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_$$$$
> >>> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> >>> index 4a9baed28f2e..9b95ba09657f 100644
> >>> --- a/tools/perf/Makefile.config
> >>> +++ b/tools/perf/Makefile.config
> >>> @@ -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
> >>> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> >>> index a3966f290297..8ca656aa8b06 100644
> >>> --- a/tools/perf/Makefile.perf
> >>> +++ b/tools/perf/Makefile.perf
> >>> @@ -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
> >>>   
> >>> -- 
> >>> 2.17.1
> >> 
> >
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-16  1:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-29 16:30 [PATCH] perf tools: Enable warnings through HOSTCFLAGS John Garry
2021-11-01 21:10 ` Arnaldo Carvalho de Melo
2021-11-06 19:27 ` Arnaldo Carvalho de Melo
2021-11-15 15:53   ` John Garry
2021-11-15 17:44     ` Arnaldo Carvalho de Melo
2021-11-15 21:10       ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).