Skip to content

Commit bad14b5

Browse files
committed
Remove legacy 'cc-disable-warning' use from the generic build scripts
This just converts the 'cc-disable-warning' uses in the generic makefile extrawarn script to use the plain 'cc-option' form instead. Partly to clean things up, and partly just to have the new form get some proper test coverage. I'll leave the various random other uses of 'cc-disable-warning' alone and let subsystem maintainers decide if they want to convert to the new unified model. Signed-off-by: Linus Torvalds <[email protected]>
1 parent 550ccb1 commit bad14b5

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

scripts/Makefile.extrawarn

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ KBUILD_CFLAGS += -Werror=return-type
1616
KBUILD_CFLAGS += -Werror=strict-prototypes
1717
KBUILD_CFLAGS += -Wno-format-security
1818
KBUILD_CFLAGS += -Wno-trigraphs
19-
KBUILD_CFLAGS += $(call cc-disable-warning, frame-address)
20-
KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
19+
KBUILD_CFLAGS += $(call cc-option, -Wno-frame-address)
20+
KBUILD_CFLAGS += $(call cc-option, -Wno-address-of-packed-member)
2121
KBUILD_CFLAGS += -Wmissing-declarations
2222
KBUILD_CFLAGS += -Wmissing-prototypes
2323

@@ -35,8 +35,8 @@ KBUILD_CFLAGS += -Wno-gnu
3535

3636
# Clang checks for overflow/truncation with '%p', while GCC does not:
3737
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111219
38-
KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow-non-kprintf)
39-
KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation-non-kprintf)
38+
KBUILD_CFLAGS += $(call cc-option, -Wno-format-overflow-non-kprintf)
39+
KBUILD_CFLAGS += $(call cc-option, -Wno-format-truncation-non-kprintf)
4040

4141
# Clang may emit a warning when a const variable, such as the dummy variables
4242
# in typecheck(), or const member of an aggregate type are not initialized,
@@ -48,15 +48,15 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation-non-kprintf)
4848
# disabled with this same switch, there should not be too much coverage lost
4949
# because -Wuninitialized will still flag when an uninitialized const variable
5050
# is used.
51-
KBUILD_CFLAGS += $(call cc-disable-warning, default-const-init-unsafe)
51+
KBUILD_CFLAGS += $(call cc-option, -Wno-default-const-init-unsafe)
5252
else
5353

5454
# gcc inanely warns about local variables called 'main'
5555
KBUILD_CFLAGS += -Wno-main
5656
endif
5757

5858
# These result in bogus false positives
59-
KBUILD_CFLAGS += $(call cc-disable-warning, dangling-pointer)
59+
KBUILD_CFLAGS += $(call cc-option, -Wno-dangling-pointer)
6060

6161
# Variable Length Arrays (VLAs) should not be used anywhere in the kernel
6262
KBUILD_CFLAGS += -Wvla
@@ -70,11 +70,11 @@ KBUILD_CFLAGS += -Wno-pointer-sign
7070
KBUILD_CFLAGS += $(call cc-option, -Wcast-function-type)
7171

7272
# Currently, disable -Wstringop-overflow for GCC 11, globally.
73-
KBUILD_CFLAGS-$(CONFIG_CC_NO_STRINGOP_OVERFLOW) += $(call cc-disable-warning, stringop-overflow)
73+
KBUILD_CFLAGS-$(CONFIG_CC_NO_STRINGOP_OVERFLOW) += $(call cc-option, -Wno-stringop-overflow)
7474
KBUILD_CFLAGS-$(CONFIG_CC_STRINGOP_OVERFLOW) += $(call cc-option, -Wstringop-overflow)
7575

7676
# Currently, disable -Wunterminated-string-initialization as broken
77-
KBUILD_CFLAGS += $(call cc-disable-warning, unterminated-string-initialization)
77+
KBUILD_CFLAGS += $(call cc-option, -Wno-unterminated-string-initialization)
7878

7979
# The allocators already balk at large sizes, so silence the compiler
8080
# warnings for bounds checks involving those possible values. While
@@ -120,14 +120,14 @@ else
120120

121121
# Some diagnostics enabled by default are noisy.
122122
# Suppress them by using -Wno... except for W=1.
123-
KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
124-
KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
125-
KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned)
126-
KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
123+
KBUILD_CFLAGS += $(call cc-option, -Wno-unused-but-set-variable)
124+
KBUILD_CFLAGS += $(call cc-option, -Wno-unused-const-variable)
125+
KBUILD_CFLAGS += $(call cc-option, -Wno-packed-not-aligned)
126+
KBUILD_CFLAGS += $(call cc-option, -Wno-format-overflow)
127127
ifdef CONFIG_CC_IS_GCC
128-
KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
128+
KBUILD_CFLAGS += $(call cc-option, -Wno-format-truncation)
129129
endif
130-
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
130+
KBUILD_CFLAGS += $(call cc-option, -Wno-stringop-truncation)
131131

132132
KBUILD_CFLAGS += -Wno-override-init # alias for -Wno-initializer-overrides in clang
133133

@@ -145,9 +145,9 @@ ifeq ($(call clang-min-version, 120000),y)
145145
KBUILD_CFLAGS += -Wformat-insufficient-args
146146
endif
147147
endif
148-
KBUILD_CFLAGS += $(call cc-disable-warning, pointer-to-enum-cast)
148+
KBUILD_CFLAGS += $(call cc-option, -Wno-pointer-to-enum-cast)
149149
KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare
150-
KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access)
150+
KBUILD_CFLAGS += $(call cc-option, -Wno-unaligned-access)
151151
KBUILD_CFLAGS += -Wno-enum-compare-conditional
152152
endif
153153

0 commit comments

Comments
 (0)