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:
@@ -191,9 +191,20 @@ target_compile_definitions(${EXECUTABLE} PRIVATE
|
||||
-DBACAPP_MINIMAL
|
||||
)
|
||||
|
||||
# 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 older Atmel SDK does not meet coding guidelines
|
||||
-Wno-comment
|
||||
-Wno-missing-braces
|
||||
-Wno-unused-variable
|
||||
|
||||
@@ -38,8 +38,22 @@ CFLAGS = -fno-common $(INCLUDES) $(BACNET_FLAGS) -g
|
||||
CFLAGS += -mno-thumb-interwork
|
||||
# dead code removal
|
||||
CFLAGS += -fdata-sections -ffunction-sections
|
||||
# warning control
|
||||
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
|
||||
# the older Atmel SDK does not meet coding guidelines
|
||||
WARNING_ALL += -Wno-comment -Wno-missing-braces
|
||||
WARNING_ALL += -Wno-unused-variable -Wno-char-subscripts
|
||||
#WARNING_ALL += -Werror
|
||||
CFLAGS += $(WARNING_ALL)
|
||||
|
||||
CFLAGS += -Wno-char-subscripts
|
||||
|
||||
LIBRARY = lib$(TARGET).a
|
||||
|
||||
Reference in New Issue
Block a user