Re: [PATCH] kbuild: flatten KBUILD_CFLAGS

From: Nicolas Schier
Date: Fri Jul 14 2023 - 06:43:05 EST


On Thu, Jul 13, 2023 at 09:52:28PM +0300, Alexey Dobriyan wrote:
> Make it slightly easier to see which compiler options are added and
> removed (and not worry about column limit too!).
>
> Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
> ---
>
> Makefile | 22 +++++++++++++++++-----
> 1 file changed, 17 insertions(+), 5 deletions(-)
>
> --- a/Makefile
> +++ b/Makefile
> @@ -555,11 +555,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

If you want to put -std at top, on contrast to the sorted options below,
you could also merge the two lines above.

> +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 \

Thanks for the patch.

Reviewed-by: Nicolas Schier <n.schier@xxxxxx>

--
epost|xmpp: nicolas@xxxxxxxxx irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb c82b 7d97 0932 55a0 ce7f
-- frykten for herren er opphav til kunnskap --

Attachment: signature.asc
Description: PGP signature