File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,10 +13,19 @@ set(C_STD gnu11)
1313IF (CMAKE_BUILD_TYPE STREQUAL "Debug" )
1414 message ("Debug build" )
1515 set (C_FLAGS_DEBUG " -O0 -g -fasynchronous-unwind-tables -fexceptions " )
16- set (C_FLAGS_WARNINGS " -Wall -Wextra -pedantic -Werror - Wformat=2 -Wconversion -Wdouble-promotion \
16+ set (C_FLAGS_WARNINGS " -Wall -Wextra -pedantic -Wformat=2 -Wconversion -Wdouble-promotion \
1717 -Wcast-align -Wredundant-decls -Winline -Wdisabled-optimization -Wnested-externs " )
18+ # -Werror
19+
1820 #More flags to try (these report some new warnings!): -Og -Wshadow -Wundef -Wcast-qual
1921 # and some extras: -Wmissing-prototypes -Wmissing-declarations
22+ ## set(C_FLAGS_RUNTIME_CHECKS " -fsanitize=address,undefined ") #It's possible to enable RUNTIME warnings
23+
24+ # Enable GCC SAST
25+ # TODO: CodeChecker might complain on -fanalyzer flag
26+ set (C_FLAGS_WARNINGS_EXTRA " -fanalyzer -Wcast-qual -Wcast-align -Wredundant-decls -Winline -Wdisabled-optimization -Wnested-externs \
27+ -fstrict-aliasing " ) #more: -Wmissing-prototypes -Wmissing-declarations
28+
2029
2130#-DCMAKE_BUILD_TYPE=Release
2231ELSE ()
2938 #set(C_FLAGS_SECURITY_LIB " -fpic ")
3039ENDIF ()
3140
32- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS } -std=${C_STD} ${C_FLAGS_DEBUG} ${C_FLAGS_WARNINGS} ${C_FLAGS_SECURITY} -fno-common" )
41+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS } -std=${C_STD} ${C_FLAGS_DEBUG} ${C_FLAGS_WARNINGS} ${C_FLAGS_WARNINGS_EXTRA} ${ C_FLAGS_SECURITY} -fno-common" )
3342#set(CMAKE_C_COMPILER /usr/bin/gcc)
3443
3544add_executable (array array.c )
You can’t perform that action at this time.
0 commit comments