Bugfix/fix redundant compiler flags (#658)

* Improved GCC compiler flags in ARM, OS, and test builds. Removed redundant flags, and made them consistent across various builds.

* Fixed redundant redeclaration of various functions detected by change in compiler flags.

* Fixed string truncation warning in bip-init detected by change in compiler flags.

* Fixed some set-but-not-used variables by creating dummy functions instead of using macros.
This commit is contained in:
Steve Karg
2024-05-30 10:59:54 -05:00
committed by GitHub
parent 0cbf7414a4
commit 52f3f08cb1
20 changed files with 130 additions and 144 deletions
+15 -1
View File
@@ -226,10 +226,24 @@ target_compile_definitions(${EXECUTABLE} PRIVATE
# inhibit pedantic warnings
target_compile_options(${EXECUTABLE} PRIVATE
-Wall
-Wall -Wextra -pedantic
-Wfloat-equal -Wconversion -Wredundant-decls
-Wswitch-default
# don't warn about conversion, sign, compares, long long and attributes
# since they are common in embedded
-Wno-sign-conversion
-Wno-conversion
-Wno-sign-compare
-Wno-long-long
-Wno-attributes
# don't warn about implicit fallthrough since it is common in network protocols
-Wno-implicit-fallthrough
# the SDK does not meet coding guidelines
-Wno-comment
-Wno-missing-braces
-Wno-unused-variable
-Wno-unused-parameter
-Wno-char-subscripts
)
target_include_directories(${EXECUTABLE} PRIVATE
+16 -5
View File
@@ -177,14 +177,25 @@ CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin
# place uninitialized global variables in the data section of the object file.
CFLAGS += -fno-common
# enable all relevant warnings
CFLAGS += -Wall
# enable all relevant warnings that find bugs
WARNING_ALL := -Wall -Wextra -Wfloat-equal -Wconversion
WARNING_ALL += -Wredundant-decls -Wswitch-default -pedantic
# don't warn about conversion, sign, compares, long long and attributes
# since they are common in embedded
WARNING_ALL += -Wno-sign-conversion -Wno-conversion -Wno-sign-compare
WARNING_ALL += -Wno-long-long -Wno-attributes
# don't warn about implicit fallthrough since it's common in network protocols
WARNING_ALL += -Wno-implicit-fallthrough
# don't warn about missing braces since GCC is over-achiever for this
CFLAGS += -Wno-missing-braces
WARNING_ALL += -Wno-missing-braces
# don't warn about missing prototypes since STM32 library doesn't have some
CFLAGS += -Wno-missing-prototypes
WARNING_ALL += -Wno-missing-prototypes
# don't warn about array subscript being char
CFLAGS += -Wno-char-subscripts
WARNING_ALL += -Wno-char-subscripts
# FIXME later
WARNING_ALL += -Wno-unused-parameter
#WARNING_ALL += -Werror
CFLAGS += $(WARNING_ALL)
# -Wa,<options> Pass comma-separated <options> on to the assembler
AFLAGS = -Wa,-ahls,-mapcs-32,-adhlns=$(<:.s=.lst)