Skip to content

Commit b5ec6fd

Browse files
author
Peter Zijlstra
committed
kbuild: Drop -Wdeclaration-after-statement
With the advent on scope-based resource management it comes really tedious to abide by the contraints of -Wdeclaration-after-statement. It will still be recommeneded to place declarations at the start of a scope where possible, but it will no longer be enforced. Suggested-by: Linus Torvalds <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/CAHk-%3Dwi-RyoUhbChiVaJZoZXheAwnJ7OO%3DGxe85BkPAd93TwDA%40mail.gmail.com
1 parent 54da6a0 commit b5ec6fd

File tree

2 files changed

+1
-7
lines changed

2 files changed

+1
-7
lines changed

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,7 @@ HOSTRUSTC = rustc
447447
HOSTPKG_CONFIG = pkg-config
448448

449449
KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
450-
-O2 -fomit-frame-pointer -std=gnu11 \
451-
-Wdeclaration-after-statement
450+
-O2 -fomit-frame-pointer -std=gnu11
452451
KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
453452
KBUILD_USERLDFLAGS := $(USERLDFLAGS)
454453

@@ -1012,9 +1011,6 @@ endif
10121011
# arch Makefile may override CC so keep this after arch Makefile is included
10131012
NOSTDINC_FLAGS += -nostdinc
10141013

1015-
# warn about C99 declaration after statement
1016-
KBUILD_CFLAGS += -Wdeclaration-after-statement
1017-
10181014
# Variable Length Arrays (VLAs) should not be used anywhere in the kernel
10191015
KBUILD_CFLAGS += -Wvla
10201016

arch/arm64/kernel/vdso32/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,9 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
6565
-fno-strict-aliasing -fno-common \
6666
-Werror-implicit-function-declaration \
6767
-Wno-format-security \
68-
-Wdeclaration-after-statement \
6968
-std=gnu11
7069
VDSO_CFLAGS += -O2
7170
# Some useful compiler-dependent flags from top-level Makefile
72-
VDSO_CFLAGS += $(call cc32-option,-Wdeclaration-after-statement,)
7371
VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
7472
VDSO_CFLAGS += -fno-strict-overflow
7573
VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)

0 commit comments

Comments
 (0)