linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block
@ 2021-08-16 20:20 Nathan Chancellor
  2021-08-16 20:20 ` [PATCH 2/3] kbuild: Add a comment above -Wno-gnu Nathan Chancellor
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Nathan Chancellor @ 2021-08-16 20:20 UTC (permalink / raw)
  To: Masahiro Yamada, Nick Desaulniers
  Cc: linux-kbuild, linux-kernel, clang-built-linux, Nathan Chancellor

Turning on -Wformat does not reveal any instances of this warning across
several different builds so remove this line to keep the number of
disabled warnings as slim as possible.

This has been disabled since commit 61163efae020 ("kbuild: LLVMLinux:
Add Kbuild support for building kernel with Clang"), which does not
explain exactly why it was turned off but since it was so long ago in
terms of both the kernel and LLVM so it is possible that some bug got
fixed along the way.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Makefile b/Makefile
index 891866af0787..3900f5824721 100644
--- a/Makefile
+++ b/Makefile
@@ -777,7 +777,6 @@ KBUILD_CFLAGS += $(stackp-flags-y)
 
 ifdef CONFIG_CC_IS_CLANG
 KBUILD_CPPFLAGS += -Qunused-arguments
-KBUILD_CFLAGS += -Wno-format-invalid-specifier
 KBUILD_CFLAGS += -Wno-gnu
 # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
 # source of a reference will be _MergedGlobals and not on of the whitelisted names.

base-commit: f12b034afeb3a977bbb1c6584dedc0f3dc666f14
-- 
2.33.0.rc2


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

* [PATCH 2/3] kbuild: Add a comment above -Wno-gnu
  2021-08-16 20:20 [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block Nathan Chancellor
@ 2021-08-16 20:20 ` Nathan Chancellor
  2021-08-16 20:20 ` [PATCH 3/3] kbuild: Shuffle blank line to improve comment meaning Nathan Chancellor
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2021-08-16 20:20 UTC (permalink / raw)
  To: Masahiro Yamada, Nick Desaulniers
  Cc: linux-kbuild, linux-kernel, clang-built-linux, Nathan Chancellor

Whenever a warning is disabled, it is helpful for future travelers to
understand why the warning is disabled and why it is acceptable to do
so. Add a comment for -Wno-gnu so that people understand why it is
disabled.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 3900f5824721..07b76274396e 100644
--- a/Makefile
+++ b/Makefile
@@ -777,6 +777,7 @@ KBUILD_CFLAGS += $(stackp-flags-y)
 
 ifdef CONFIG_CC_IS_CLANG
 KBUILD_CPPFLAGS += -Qunused-arguments
+# The kernel builds with '-std=gnu89' so use of GNU extensions is acceptable.
 KBUILD_CFLAGS += -Wno-gnu
 # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
 # source of a reference will be _MergedGlobals and not on of the whitelisted names.
-- 
2.33.0.rc2


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

* [PATCH 3/3] kbuild: Shuffle blank line to improve comment meaning
  2021-08-16 20:20 [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block Nathan Chancellor
  2021-08-16 20:20 ` [PATCH 2/3] kbuild: Add a comment above -Wno-gnu Nathan Chancellor
@ 2021-08-16 20:20 ` Nathan Chancellor
  2021-08-16 21:39 ` [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block Nick Desaulniers
  2021-08-19  0:16 ` Masahiro Yamada
  3 siblings, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2021-08-16 20:20 UTC (permalink / raw)
  To: Masahiro Yamada, Nick Desaulniers
  Cc: linux-kbuild, linux-kernel, clang-built-linux, Nathan Chancellor

-Wunused-but-set-variable and -Wunused-const-variable are both disabled
for the same reason but there is a blank line between them and no blank
line between -Wno-unused-const-variable and the block.

Shuffle the new line so that it is clear that the comment applied to
both flags and the next block is separate from them.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 07b76274396e..7d5007cdfa5c 100644
--- a/Makefile
+++ b/Makefile
@@ -794,8 +794,8 @@ endif
 # 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)
+
 ifdef CONFIG_FRAME_POINTER
 KBUILD_CFLAGS	+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
 else
-- 
2.33.0.rc2


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

* Re: [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block
  2021-08-16 20:20 [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block Nathan Chancellor
  2021-08-16 20:20 ` [PATCH 2/3] kbuild: Add a comment above -Wno-gnu Nathan Chancellor
  2021-08-16 20:20 ` [PATCH 3/3] kbuild: Shuffle blank line to improve comment meaning Nathan Chancellor
@ 2021-08-16 21:39 ` Nick Desaulniers
  2021-08-19  0:16 ` Masahiro Yamada
  3 siblings, 0 replies; 5+ messages in thread
From: Nick Desaulniers @ 2021-08-16 21:39 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, linux-kbuild, linux-kernel, clang-built-linux

On Mon, Aug 16, 2021 at 1:21 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Turning on -Wformat does not reveal any instances of this warning across
> several different builds so remove this line to keep the number of
> disabled warnings as slim as possible.
>
> This has been disabled since commit 61163efae020 ("kbuild: LLVMLinux:
> Add Kbuild support for building kernel with Clang"), which does not
> explain exactly why it was turned off but since it was so long ago in
> terms of both the kernel and LLVM so it is possible that some bug got
> fixed along the way.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

I ran a few builds with this patch applied and didn't spot any
instances of this warning. We can always bring it back if necessary.
Thanks for the patch.
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

> ---
>  Makefile | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 891866af0787..3900f5824721 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -777,7 +777,6 @@ KBUILD_CFLAGS += $(stackp-flags-y)
>
>  ifdef CONFIG_CC_IS_CLANG
>  KBUILD_CPPFLAGS += -Qunused-arguments
> -KBUILD_CFLAGS += -Wno-format-invalid-specifier
>  KBUILD_CFLAGS += -Wno-gnu
>  # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
>  # source of a reference will be _MergedGlobals and not on of the whitelisted names.
>
> base-commit: f12b034afeb3a977bbb1c6584dedc0f3dc666f14
> --
> 2.33.0.rc2
>


-- 
Thanks,
~Nick Desaulniers

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

* Re: [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block
  2021-08-16 20:20 [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block Nathan Chancellor
                   ` (2 preceding siblings ...)
  2021-08-16 21:39 ` [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block Nick Desaulniers
@ 2021-08-19  0:16 ` Masahiro Yamada
  3 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2021-08-19  0:16 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nick Desaulniers, Linux Kbuild mailing list,
	Linux Kernel Mailing List, clang-built-linux

On Tue, Aug 17, 2021 at 5:21 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Turning on -Wformat does not reveal any instances of this warning across
> several different builds so remove this line to keep the number of
> disabled warnings as slim as possible.
>
> This has been disabled since commit 61163efae020 ("kbuild: LLVMLinux:
> Add Kbuild support for building kernel with Clang"), which does not
> explain exactly why it was turned off but since it was so long ago in
> terms of both the kernel and LLVM so it is possible that some bug got
> fixed along the way.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---


All applied to linux-kbuild. Thanks.

-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2021-08-19  0:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 20:20 [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block Nathan Chancellor
2021-08-16 20:20 ` [PATCH 2/3] kbuild: Add a comment above -Wno-gnu Nathan Chancellor
2021-08-16 20:20 ` [PATCH 3/3] kbuild: Shuffle blank line to improve comment meaning Nathan Chancellor
2021-08-16 21:39 ` [PATCH 1/3] kbuild: Remove -Wno-format-invalid-specifier from clang block Nick Desaulniers
2021-08-19  0:16 ` 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).