build: disable restrict warning when using GCC 12.1-12.3

Prevents warning raised by a compiler bug when using GCC 12.1-12.3 with C++20

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105545
This commit is contained in:
Gabriel Ferreira
2023-10-18 12:39:34 -03:00
parent 2c9bf1c0d6
commit 4e06af5256
2 changed files with 8 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ Changes from ns-3.40 to ns-3-dev
* In preparation to enable C++20, the following actions have been taken due to compiler issues:
* Precompiled headers have been disabled in GCC versions >= 12.2.
* The `restrict` warning has been disabled in GCC versions 12.1-12.3.1.
### Changed behavior

View File

@@ -251,6 +251,13 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
CACHE BOOL "Precompile module headers to speed up compilation" FORCE
)
endif()
if((CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.1.0")
AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "12.3.2")
)
# Disable warnings-as-errors for certain versions of GCC when C++20 is
# enabled https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105545
add_compile_options(-Wno-restrict)
endif()
set(GCC TRUE)
add_definitions(-fno-semantic-interposition)
if(${NS3_COLORED_OUTPUT} OR "$ENV{CLICOLOR}")