[make][clang] Do not add unsupported warning flags
Currently, clang does not support the -Wno-nonnull-compare and -Wmaybe-uninitialized warning flags so this adds lots of unknown warning flag output for each compile job when not using GCC. This commit adds a makefile macro to check for supported warning flags and only adds them if the compiler actually supports them.
This commit is contained in:
committed by
Travis Geiselbrecht
parent
06a206f44e
commit
231f58903b
30
engine.mk
30
engine.mk
@@ -64,7 +64,7 @@ GLOBAL_INCLUDES := $(BUILDDIR) $(addsuffix /include,$(LKINC))
|
||||
GLOBAL_OPTFLAGS ?= $(ARCH_OPTFLAGS)
|
||||
GLOBAL_COMPILEFLAGS := -g -include $(CONFIGHEADER)
|
||||
GLOBAL_COMPILEFLAGS += -Wextra -Wall -Werror=return-type -Wshadow -Wdouble-promotion
|
||||
GLOBAL_COMPILEFLAGS += -Wno-multichar -Wno-unused-parameter -Wno-unused-function -Wno-unused-label -Wno-nonnull-compare
|
||||
GLOBAL_COMPILEFLAGS += -Wno-multichar -Wno-unused-parameter -Wno-unused-function -Wno-unused-label
|
||||
GLOBAL_COMPILEFLAGS += -fno-common
|
||||
GLOBAL_CFLAGS := --std=gnu11 -Werror-implicit-function-declaration -Wstrict-prototypes -Wwrite-strings
|
||||
GLOBAL_CPPFLAGS := --std=c++14 -fno-exceptions -fno-rtti -fno-threadsafe-statics
|
||||
@@ -181,6 +181,23 @@ ifndef TOOLCHAIN_PREFIX
|
||||
$(error TOOLCHAIN_PREFIX not set in the arch rules.mk)
|
||||
endif
|
||||
|
||||
# default to no ccache
|
||||
CCACHE ?=
|
||||
CC := $(CCACHE) $(TOOLCHAIN_PREFIX)gcc
|
||||
LD := $(TOOLCHAIN_PREFIX)ld
|
||||
OBJDUMP := $(TOOLCHAIN_PREFIX)objdump
|
||||
OBJCOPY := $(TOOLCHAIN_PREFIX)objcopy
|
||||
CPPFILT := $(TOOLCHAIN_PREFIX)c++filt
|
||||
SIZE := $(TOOLCHAIN_PREFIX)size
|
||||
NM := $(TOOLCHAIN_PREFIX)nm
|
||||
STRIP := $(TOOLCHAIN_PREFIX)strip
|
||||
|
||||
# Now that CC is defined we can check if warning flags are supported and add
|
||||
# them to GLOBAL_COMPILEFLAGS if they are.
|
||||
ifeq ($(call is_warning_flag_supported,-Wnonnull-compare),yes)
|
||||
GLOBAL_COMPILEFLAGS += -Wno-nonnull-compare
|
||||
endif
|
||||
|
||||
$(info PROJECT = $(PROJECT))
|
||||
$(info PLATFORM = $(PLATFORM))
|
||||
$(info TARGET = $(TARGET))
|
||||
@@ -230,17 +247,6 @@ ifneq ($(DEFINES),)
|
||||
$(error DEFINES variable set, please move to GLOBAL_DEFINES: $(DEFINES))
|
||||
endif
|
||||
|
||||
# default to no ccache
|
||||
CCACHE ?=
|
||||
CC := $(CCACHE) $(TOOLCHAIN_PREFIX)gcc
|
||||
LD := $(TOOLCHAIN_PREFIX)ld
|
||||
OBJDUMP := $(TOOLCHAIN_PREFIX)objdump
|
||||
OBJCOPY := $(TOOLCHAIN_PREFIX)objcopy
|
||||
CPPFILT := $(TOOLCHAIN_PREFIX)c++filt
|
||||
SIZE := $(TOOLCHAIN_PREFIX)size
|
||||
NM := $(TOOLCHAIN_PREFIX)nm
|
||||
STRIP := $(TOOLCHAIN_PREFIX)strip
|
||||
|
||||
# try to have the compiler output colorized error messages if available
|
||||
export GCC_COLORS ?= 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user