From db0bf483cefd9f16d9a8ff064f0e55fcaff4b8a9 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 14 Jul 2023 10:24:12 +0200 Subject: [PATCH] Fix cflags for gcc < 12 --- firmware/application/Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/firmware/application/Makefile b/firmware/application/Makefile index db2fae9..e3b2ae2 100644 --- a/firmware/application/Makefile +++ b/firmware/application/Makefile @@ -4,7 +4,6 @@ TARGETS := application $(OUTPUT_DIRECTORY)/application.out: \ LINKER_SCRIPT := application.ld - # Source files common to all targets SRC_FILES += \ $(SRC_COMMON)/hw_connect.c \ @@ -309,9 +308,6 @@ CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 # keep every function in a separate section, this allows linker to discard unused ones CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing CFLAGS += -fno-builtin -fshort-enums -# fix newer compilator versions -CFLAGS += -Wno-error=array-bounds -CFLAGS += -Wno-error=sizeof-array-div # C++ flags common to all targets CXXFLAGS += $(OPT) @@ -368,6 +364,15 @@ TEMPLATE_PATH := $(SDK_ROOT)/components/toolchain/gcc include ../Makefile.defs include $(TEMPLATE_PATH)/Makefile.common +# tolerate warnings in newer gcc versions +# need to be called after $(TEMPLATE_PATH)/Makefile.common +CC_VERSION = $(shell $(CC) -dumpversion 2>/dev/null|sed 's/\..*//') +CC_VERSION := $(or $(strip $(CC_VERSION)),0) +CFLAGS += -Wno-error=array-bounds +ifeq ($(shell expr $(CC_VERSION) \>= 12), 1) + CFLAGS += -Wno-error=sizeof-array-div +endif + $(foreach target, $(TARGETS), $(call define_target, $(target))) .PHONY: flash flash_softdevice erase config