build system: Add a compatible old GCC flag

This commit is contained in:
Anton Maklakov 2018-08-30 11:24:34 +08:00
parent 51c9b6b82d
commit 9a55557ad8
9 changed files with 40 additions and 8 deletions

View File

@ -17,8 +17,10 @@ COMPONENT_ADD_LINKER_DEPS := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS))
COMPONENT_SUBMODULES += lib
ifeq ($(GCC_NOT_5_2_0), 1)
# TODO: annotate fallthroughs in Bluedroid code with comments
CFLAGS += -Wno-implicit-fallthrough
endif
endif
@ -118,9 +120,11 @@ COMPONENT_SRCDIRS += bluedroid/bta/dm \
bluedroid/api \
bluedroid
ifeq ($(GCC_NOT_5_2_0), 1)
bluedroid/bta/sdp/bta_sdp_act.o: CFLAGS += -Wno-unused-const-variable
bluedroid/btc/core/btc_config.o: CFLAGS += -Wno-unused-const-variable
bluedroid/stack/btm/btm_sec.o: CFLAGS += -Wno-unused-const-variable
bluedroid/stack/smp/smp_keys.o: CFLAGS += -Wno-unused-const-variable
endif
endif

View File

@ -12,5 +12,7 @@ COMPONENT_SUBMODULES += libcoap
libcoap/src/debug.o: CFLAGS += -Wno-write-strings
libcoap/src/pdu.o: CFLAGS += -Wno-write-strings
ifeq ($(GCC_NOT_5_2_0), 1)
# Temporary suppress "fallthrough" warnings until they are fixed in libcoap repo
libcoap/src/option.o: CFLAGS += -Wno-implicit-fallthrough
endif

View File

@ -6,7 +6,8 @@ COMPONENT_ADD_INCLUDEDIRS := expat/expat/lib port/include
COMPONENT_SRCDIRS := expat/expat/lib port
CFLAGS += -DHAVE_EXPAT_CONFIG_H -DHAVE_GETRANDOM
ifeq ($(GCC_NOT_5_2_0), 1)
# Temporary suppress "fallthrough" warnings until they are fixed in expat repo
CFLAGS += -Wno-implicit-fallthrough
endif
COMPONENT_SUBMODULES += expat

View File

@ -87,6 +87,8 @@ CFLAGS += -DNATIVE_LITTLE_ENDIAN -DHAVE_WEAK_SYMBOLS -D__STDC_LIMIT_MACROS -D__
# randombytes.c needs to pull in platform-specific implementation
$(LSRC)/randombytes/randombytes.o: CFLAGS+=-DRANDOMBYTES_DEFAULT_IMPLEMENTATION
ifeq ($(GCC_NOT_5_2_0), 1)
# Temporary suppress "fallthrough" warnings until they are fixed in libsodium repo
$(LSRC)/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.o: CFLAGS += -Wno-implicit-fallthrough
$(LSRC)/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.o: CFLAGS += -Wno-implicit-fallthrough
endif

View File

@ -28,3 +28,8 @@ ifdef CONFIG_PPP_SUPPORT
endif
CFLAGS += -Wno-address # lots of LWIP source files evaluate macros that check address of stack variables
ifeq ($(GCC_NOT_5_2_0), 1)
else
netif/ppp/pppos.o: CFLAGS += -Wno-type-limits
endif

View File

@ -2,4 +2,6 @@
# Main Makefile. This is basically the same as a component makefile.
#
ifeq ($(GCC_NOT_5_2_0), 1)
hid_device_le_prf.o: CFLAGS += -Wno-unused-const-variable
endif

View File

@ -273,7 +273,6 @@ COMMON_WARNING_FLAGS = -Wall -Werror=all \
-Wno-error=unused-function \
-Wno-error=unused-but-set-variable \
-Wno-error=unused-variable \
-Wno-error=unused-const-variable \
-Wno-error=deprecated-declarations \
-Wextra \
-Wno-unused-parameter -Wno-sign-compare
@ -294,7 +293,6 @@ COMMON_WARNING_FLAGS += -Wno-parentheses \
-Wno-int-in-bool-context
endif
ifdef CONFIG_WARN_WRITE_STRINGS
COMMON_WARNING_FLAGS += -Wwrite-strings
endif #CONFIG_WARN_WRITE_STRINGS
@ -394,6 +392,14 @@ OBJCOPY := $(call dequote,$(CONFIG_TOOLPREFIX))objcopy
SIZE := $(call dequote,$(CONFIG_TOOLPREFIX))size
export CC CXX LD AR OBJCOPY SIZE
COMPILER_VERSION_STR := $(shell $(CC) -dumpversion)
COMPILER_VERSION_NUM := $(subst .,,$(COMPILER_VERSION_STR))
GCC_NOT_5_2_0 := $(shell expr $(COMPILER_VERSION_STR) != "5.2.0")
export COMPILER_VERSION_STR COMPILER_VERSION_NUM GCC_NOT_5_2_0
CPPFLAGS += -DGCC_NOT_5_2_0=$(GCC_NOT_5_2_0)
export CPPFLAGS
PYTHON=$(call dequote,$(CONFIG_PYTHON))
# the app is the main executable built by the project
@ -581,15 +587,14 @@ print_flash_cmd: partition_table_get_info blank_ota_data
# Check toolchain version using the output of xtensa-esp32-elf-gcc --version command.
# The output normally looks as follows
# xtensa-esp32-elf-gcc (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 5.2.0
# The part in brackets is extracted into TOOLCHAIN_COMMIT_DESC variable,
# the part after the brackets is extracted into TOOLCHAIN_GCC_VER.
# The part in brackets is extracted into TOOLCHAIN_COMMIT_DESC variable
ifdef CONFIG_TOOLPREFIX
ifndef MAKE_RESTARTS
TOOLCHAIN_HEADER := $(shell $(CC) --version | head -1)
TOOLCHAIN_PATH := $(shell which $(CC))
TOOLCHAIN_COMMIT_DESC := $(shell $(CC) --version | sed -E -n 's|.*\(crosstool-NG (.*)\).*|\1|gp')
TOOLCHAIN_GCC_VER := $(shell $(CC) --version | sed -E -n 's|xtensa-esp32-elf-gcc.*\ \(.*\)\ (.*)|\1|gp')
TOOLCHAIN_GCC_VER := $(COMPILER_VERSION_STR)
# Officially supported version(s)
include $(IDF_PATH)/tools/toolchain_versions.mk

View File

@ -157,8 +157,17 @@ echo -e "\nFound issues:"
# Ignore the next messages:
# "error.o" or "-Werror" in compiler's command line
# "reassigning to symbol" or "changes choice state" in sdkconfig
sort -u "${LOG_SUSPECTED}" | \
grep -v "library/error\.o\|\ -Werror\|error\.d\|reassigning to symbol\|changes choice state" \
# Compiler and toochain versions is not supported from make/project.mk
IGNORE_WARNS="\
library/error\.o\
\|\ -Werror\|error\.d\
\|reassigning to symbol\
\|changes choice state\
\|Compiler version is not supported\
\|Toolchain version is not supported\
"
sort -u "${LOG_SUSPECTED}" | grep -v "${IGNORE_WARNS}" \
&& RESULT=$RESULT_ISSUES \
|| echo -e "\tNone"

View File

@ -2,4 +2,6 @@
# Component Makefile
#
ifeq ($(GCC_NOT_5_2_0), 1)
unity.o: CFLAGS += -Wno-unused-const-variable
endif