diff mbox series

[6/9] extrawarn: move -Wrestrict into W=1 warnings

Message ID 20230811140327.3754597-7-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series Kbuild: warning options cleanup and more warnings | expand

Commit Message

Arnd Bergmann Aug. 11, 2023, 2:03 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

There are few of these, so enable them whenever W=1 is enabled.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 scripts/Makefile.extrawarn | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Masahiro Yamada Aug. 12, 2023, 1:20 p.m. UTC | #1
On Sat, Aug 12, 2023 at 4:40 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> There are few of these, so enable them whenever W=1 is enabled.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  scripts/Makefile.extrawarn | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index ec528972371fa..8abe90270b335 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -54,9 +54,6 @@ KBUILD_CFLAGS += -Wno-pointer-sign
>  # globally built with -Wcast-function-type.
>  KBUILD_CFLAGS += $(call cc-option, -Wcast-function-type)
>
> -# Another good warning that we'll want to enable eventually
> -KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
> -
>  # The allocators already balk at large sizes, so silence the compiler
>  # warnings for bounds checks involving those possible values. While
>  # -Wno-alloc-size-larger-than would normally be used here, earlier versions
> @@ -99,6 +96,7 @@ ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
>
>  KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
>  KBUILD_CFLAGS += -Wmissing-declarations
> +KBUILD_CFLAGS += $(call cc-option, -Wrestrict)


Like the previous patch, -Wall implies -Wrestrict.

I'd like to remove it as we can save cc-option call.




>  KBUILD_CFLAGS += -Wmissing-format-attribute
>  KBUILD_CFLAGS += -Wmissing-prototypes
>  KBUILD_CFLAGS += -Wold-style-definition
> @@ -120,6 +118,7 @@ else
>  # Suppress them by using -Wno... except for W=1.
>  KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
>  KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
> +KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
>  KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
>  KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
>  KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
> --
> 2.39.2
>
Masahiro Yamada Aug. 20, 2023, 1:45 a.m. UTC | #2
On Sat, Aug 12, 2023 at 4:40 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> There are few of these, so enable them whenever W=1 is enabled.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  scripts/Makefile.extrawarn | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index ec528972371fa..8abe90270b335 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -54,9 +54,6 @@ KBUILD_CFLAGS += -Wno-pointer-sign
>  # globally built with -Wcast-function-type.
>  KBUILD_CFLAGS += $(call cc-option, -Wcast-function-type)
>
> -# Another good warning that we'll want to enable eventually
> -KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
> -
>  # The allocators already balk at large sizes, so silence the compiler
>  # warnings for bounds checks involving those possible values. While
>  # -Wno-alloc-size-larger-than would normally be used here, earlier versions
> @@ -99,6 +96,7 @@ ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
>
>  KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
>  KBUILD_CFLAGS += -Wmissing-declarations
> +KBUILD_CFLAGS += $(call cc-option, -Wrestrict)
>  KBUILD_CFLAGS += -Wmissing-format-attribute
>  KBUILD_CFLAGS += -Wmissing-prototypes
>  KBUILD_CFLAGS += -Wold-style-definition
> @@ -120,6 +118,7 @@ else
>  # Suppress them by using -Wno... except for W=1.
>  KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
>  KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
> +KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
>  KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
>  KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
>  KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
> --
> 2.39.2
>

Applied  to linux-kbuild. Thanks.
diff mbox series

Patch

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index ec528972371fa..8abe90270b335 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -54,9 +54,6 @@  KBUILD_CFLAGS += -Wno-pointer-sign
 # globally built with -Wcast-function-type.
 KBUILD_CFLAGS += $(call cc-option, -Wcast-function-type)
 
-# Another good warning that we'll want to enable eventually
-KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
-
 # The allocators already balk at large sizes, so silence the compiler
 # warnings for bounds checks involving those possible values. While
 # -Wno-alloc-size-larger-than would normally be used here, earlier versions
@@ -99,6 +96,7 @@  ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
 
 KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
 KBUILD_CFLAGS += -Wmissing-declarations
+KBUILD_CFLAGS += $(call cc-option, -Wrestrict)
 KBUILD_CFLAGS += -Wmissing-format-attribute
 KBUILD_CFLAGS += -Wmissing-prototypes
 KBUILD_CFLAGS += -Wold-style-definition
@@ -120,6 +118,7 @@  else
 # Suppress them by using -Wno... except for W=1.
 KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
 KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
+KBUILD_CFLAGS += $(call cc-disable-warning, restrict)
 KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)