Commit a5f07632 by Ben Clayton

Disable new gcc 9 warning [init-list-lifetime]

All places this was raised look like safe usage to me. Also shuffled some CMake code around so that compiler warning settings all sit next to each other. Fixes: b/148842417 Change-Id: I262d0fdacc7a88092cad0890504b0e475f750d47 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40835 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 8e8e1d0d
......@@ -408,6 +408,7 @@ if(MSVC)
else()
set_cpp_flag("-fno-exceptions")
# Explicitly enable these warnings.
list(APPEND SWIFTSHADER_COMPILE_OPTIONS
"-Wall"
"-Wreorder"
......@@ -421,6 +422,29 @@ else()
"-Wstring-conversion"
"-Wextra-semi"
"-Wignored-qualifiers"
)
endif()
# Disable pedanitc warnings
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
list(APPEND SWIFTSHADER_COMPILE_OPTIONS
"-Wno-ignored-attributes" # ignoring attributes on template argument 'X'
"-Wno-attributes" # 'X' attribute ignored
"-Wno-strict-aliasing" # dereferencing type-punned pointer will break strict-aliasing rules
"-Wno-comment" # multi-line comment
)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9)
list(APPEND SWIFTSHADER_COMPILE_OPTIONS
"-Wno-init-list-lifetime" # assignment from temporary initializer_list does not extend the lifetime of the underlying array
)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(APPEND SWIFTSHADER_COMPILE_OPTIONS
"-Wno-unneeded-internal-declaration" # function 'X' is not needed and will not be emitted
"-Wno-unused-private-field" # private field 'offset' is not used - TODO: Consider enabling this once Vulkan is further implemented.
"-Wno-comment" # multi-line comment
"-Wno-undefined-var-template" # instantiation of variable 'X' required here, but no definition is available
# Silence errors caused by unknown warnings when building with older
# versions of Clang. This demands checking that warnings added above
# are spelled correctly and work as intended!
......@@ -485,23 +509,6 @@ else()
list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DDCHECK_ALWAYS_ON")
endif()
# Disable pedanitc warnings
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
list(APPEND SWIFTSHADER_COMPILE_OPTIONS
"-Wno-ignored-attributes" # ignoring attributes on template argument 'X'
"-Wno-attributes" # 'X' attribute ignored
"-Wno-strict-aliasing" # dereferencing type-punned pointer will break strict-aliasing rules
"-Wno-comment" # multi-line comment
)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
list(APPEND SWIFTSHADER_COMPILE_OPTIONS
"-Wno-unneeded-internal-declaration" # function 'X' is not needed and will not be emitted
"-Wno-unused-private-field" # private field 'offset' is not used - TODO: Consider enabling this once Vulkan is further implemented.
"-Wno-comment" # multi-line comment
"-Wno-undefined-var-template" # instantiation of variable 'X' required here, but no definition is available
)
endif()
# For distribution it is more important to be slim than super optimized
set_cpp_flag("-Os" RELEASE)
set_cpp_flag("-Os" RELWITHDEBINFO)
......@@ -1496,6 +1503,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
"-Wno-attributes" # declared inline but not inline
)
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9)
list(APPEND LLVM_COMPILE_OPTIONS
"-Wno-init-list-lifetime" # assignment from temporary initializer_list does not extend the lifetime of the underlying array
)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
list(APPEND LLVM_COMPILE_OPTIONS
"/wd4141" # 'inline': used more than once
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment