mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
Enable -Wsuggest-override in the LLVM build
This patch adds Clang's new (and GCC's old) -Wsuggest-override to the warning flags for the LLVM build. The warning is a stronger form of -Winconsistent-missing-override which warns _everywhere_ that override is missing, not just in places where it's inconsistent within a class. Some directories in the monorepo need the warning disabled for compatibility's, or sanity's, sake; in particular, libcxx/libcxxabi, and any code implementing or interoperating with googletest, googlemock, or google benchmark (which do not themselves use override). This patch adds -Wno-suggest-override to the relevant CMakeLists.txt's to accomplish this. Differential Revision: https://reviews.llvm.org/D84126
This commit is contained in:
parent
d2f68caf31
commit
16a34f1645
@ -672,6 +672,9 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
|
||||
# Enable -Wdelete-non-virtual-dtor if available.
|
||||
add_flag_if_supported("-Wdelete-non-virtual-dtor" DELETE_NON_VIRTUAL_DTOR_FLAG)
|
||||
|
||||
# Enable -Wsuggest-override if available.
|
||||
add_flag_if_supported("-Wsuggest-override" SUGGEST_OVERRIDE_FLAG)
|
||||
|
||||
# Check if -Wcomment is OK with an // comment ending with '\' if the next
|
||||
# line is also a // comment.
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
|
@ -156,6 +156,10 @@ else()
|
||||
add_cxx_compiler_flag(-fno-exceptions)
|
||||
endif()
|
||||
|
||||
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
|
||||
add_cxx_compiler_flag(-Wno-suggest-override)
|
||||
endif()
|
||||
|
||||
if (HAVE_CXX_FLAG_FSTRICT_ALIASING)
|
||||
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") #ICC17u2: Many false positives for Wstrict-aliasing
|
||||
add_cxx_compiler_flag(-Wstrict-aliasing)
|
||||
|
@ -43,6 +43,9 @@ endif()
|
||||
if(CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG)
|
||||
add_definitions("-Wno-covered-switch-default")
|
||||
endif()
|
||||
if(CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
|
||||
add_definitions("-Wno-suggest-override")
|
||||
endif()
|
||||
|
||||
set(LLVM_REQUIRES_RTTI 1)
|
||||
add_definitions( -DGTEST_HAS_RTTI=0 )
|
||||
|
Loading…
Reference in New Issue
Block a user