mirror of
https://github.com/zeek/zeek.git
synced 2025-10-01 22:28:20 +00:00
Reduce some false-positive warnings from GCC to warnings with -Werror
This also works around some of the same warnings. These are known bugs in GCC 11+ and GCC 13.x.
This commit is contained in:
parent
cd356ce45d
commit
57a3c733d1
6 changed files with 30 additions and 22 deletions
|
@ -192,7 +192,7 @@ if (MSVC)
|
|||
# TODO: This is disabled for now because there a bunch of known
|
||||
# compiler warnings on Windows that we don't have good fixes for.
|
||||
#set(WERROR_FLAG "/WX")
|
||||
#set(WERROR_FLAG "/WX")
|
||||
#set(WNOERROR_FLAG "/WX:NO")
|
||||
endif ()
|
||||
|
||||
# Always build binpac in static mode if building on Windows
|
||||
|
@ -202,6 +202,20 @@ else ()
|
|||
include(GNUInstallDirs)
|
||||
if (BUILD_WITH_WERROR)
|
||||
set(WERROR_FLAG "-Werror")
|
||||
set(WNOERROR_FLAG "-Wno-error")
|
||||
|
||||
# With versions >=13.0 GCC gained `-Warray-bounds` which reports false
|
||||
# positives, see e.g., https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111273.
|
||||
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0)
|
||||
list(APPEND WERROR_FLAG "-Wno-error=array-bounds")
|
||||
endif ()
|
||||
|
||||
# With versions >=11.0 GCC is returning false positives for -Wrestrict. See
|
||||
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100366. It's more prevalent
|
||||
# building with -std=c++20.
|
||||
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
|
||||
list(APPEND WERROR_FLAG "-Wno-error=restrict")
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue