mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
makefiles/cflags.inc.mk: Use a template for CFLAGS testing
This commit is contained in:
parent
a71ef652e7
commit
843cec5cbd
@ -25,21 +25,23 @@ ifeq ($(shell $(CC) -fno-delete-null-pointer-checks -E - 2>/dev/null >/dev/null
|
||||
endif
|
||||
endif
|
||||
|
||||
# Template for testing a compiler flag and adding it to CFLAGS (errors usually
|
||||
# happens when using older toolchains which do not support the given flags)
|
||||
define cflags_test_and_add
|
||||
ifeq ($(shell $(CC) $(1) -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
|
||||
CFLAGS += $(1)
|
||||
endif
|
||||
endef
|
||||
# Use colored compiler output if the compiler supports this and if this is not
|
||||
# disabled by the user
|
||||
ifeq ($(CC_NOCOLOR),0)
|
||||
ifeq ($(shell $(CC) -fdiagnostics-color -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
|
||||
CFLAGS += -fdiagnostics-color
|
||||
endif
|
||||
$(eval $(call cflags_test_and_add,-fdiagnostics-color))
|
||||
endif
|
||||
|
||||
# Fast-out on old style function definitions.
|
||||
# They cause unreadable error compiler errors on missing semicolons.
|
||||
# Worse yet they hide errors by accepting wildcard argument types.
|
||||
ifeq ($(shell $(CC) -Wstrict-prototypes -Werror=strict-prototypes -Wold-style-definition -Werror=old-style-definition -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
|
||||
# duplicated parameters don't hurt
|
||||
CFLAGS += -Wstrict-prototypes -Wold-style-definition
|
||||
endif
|
||||
$(foreach flag,-Wstrict-prototypes -Wold-style-definition,$(eval $(call cflags_test_and_add,$(flag))))
|
||||
|
||||
# Unwanted flags for c++
|
||||
CXXUWFLAGS += -std=%
|
||||
|
Loading…
Reference in New Issue
Block a user