Skip to content

Commit

Permalink
build system: Add a compatible old GCC flag
Browse files Browse the repository at this point in the history
  • Loading branch information
antmak committed Sep 20, 2018
1 parent 51c9b6b commit 9a55557
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 8 deletions.
4 changes: 4 additions & 0 deletions components/bt/component.mk
Expand Up @@ -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

Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions components/coap/component.mk
Expand Up @@ -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
3 changes: 2 additions & 1 deletion components/expat/component.mk
Expand Up @@ -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
2 changes: 2 additions & 0 deletions components/libsodium/component.mk
Expand Up @@ -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
5 changes: 5 additions & 0 deletions components/lwip/component.mk
Expand Up @@ -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
2 changes: 2 additions & 0 deletions examples/bluetooth/ble_hid_device_demo/main/component.mk
Expand Up @@ -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
15 changes: 10 additions & 5 deletions make/project.mk
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions tools/ci/build_examples.sh
Expand Up @@ -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"

Expand Down
2 changes: 2 additions & 0 deletions tools/unit-test-app/components/unity/component.mk
Expand Up @@ -2,4 +2,6 @@
# Component Makefile
#

ifeq ($(GCC_NOT_5_2_0), 1)
unity.o: CFLAGS += -Wno-unused-const-variable
endif

0 comments on commit 9a55557

Please sign in to comment.