* unused-variable warning is getting disabled with clang @ 2017-12-06 21:24 Sodagudi Prasad 2017-12-07 6:26 ` Greg Kroah-Hartman 0 siblings, 1 reply; 12+ messages in thread From: Sodagudi Prasad @ 2017-12-06 21:24 UTC (permalink / raw) To: Greg Kroah-Hartman, Masahiro Yamada, Michal Marek, Greg Hackmann Cc: linux-kbuild, linux-kernel Hi All, When kernel compiled with clang, following line is disabling the unused-variable warning. This is not the case with gcc. KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) Are there any specific reasons for disabling unused-variable with clang? -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: unused-variable warning is getting disabled with clang 2017-12-06 21:24 unused-variable warning is getting disabled with clang Sodagudi Prasad @ 2017-12-07 6:26 ` Greg Kroah-Hartman 2017-12-08 2:16 ` Sodagudi Prasad 0 siblings, 1 reply; 12+ messages in thread From: Greg Kroah-Hartman @ 2017-12-07 6:26 UTC (permalink / raw) To: Sodagudi Prasad Cc: Masahiro Yamada, Michal Marek, Greg Hackmann, linux-kbuild, linux-kernel On Wed, Dec 06, 2017 at 01:24:51PM -0800, Sodagudi Prasad wrote: > > Hi All, > > When kernel compiled with clang, following line is disabling the > unused-variable warning. This is not the case with gcc. > KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) > > Are there any specific reasons for disabling unused-variable with clang? Try it and see why it is disabled :) ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: unused-variable warning is getting disabled with clang 2017-12-07 6:26 ` Greg Kroah-Hartman @ 2017-12-08 2:16 ` Sodagudi Prasad 2017-12-18 15:32 ` Masahiro Yamada 0 siblings, 1 reply; 12+ messages in thread From: Sodagudi Prasad @ 2017-12-08 2:16 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Masahiro Yamada, Michal Marek, Greg Hackmann, linux-kbuild, linux-kernel On 2017-12-06 22:26, Greg Kroah-Hartman wrote: > On Wed, Dec 06, 2017 at 01:24:51PM -0800, Sodagudi Prasad wrote: >> >> Hi All, >> >> When kernel compiled with clang, following line is disabling the >> unused-variable warning. This is not the case with gcc. >> KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) >> >> Are there any specific reasons for disabling unused-variable with >> clang? > > Try it and see why it is disabled :) Hi Greg, When I have enabled -Wunused-variable warnings with clang, observed both -Wunused-variable and -Wunused-const-variable as expected. It looks that, -Wunused-const-variable warnings are disabled explicitly with GCC as well. commit - c9c6837d39311b0c - "kbuild: move -Wunused-const-variable to W=1 warning level" I could see following warnings along with couple of -Wunused-variables warnings with downstream code. arch/arm64/crypto/sha1-ce-glue.c:118:1: warning: unused variable 'cpu_feature_match_SHA1' [-Wunused-const-variable] include/linux/cpufeature.h:48:33: note: expanded from macro 'module_cpu_feature_match' arch/arm64/crypto/sha2-ce-glue.c:148:1: warning: unused variable 'cpu_feature_match_SHA2' [-Wunused-const-variable] arch/arm64/crypto/ghash-ce-glue.c:597:33: warning: unused variable 'ghash_cpu_feature' [-Wunused-const-variable] arch/arm64/crypto/aes-ce-cipher.c:280:1: warning: unused variable 'cpu_feature_match_AES' [-Wunused-const-variable] arch/arm64/crypto/aes-glue.c:674:1: warning: unused variable 'cpu_feature_match_AES' [-Wunused-const-variable] kernel/trace/ftrace.c:1092:27: warning: unused variable 'ftrace_swapper_pid' [-Wunused-const-variable] drivers/usb/host/ehci-platform.c:406:36: warning: unused variable 'ehci_acpi_match' [-Wunused-const-variable] drivers/usb/host/xhci-plat.c:416:36: warning: unused variable 'usb_xhci_acpi_match' [-Wunused-const-variable] So I have made following change and I will share patch for the same. diff --git a/Makefile b/Makefile index 4e6da2f..8a6c14e 100644 --- a/Makefile +++ b/Makefile @@ -711,7 +711,7 @@ endif KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) -meabi gnu KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) Please let me know if you have any concerns with this approach to identify all unused local variables. -Thanks, Prasad -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: unused-variable warning is getting disabled with clang 2017-12-08 2:16 ` Sodagudi Prasad @ 2017-12-18 15:32 ` Masahiro Yamada 2018-01-27 0:59 ` [PATCH] kbuild: clang: Disable -Wunused-const-variable warnings Prasad Sodagudi 0 siblings, 1 reply; 12+ messages in thread From: Masahiro Yamada @ 2017-12-18 15:32 UTC (permalink / raw) To: Sodagudi Prasad Cc: Greg Kroah-Hartman, Michal Marek, Greg Hackmann, Linux Kbuild mailing list, Linux Kernel Mailing List 2017-12-08 11:16 GMT+09:00 Sodagudi Prasad <psodagud@codeaurora.org>: > On 2017-12-06 22:26, Greg Kroah-Hartman wrote: >> >> On Wed, Dec 06, 2017 at 01:24:51PM -0800, Sodagudi Prasad wrote: >>> >>> >>> Hi All, >>> >>> When kernel compiled with clang, following line is disabling the >>> unused-variable warning. This is not the case with gcc. >>> KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) >>> >>> Are there any specific reasons for disabling unused-variable with clang? >> >> >> Try it and see why it is disabled :) > > > Hi Greg, > > When I have enabled -Wunused-variable warnings with clang, observed both > -Wunused-variable and -Wunused-const-variable as expected. > It looks that, -Wunused-const-variable warnings are disabled explicitly with > GCC as well. > commit - c9c6837d39311b0c - "kbuild: move -Wunused-const-variable to W=1 > warning level" > > I could see following warnings along with couple of -Wunused-variables > warnings with downstream code. > arch/arm64/crypto/sha1-ce-glue.c:118:1: warning: unused variable > 'cpu_feature_match_SHA1' [-Wunused-const-variable] > include/linux/cpufeature.h:48:33: note: expanded from macro > 'module_cpu_feature_match' > arch/arm64/crypto/sha2-ce-glue.c:148:1: warning: unused variable > 'cpu_feature_match_SHA2' [-Wunused-const-variable] > arch/arm64/crypto/ghash-ce-glue.c:597:33: warning: unused variable > 'ghash_cpu_feature' [-Wunused-const-variable] > arch/arm64/crypto/aes-ce-cipher.c:280:1: warning: unused variable > 'cpu_feature_match_AES' [-Wunused-const-variable] > arch/arm64/crypto/aes-glue.c:674:1: warning: unused variable > 'cpu_feature_match_AES' [-Wunused-const-variable] > kernel/trace/ftrace.c:1092:27: warning: unused variable 'ftrace_swapper_pid' > [-Wunused-const-variable] > drivers/usb/host/ehci-platform.c:406:36: warning: unused variable > 'ehci_acpi_match' [-Wunused-const-variable] > drivers/usb/host/xhci-plat.c:416:36: warning: unused variable > 'usb_xhci_acpi_match' [-Wunused-const-variable] > > So I have made following change and I will share patch for the same. > > diff --git a/Makefile b/Makefile > index 4e6da2f..8a6c14e 100644 > --- a/Makefile > +++ b/Makefile > @@ -711,7 +711,7 @@ endif > KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) -meabi gnu > KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) > KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) > -KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) > +KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) > KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) > KBUILD_CFLAGS += $(call cc-disable-warning, gnu) > KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) > > Please let me know if you have any concerns with this approach to identify > all unused local variables. > > -Thanks, Prasad This approach seems good, but KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) will be common for GCC and Clang. Please move it out of "ifeq ... else .. endif" -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] kbuild: clang: Disable -Wunused-const-variable warnings 2017-12-18 15:32 ` Masahiro Yamada @ 2018-01-27 0:59 ` Prasad Sodagudi 2018-01-28 16:22 ` Segher Boessenkool 0 siblings, 1 reply; 12+ messages in thread From: Prasad Sodagudi @ 2018-01-27 0:59 UTC (permalink / raw) To: gregkh, mmarek, ghackmann, yamada.masahiro Cc: psodagud, linux-kbuild, linux-kernel Disable -Wunused-const-variable warnings instead of disabling -Wunused-variable warnings, So that in both clang and GCC -Wunused-const-variable gets disabled. Currently with clang -Wunused-variable warnings are disabled and with gcc -Wunused-variable warnings are enabled, with this setting all unused local variable would be warned in clang as well. Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 339397b..c730338 100644 --- a/Makefile +++ b/Makefile @@ -698,7 +698,6 @@ KBUILD_CFLAGS += $(stackp-flag) ifeq ($(cc-name),clang) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) @@ -719,6 +718,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) endif +KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls else -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] kbuild: clang: Disable -Wunused-const-variable warnings 2018-01-27 0:59 ` [PATCH] kbuild: clang: Disable -Wunused-const-variable warnings Prasad Sodagudi @ 2018-01-28 16:22 ` Segher Boessenkool 2018-01-29 16:35 ` Sodagudi Prasad 0 siblings, 1 reply; 12+ messages in thread From: Segher Boessenkool @ 2018-01-28 16:22 UTC (permalink / raw) To: Prasad Sodagudi Cc: gregkh, mmarek, ghackmann, yamada.masahiro, linux-kbuild, linux-kernel On Fri, Jan 26, 2018 at 04:59:46PM -0800, Prasad Sodagudi wrote: > Disable -Wunused-const-variable warnings instead of > disabling -Wunused-variable warnings, So that in both > clang and GCC -Wunused-const-variable gets disabled. Why would you disable -Wunused-const-variable on GCC? You do not explain why. Segher ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] kbuild: clang: Disable -Wunused-const-variable warnings 2018-01-28 16:22 ` Segher Boessenkool @ 2018-01-29 16:35 ` Sodagudi Prasad 2018-01-29 17:08 ` Prasad Sodagudi 0 siblings, 1 reply; 12+ messages in thread From: Sodagudi Prasad @ 2018-01-29 16:35 UTC (permalink / raw) To: Segher Boessenkool Cc: gregkh, mmarek, ghackmann, yamada.masahiro, linux-kbuild, linux-kernel On 2018-01-28 08:22, Segher Boessenkool wrote: > On Fri, Jan 26, 2018 at 04:59:46PM -0800, Prasad Sodagudi wrote: >> Disable -Wunused-const-variable warnings instead of >> disabling -Wunused-variable warnings, So that in both >> clang and GCC -Wunused-const-variable gets disabled. > > Why would you disable -Wunused-const-variable on GCC? You do not > explain why. Hi Segher, Please check below discussion with Greg and Masahiro about "unused-variable". https://lkml.org/lkml/2017/12/18/697 Please check this link, "unused-const-variable" warning is already disabled for GCC. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Makefile?h=v4.15#n719 Below commit is disabling the "unused-const-variable" for GCC. commit - c9c6837d39311b0c - "kbuild: move -Wunused-const-variable to W=1 warning level" Currently "unused-variable" warnings are disabled for clang and not for the gcc. Disabling of "unused-variable" warning also disables "unused-const-variable" warning. To match same settings between clang and gcc, disabling "unused-const-variable" warnings for clang as well. So with this patch, keeping the same settings for GCC and CLANG with respect to "unused-const-variable". -Thanks, Prasad > > > Segher -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] kbuild: clang: Disable -Wunused-const-variable warnings 2018-01-29 16:35 ` Sodagudi Prasad @ 2018-01-29 17:08 ` Prasad Sodagudi 2018-01-29 23:57 ` Segher Boessenkool 2018-02-02 16:01 ` Masahiro Yamada 0 siblings, 2 replies; 12+ messages in thread From: Prasad Sodagudi @ 2018-01-29 17:08 UTC (permalink / raw) To: gregkh, segher, ghackmann, yamada.masahiro Cc: linux-kbuild, linux-kernel, Prasad Sodagudi Currently -Wunused-variable warnings are disabled with clang and with gcc -Wunused-variable warnings are enabled, with this setting all unused local variables would be warned in clang as well. Disable -Wunused-const-variable warnings instead of disabling -Wunused-variable warnings, So that in both clang and GCC -Wunused-const-variable gets disabled. Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org> --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 339397b..4b6c8e2 100644 --- a/Makefile +++ b/Makefile @@ -698,7 +698,6 @@ KBUILD_CFLAGS += $(stackp-flag) ifeq ($(cc-name),clang) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) @@ -716,9 +715,9 @@ else # These warnings generated too much noise in a regular build. # Use make W=1 to enable them (see scripts/Makefile.extrawarn) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) endif +KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls else -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] kbuild: clang: Disable -Wunused-const-variable warnings 2018-01-29 17:08 ` Prasad Sodagudi @ 2018-01-29 23:57 ` Segher Boessenkool 2018-02-02 16:01 ` Masahiro Yamada 1 sibling, 0 replies; 12+ messages in thread From: Segher Boessenkool @ 2018-01-29 23:57 UTC (permalink / raw) To: Prasad Sodagudi Cc: gregkh, ghackmann, yamada.masahiro, linux-kbuild, linux-kernel Hi Prasad, On Mon, Jan 29, 2018 at 09:08:00AM -0800, Prasad Sodagudi wrote: > --- a/Makefile > +++ b/Makefile > @@ -698,7 +698,6 @@ KBUILD_CFLAGS += $(stackp-flag) > > ifeq ($(cc-name),clang) > KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) > -KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) > KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) > KBUILD_CFLAGS += $(call cc-disable-warning, gnu) > KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) > @@ -716,9 +715,9 @@ else > # These warnings generated too much noise in a regular build. > # Use make W=1 to enable them (see scripts/Makefile.extrawarn) > KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) > -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) > endif > > +KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) > ifdef CONFIG_FRAME_POINTER > KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls > else Ah, much more obvious now, thanks :-) Segher ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] kbuild: clang: Disable -Wunused-const-variable warnings 2018-01-29 17:08 ` Prasad Sodagudi 2018-01-29 23:57 ` Segher Boessenkool @ 2018-02-02 16:01 ` Masahiro Yamada 2018-02-06 23:46 ` [PATCH] kbuild: clang: disable unused variable warnings only when constant Prasad Sodagudi 1 sibling, 1 reply; 12+ messages in thread From: Masahiro Yamada @ 2018-02-02 16:01 UTC (permalink / raw) To: Prasad Sodagudi Cc: Greg Kroah-Hartman, segher, Greg Hackmann, Linux Kbuild mailing list, Linux Kernel Mailing List 2018-01-30 2:08 GMT+09:00 Prasad Sodagudi <psodagud@codeaurora.org>: > Currently -Wunused-variable warnings are disabled with > clang and with gcc -Wunused-variable warnings are > enabled, with this setting all unused local variables > would be warned in clang as well. > > Disable -Wunused-const-variable warnings instead of > disabling -Wunused-variable warnings, So that in both > clang and GCC -Wunused-const-variable gets disabled. > > Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org> The code is OK, but I'd like to make the log even clearer. The commit subject "kbuild: clang: Disable -Wunused-const-variable warnings" sounds confusing. -Wunused-const-variable was already disabled for clang because it was implied by Wno-unused-variable. So, this patch is effectively enabling -Wunused-variable, right? How about something like follows? ------------------------->8--------------------------------------- kbuild: clang: disable unused variable warnings only when constant Currently, GCC disables -Wunused-const-variable, but not -Wunused-variable, so warns unused variables if they are non-constant. While, Clang does not warn unused variables at all regardless of the const qualifier because -Wno-unused-const-variable is implied by the stronger option -Wno-unused-variable. Disable -Wunused-const-variable instead of -Wunused-variable so that GCC and Clang work in the same way. --------------------------->8-------------------------------------- If it is tedious to resend, shall I reword the log locally? Let me your thought. > --- > Makefile | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index 339397b..4b6c8e2 100644 > --- a/Makefile > +++ b/Makefile > @@ -698,7 +698,6 @@ KBUILD_CFLAGS += $(stackp-flag) > > ifeq ($(cc-name),clang) > KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) > -KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) > KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) > KBUILD_CFLAGS += $(call cc-disable-warning, gnu) > KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) > @@ -716,9 +715,9 @@ else > # These warnings generated too much noise in a regular build. > # Use make W=1 to enable them (see scripts/Makefile.extrawarn) > KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) > -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) > endif > > +KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) > ifdef CONFIG_FRAME_POINTER > KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls > else > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project > -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] kbuild: clang: disable unused variable warnings only when constant 2018-02-02 16:01 ` Masahiro Yamada @ 2018-02-06 23:46 ` Prasad Sodagudi 2018-02-07 0:22 ` Masahiro Yamada 0 siblings, 1 reply; 12+ messages in thread From: Prasad Sodagudi @ 2018-02-06 23:46 UTC (permalink / raw) To: yamada.masahiro Cc: gregkh, segher, ghackmann, linux-kbuild, linux-kernel, Prasad Sodagudi Currently, GCC disables -Wunused-const-variable, but not -Wunused-variable, so warns unused variables if they are non-constant. While, Clang does not warn unused variables at all regardless of the const qualifier because -Wno-unused-const-variable is implied by the stronger option -Wno-unused-variable. Disable -Wunused-const-variable instead of -Wunused-variable so that GCC and Clang work in the same way. Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org> Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com> --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 11aff0f..ca0a571 100644 --- a/Makefile +++ b/Makefile @@ -700,7 +700,6 @@ KBUILD_CFLAGS += $(stackp-flag) ifeq ($(cc-name),clang) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) @@ -718,9 +717,9 @@ else # These warnings generated too much noise in a regular build. # Use make W=1 to enable them (see scripts/Makefile.extrawarn) KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) -KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) endif +KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable) ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls else -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] kbuild: clang: disable unused variable warnings only when constant 2018-02-06 23:46 ` [PATCH] kbuild: clang: disable unused variable warnings only when constant Prasad Sodagudi @ 2018-02-07 0:22 ` Masahiro Yamada 0 siblings, 0 replies; 12+ messages in thread From: Masahiro Yamada @ 2018-02-07 0:22 UTC (permalink / raw) To: Prasad Sodagudi Cc: Greg Kroah-Hartman, segher, Greg Hackmann, Linux Kbuild mailing list, Linux Kernel Mailing List 2018-02-07 8:46 GMT+09:00 Prasad Sodagudi <psodagud@codeaurora.org>: > Currently, GCC disables -Wunused-const-variable, but not > -Wunused-variable, so warns unused variables if they are > non-constant. > > While, Clang does not warn unused variables at all regardless of > the const qualifier because -Wno-unused-const-variable is implied > by the stronger option -Wno-unused-variable. > > Disable -Wunused-const-variable instead of -Wunused-variable so that > GCC and Clang work in the same way. > > Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org> > Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com> Applied to linux-kbuild/kbuild. Thanks! -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-02-07 0:22 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-12-06 21:24 unused-variable warning is getting disabled with clang Sodagudi Prasad 2017-12-07 6:26 ` Greg Kroah-Hartman 2017-12-08 2:16 ` Sodagudi Prasad 2017-12-18 15:32 ` Masahiro Yamada 2018-01-27 0:59 ` [PATCH] kbuild: clang: Disable -Wunused-const-variable warnings Prasad Sodagudi 2018-01-28 16:22 ` Segher Boessenkool 2018-01-29 16:35 ` Sodagudi Prasad 2018-01-29 17:08 ` Prasad Sodagudi 2018-01-29 23:57 ` Segher Boessenkool 2018-02-02 16:01 ` Masahiro Yamada 2018-02-06 23:46 ` [PATCH] kbuild: clang: disable unused variable warnings only when constant Prasad Sodagudi 2018-02-07 0:22 ` Masahiro Yamada
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).