Skip to content

Commit 14c369c

Browse files
committed
Adjust GD32 firmware warning flags
Refactors GD32 firmware warning options into incremental assignments, adds additional non-fatal warning suppressions, and wires those flags into the GD32 firmware-template C compile rule. Also adds `-Dcplusplus` to shared C++ options to ensure that define is consistently available during builds.
1 parent 1b29248 commit 14c369c

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

common/make/CppOps.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ CPPOPS=-std=c++20
44
CPPOPS+=-Wnon-virtual-dtor -Woverloaded-virtual -Wnull-dereference -fno-rtti -fno-exceptions -fno-unwind-tables
55
CPPOPS+=-Wuseless-cast -Wold-style-cast
66
CPPOPS+=-fno-threadsafe-statics -fno-use-cxa-atexit
7-
CPPOPS+=-Wshadow -Wshadow=local
7+
CPPOPS+=-Wshadow -Wshadow=local
8+
CPPOPS+=-Dcplusplus
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
$(info "Gd32FirmwareOpts.mk")
22

3-
GD32FIRMWAREOPS=-Wno-error=unused-parameter -Wno-error=unused-but-set-variable -Wno-error=conversion -Wno-error=old-style-cast
3+
GD32FIRMWAREOPS =-Wno-error=unused-parameter
4+
GD32FIRMWAREOPS+=-Wno-error=unused-but-set-variable
5+
GD32FIRMWAREOPS+=-Wno-error=conversion
6+
GD32FIRMWAREOPS+=-Wno-error=old-style-cast
7+
GD32FIRMWAREOPS+=-Wno-error=unused-function
8+
GD32FIRMWAREOPS+=-Wno-error=unused-variable
9+
GD32FIRMWAREOPS+=-Wno-error=duplicated-cond

firmware-template-gd32/lib/Rules.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ COPS+=-Wconversion
3939
endif
4040

4141
include ../common/make/CppOps.mk
42+
include ../common/make/gd32/Gd32FirmwareOps.mk
4243

4344
BUILD=build_gd32/
4445
BUILD_DIRS:=$(addprefix build_gd32/,$(SRCDIR))
@@ -60,7 +61,7 @@ $(info $$TARGET [${TARGET}])
6061
define compile-objects
6162
$(info $1)
6263
$(BUILD)$1/%.o: $1/%.c
63-
$(CC) -MD -MP $(COPS) -c $$< -o $$@
64+
$(CC) -MD -MP $(COPS) $(GD32FIRMWAREOPS) -c $$< -o $$@
6465

6566
$(BUILD)$1/%.o: $1/%.cpp
6667
$(CPP) -MD -MP $(COPS) $(CPPOPS) -c $$< -o $$@

0 commit comments

Comments
 (0)