From: Michael Witten <mfwitten@gmail.com>
To: Masahiro Yamada <masahiroy@kernel.org>,
Michal Marek <michal.lkml@markovi.net>
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Sam Ravnborg <sam@ravnborg.org>,
linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: [PATCH] Makefile: Yes. Finally remove '-Wdeclaration-after-statement'
Date: Sun, 16 Aug 2020 16:35:00 -0000 [thread overview]
Message-ID: <c6fda26e8d134264b04fadc3386d6c32@gmail.com> (raw)
This is not just a matter of style; this is a matter of semantics,
especially with regard to:
* const Correctness.
A const-declared variable must be initialized when defined.
* Conditional Compilation.
When there is complex interaction between compile-time
configuration options, it's essential to be able to
make declarations where needed; otherwise unnecessary
gymnastics are required to silence the compiler.
Gentleman... Just let people say exactly what they mean to say.
Requiring every declaration to be at the top of a block is an
antiquated, vestigial naivete from a time when C was just a
glorified abstraction over conventional patterns in assembly
programming.
We are not just programming anymore. We are now encoding our
very thoughts, and thus we need this expressiveness in order
to capture those thoughts with sufficient clarity.
Therefore, this commit removes:
-Wdeclaration-after-statement
Signed-off-by: Michael Witten <mfwitten@gmail.com>
---
Makefile | 3 ---
arch/arm64/kernel/vdso32/Makefile | 1 -
tools/power/acpi/Makefile.config | 1 -
tools/power/cpupower/Makefile | 1 -
tools/scripts/Makefile.include | 1 -
5 files changed, 7 deletions(-)
diff --git a/Makefile b/Makefile
index 254e80a96b23..88ad4e430834 100644
--- a/Makefile
+++ b/Makefile
@@ -900,9 +900,6 @@ endif
# arch Makefile may override CC so keep this after arch Makefile is included
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
-# warn about C99 declaration after statement
-KBUILD_CFLAGS += -Wdeclaration-after-statement
-
# Variable Length Arrays (VLAs) should not be used anywhere in the kernel
KBUILD_CFLAGS += -Wvla
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 5139a5f19256..672008c735fb 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -88,7 +88,6 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-std=gnu89
VDSO_CFLAGS += -O2
# Some useful compiler-dependent flags from top-level Makefile
-VDSO_CFLAGS += $(call cc32-option,-Wdeclaration-after-statement,)
VDSO_CFLAGS += $(call cc32-option,-Wno-pointer-sign)
VDSO_CFLAGS += $(call cc32-option,-fno-strict-overflow)
VDSO_CFLAGS += $(call cc32-option,-Werror=strict-prototypes)
diff --git a/tools/power/acpi/Makefile.config b/tools/power/acpi/Makefile.config
index 54a2857c2510..70ac50cfd7eb 100644
--- a/tools/power/acpi/Makefile.config
+++ b/tools/power/acpi/Makefile.config
@@ -64,7 +64,6 @@ OPTIMIZATION := $(call cc-supports,-Os,-O2)
WARNINGS := -Wall
WARNINGS += $(call cc-supports,-Wstrict-prototypes)
-WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
KERNEL_INCLUDE := $(OUTPUT)include
ACPICA_INCLUDE := $(srctree)/../../../drivers/acpi/acpica
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index c8622497ef23..d389179d4484 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -118,7 +118,6 @@ OPTIMIZATION := $(call cc-supports,-Os,-O2)
WARNINGS := -Wall -Wchar-subscripts -Wpointer-arith -Wsign-compare
WARNINGS += $(call cc-supports,-Wno-pointer-sign)
-WARNINGS += $(call cc-supports,-Wdeclaration-after-statement)
WARNINGS += -Wshadow
override CFLAGS += -DVERSION=\"$(VERSION)\" -DPACKAGE=\"$(PACKAGE)\" \
diff --git a/tools/scripts/Makefile.include b/tools/scripts/Makefile.include
index a7974638561c..83c2a5a1ed15 100644
--- a/tools/scripts/Makefile.include
+++ b/tools/scripts/Makefile.include
@@ -21,7 +21,6 @@ endif
# Include saner warnings here, which can catch bugs:
#
EXTRA_WARNINGS := -Wbad-function-cast
-EXTRA_WARNINGS += -Wdeclaration-after-statement
EXTRA_WARNINGS += -Wformat-security
EXTRA_WARNINGS += -Wformat-y2k
EXTRA_WARNINGS += -Winit-self
--
2.22.0
next reply other threads:[~2020-08-16 16:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-16 16:35 Michael Witten [this message]
2020-08-16 17:53 ` [PATCH] Makefile: Yes. Finally remove '-Wdeclaration-after-statement' Al Viro
2020-08-17 20:42 ` Pavel Machek
2020-08-17 21:12 ` Eric W. Biederman
2020-08-17 21:29 ` Linus Torvalds
2020-08-17 22:09 ` Pavel Machek
2020-08-17 22:12 ` Linus Torvalds
2020-08-18 5:17 ` Ingo Molnar
2020-08-18 8:56 ` David Laight
2020-08-16 17:56 ` Joe Perches
2020-08-17 3:37 ` Michael Witten
2020-08-17 4:19 ` Joe Perches
2020-08-17 11:40 ` Michael Witten
2020-08-17 20:38 ` Pavel Machek
2020-08-18 22:05 ` Michael Witten
2020-08-19 21:15 ` Michael Witten
2020-08-20 0:15 ` [RFC v2] kbuild: Introduce "Warnings for maintainers" Michael Witten
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c6fda26e8d134264b04fadc3386d6c32@gmail.com \
--to=mfwitten@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=michal.lkml@markovi.net \
--cc=sam@ravnborg.org \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.