diff --git a/components/bt/component.mk b/components/bt/component.mk index 327e9a9f3..eb9b39c02 100644 --- a/components/bt/component.mk +++ b/components/bt/component.mk @@ -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 diff --git a/components/coap/component.mk b/components/coap/component.mk index 4b3d56f56..bd7b0e0a6 100644 --- a/components/coap/component.mk +++ b/components/coap/component.mk @@ -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 diff --git a/components/expat/component.mk b/components/expat/component.mk index 851f6a8c3..351fe3b74 100644 --- a/components/expat/component.mk +++ b/components/expat/component.mk @@ -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 diff --git a/components/libsodium/component.mk b/components/libsodium/component.mk index 12dcb571a..c84519cb3 100644 --- a/components/libsodium/component.mk +++ b/components/libsodium/component.mk @@ -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 diff --git a/components/lwip/component.mk b/components/lwip/component.mk index d79cbd36c..037b09f2a 100644 --- a/components/lwip/component.mk +++ b/components/lwip/component.mk @@ -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 \ No newline at end of file diff --git a/examples/bluetooth/ble_hid_device_demo/main/component.mk b/examples/bluetooth/ble_hid_device_demo/main/component.mk index 4c0df1103..4fa5a1b02 100644 --- a/examples/bluetooth/ble_hid_device_demo/main/component.mk +++ b/examples/bluetooth/ble_hid_device_demo/main/component.mk @@ -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 \ No newline at end of file diff --git a/make/project.mk b/make/project.mk index acb240386..71d86d316 100644 --- a/make/project.mk +++ b/make/project.mk @@ -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 diff --git a/tools/ci/build_examples.sh b/tools/ci/build_examples.sh index a36ab8f80..be3e558f5 100755 --- a/tools/ci/build_examples.sh +++ b/tools/ci/build_examples.sh @@ -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" diff --git a/tools/unit-test-app/components/unity/component.mk b/tools/unit-test-app/components/unity/component.mk index b0a970453..c3c44cc0c 100644 --- a/tools/unit-test-app/components/unity/component.mk +++ b/tools/unit-test-app/components/unity/component.mk @@ -2,4 +2,6 @@ # Component Makefile # +ifeq ($(GCC_NOT_5_2_0), 1) unity.o: CFLAGS += -Wno-unused-const-variable +endif \ No newline at end of file