Skip to content

Commit

Permalink
Omit annoying false positives emitted by compiler.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfaranha committed May 8, 2024
1 parent d74bced commit 514358d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,14 @@ if("$ENV{CFLAGS}" STREQUAL "")
set(CFLAGS "/Od" CACHE STRING "Default compiler flags.")
else()
# Turn off all optimizations.
set(CFLAGS "-pipe -std=c99 -O0 -fno-omit-frame-pointer -Wno-stringop-overflow -Wno-stringop-overread" CACHE STRING "Default compiler flags.")
set(CFLAGS "-pipe -std=c99 -O0 -fno-omit-frame-pointer" CACHE STRING "Default compiler flags.")
set(DFLAGS "-ggdb")
endif()
else()
if (MSVC)
set(CFLAGS "/O2" CACHE STRING "Default compiler flags.")
else()
set(CFLAGS "-pipe -std=c99 -O2 -funroll-loops -fomit-frame-pointer -Wno-stringop-overflow -Wno-stringop-overread" CACHE STRING "Default compiler flags.")
set(CFLAGS "-pipe -std=c99 -O2 -funroll-loops -fomit-frame-pointer" CACHE STRING "Default compiler flags.")
endif()
endif()
else()
Expand All @@ -269,6 +269,9 @@ else()
set(CFLAGS "$ENV{CFLAGS}" CACHE STRING "User-chosen compiler flags.")
endif()

# Remove annoying flags when compiler cannot compute buffer sizes.
set(CFLAGS "${CFLAGS} -Wno-stringop-overflow -Wno-stringop-overread")

if(AUSAN)
set(DFLAGS "${DFLAGS} -ggdb -fsanitize=address -fsanitize=undefined")
endif()
Expand Down

0 comments on commit 514358d

Please sign in to comment.