[1/8] auto, kbuild: flatten KBUILD_CFLAGS

Message ID 20230518154648.581643-1-adobriyan@gmail.com
State New
Headers
Series [1/8] auto, kbuild: flatten KBUILD_CFLAGS |

Commit Message

Alexey Dobriyan May 18, 2023, 3:46 p.m. UTC
  Make it slightly easier to see what compiler options are added and
removed (and not worry about column limit too!)

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
 Makefile | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
  

Comments

Andrew Morton May 18, 2023, 8:37 p.m. UTC | #1
On Thu, 18 May 2023 18:46:42 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:

> Make it slightly easier to see what compiler options are added and
> removed (and not worry about column limit too!)

I wish you'd cc'ed Linus.

Turning those four upper-cased macros into upper-cased inline functions
is just sad.  If we're going to do this we surely should go around and
make them lower-case.
  
Alexey Dobriyan May 19, 2023, 11:15 a.m. UTC | #2
On Thu, May 18, 2023 at 01:37:32PM -0700, Andrew Morton wrote:
> On Thu, 18 May 2023 18:46:42 +0300 Alexey Dobriyan <adobriyan@gmail.com> wrote:
> 
> > Make it slightly easier to see what compiler options are added and
> > removed (and not worry about column limit too!)
> 
> I wish you'd cc'ed Linus.
> 
> Turning those four upper-cased macros into upper-cased inline functions
> is just sad.  If we're going to do this we surely should go around and
> make them lower-case.

I always wanted to rewrite division functions and get rid of our
countless variants:

	q = kdiv(n, d);
	q = kdiv3(n, d, &r);

if it gets in they will be renamed again :-)
  

Patch

diff --git a/Makefile b/Makefile
index f836936fb4d8..10fcc64fcd1f 100644
--- a/Makefile
+++ b/Makefile
@@ -554,11 +554,23 @@  LINUXINCLUDE    := \
 		$(USERINCLUDE)
 
 KBUILD_AFLAGS   := -D__ASSEMBLY__ -fno-PIE
-KBUILD_CFLAGS   := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
-		   -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
-		   -Werror=implicit-function-declaration -Werror=implicit-int \
-		   -Werror=return-type -Wno-format-security -funsigned-char \
-		   -std=gnu11
+
+KBUILD_CFLAGS :=
+KBUILD_CFLAGS += -std=gnu11
+KBUILD_CFLAGS += -fshort-wchar
+KBUILD_CFLAGS += -funsigned-char
+KBUILD_CFLAGS += -fno-common
+KBUILD_CFLAGS += -fno-PIE
+KBUILD_CFLAGS += -fno-strict-aliasing
+KBUILD_CFLAGS += -Wall
+KBUILD_CFLAGS += -Wundef
+KBUILD_CFLAGS += -Werror=implicit-function-declaration
+KBUILD_CFLAGS += -Werror=implicit-int
+KBUILD_CFLAGS += -Werror=return-type
+KBUILD_CFLAGS += -Werror=strict-prototypes
+KBUILD_CFLAGS += -Wno-format-security
+KBUILD_CFLAGS += -Wno-trigraphs
+
 KBUILD_CPPFLAGS := -D__KERNEL__
 KBUILD_RUSTFLAGS := $(rust_common_flags) \
 		    --target=$(objtree)/scripts/target.json \