From 87c31609f40c98203bbc9c30117a15a9342b2d4c Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 2 Jan 2024 09:01:32 +0000 Subject: Makefile.flags: suppress clang warnings when cross-compiling Extend the changes introduced by commit b4ef2e3467 (Makefile.flags: suppress some clang-9 warnings) so they also cover the case where clang is used as a cross-compiler. Signed-off-by: Ron Yorston Signed-off-by: Denys Vlasenko --- Makefile.flags | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.flags b/Makefile.flags index e4cd658fd..97cb4dca2 100644 --- a/Makefile.flags +++ b/Makefile.flags @@ -48,7 +48,7 @@ endif # gcc 3.x emits bogus "old style proto" warning on find.c:alloc_action() CFLAGS += $(call cc-ifversion, -ge, 0400, -Wold-style-definition) -ifneq ($(CC),clang) +ifneq ($(lastword $(subst -, ,$(CC))),clang) # "clang-9: warning: optimization flag '-finline-limit=0' is not supported CFLAGS += $(call cc-option,-finline-limit=0,) endif @@ -66,7 +66,7 @@ CFLAGS += $(call cc-option,-static-libgcc,) endif CFLAGS += $(call cc-option,-falign-functions=1,) -ifneq ($(CC),clang) +ifneq ($(lastword $(subst -, ,$(CC))),clang) # "clang-9: warning: optimization flag '-falign-jumps=1' is not supported" (and same for other two) CFLAGS += $(call cc-option,-falign-jumps=1 -falign-labels=1 -falign-loops=1,) endif @@ -79,7 +79,7 @@ CFLAGS += $(call cc-option,-fno-asynchronous-unwind-tables,) CFLAGS += $(call cc-option,-fno-builtin-printf,) # clang-9 does not like "str" + N and "if (CONFIG_ITEM && cond)" constructs -ifeq ($(CC),clang) +ifeq ($(lastword $(subst -, ,$(CC))),clang) CFLAGS += $(call cc-option,-Wno-string-plus-int -Wno-constant-logical-operand) endif -- cgit v1.2.3-55-g6feb