Revert "Enable -Wsuggest-override in the LLVM build" and the follow-ups.
authorHans Wennborg <hans@chromium.org>
Wed, 22 Jul 2020 18:12:18 +0000 (20:12 +0200)
committerHans Wennborg <hans@chromium.org>
Wed, 22 Jul 2020 18:23:58 +0000 (20:23 +0200)
After lots of follow-up fixes, there are still problems, such as
-Wno-suggest-override getting passed to the Windows Resource Compiler
because it was added with add_definitions in the CMake file.

Rather than piling on another fix, let's revert so this can be re-landed
when there's a proper fix.

This reverts commit 21c0b4c1e8d6a171899b31d072a47dac27258fc5.
This reverts commit 81d68ad27b29b1e6bc93807c6e42b14e9a77eade.
This reverts commit a361aa5249856e333a373df90947dabf34cd6aab.
This reverts commit fa42b7cf2949802ff0b8a63a2e111a2a68711067.
This reverts commit 955f87f947fda3072a69b0b00ca83c1f6a0566f6.
This reverts commit 8b16e45f66e24e4c10e2cea1b70d2b85a7ce64d5.
This reverts commit 308a127a38d1111f3940420b98ff45fc1c17715f.
This reverts commit 274b6b0c7a8b584662595762eaeff57d61c6807f.
This reverts commit 1c7037a2a5576d0bb083db10ad947a8308e61f65.

18 files changed:
clang-tools-extra/clangd/unittests/CMakeLists.txt
clang-tools-extra/unittests/CMakeLists.txt
clang/unittests/CMakeLists.txt
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/cmake/config-ix.cmake
flang/unittests/CMakeLists.txt
libcxx/CMakeLists.txt
libcxxabi/CMakeLists.txt
lld/unittests/CMakeLists.txt
lldb/unittests/CMakeLists.txt
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/lib/Testing/Support/CMakeLists.txt
llvm/unittests/CMakeLists.txt
llvm/utils/benchmark/CMakeLists.txt
llvm/utils/unittest/CMakeLists.txt
mlir/unittests/CMakeLists.txt
parallel-libs/acxxel/CMakeLists.txt
polly/unittests/CMakeLists.txt

index 8a4a0fb..c25e2b7 100644 (file)
@@ -22,10 +22,6 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 if (CLANGD_ENABLE_REMOTE)
   include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote)
   add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)
index 751827c..086a68e 100644 (file)
@@ -5,10 +5,6 @@ function(add_extra_unittest test_dirname)
   add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 add_subdirectory(clang-apply-replacements)
 add_subdirectory(clang-change-namespace)
 add_subdirectory(clang-doc)
index 64168f4..4c222e2 100644 (file)
@@ -10,10 +10,6 @@ if(CLANG_BUILT_STANDALONE)
   endif()
 endif()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 # add_clang_unittest(test_dirname file1.cpp file2.cpp)
 #
 # Will compile the list of files together and link against the clang
index efb6608..dab5570 100644 (file)
@@ -403,7 +403,6 @@ set(COMPILER_RT_GMOCK_CFLAGS
 
 append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS)
 append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG -Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
-append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override COMPILER_RT_UNITTEST_CFLAGS)
 
 if(MSVC)
   # gtest use a lot of stuff marked as deprecated on Windows.
index 0a27910..f535123 100644 (file)
@@ -106,7 +106,6 @@ check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor"   COMPILER_RT_HAS_WNON_VIRT
 check_cxx_compiler_flag("-Werror -Wvariadic-macros"    COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
 check_cxx_compiler_flag("-Werror -Wunused-parameter"   COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
 check_cxx_compiler_flag("-Werror -Wcovered-switch-default" COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG)
-check_cxx_compiler_flag("-Werror -Wsuggest-override"   COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG)
 check_cxx_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)
 
 check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG)
index 0d52bc0..d53d155 100644 (file)
@@ -5,10 +5,6 @@ function(add_flang_unittest test_dirname)
   add_unittest(FlangUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 add_subdirectory(Optimizer)
 add_subdirectory(Decimal)
 add_subdirectory(Evaluate)
index 3ba09fd..caf655d 100644 (file)
@@ -578,7 +578,6 @@ function(cxx_add_warning_flags target)
     target_add_compile_flags_if_supported(${target} PRIVATE
       -Wno-user-defined-literals
       -Wno-covered-switch-default
-      -Wno-suggest-override
       -Wno-ignored-attributes # FIXME: Caused by _LIBCPP_NODEBUG_TYPE not being supported on older clangs
     )
     if (LIBCXX_TARGETING_CLANG_CL)
@@ -603,8 +602,7 @@ function(cxx_add_warning_flags target)
     target_add_compile_flags_if_supported(${target} PRIVATE
       -Wno-literal-suffix
       -Wno-c++14-compat
-      -Wno-noexcept-type
-      -Wno-suggest-override)
+      -Wno-noexcept-type)
   endif()
   if (LIBCXX_ENABLE_WERROR)
     target_add_compile_flags_if_supported(${target} PRIVATE -Werror)
index c28c438..e4e20d9 100644 (file)
@@ -283,8 +283,6 @@ add_compile_flags_if_supported(-Wunused-variable)
 add_compile_flags_if_supported(-Wwrite-strings)
 add_compile_flags_if_supported(-Wundef)
 
-add_compile_flags_if_supported(-Wno-suggest-override)
-
 if (LIBCXXABI_ENABLE_WERROR)
   add_compile_flags_if_supported(-Werror)
   add_compile_flags_if_supported(-WX)
index 3330f7c..84d35d4 100644 (file)
@@ -12,9 +12,5 @@ function(add_lld_unittest test_dirname)
   target_link_libraries(${test_dirname} ${LLVM_COMMON_LIBS})
 endfunction()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 add_subdirectory(DriverTests)
 add_subdirectory(MachOTests)
index 3a31559..6422b72 100644 (file)
@@ -5,10 +5,6 @@ add_dependencies(lldb-test-deps LLDBUnitTests)
 include_directories(${LLDB_SOURCE_ROOT})
 include_directories(${LLDB_PROJECT_ROOT}/unittests)
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 set(LLDB_GTEST_COMMON_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/gtest_common.h)
 if (MSVC)
   list(APPEND LLVM_COMPILE_FLAGS /FI ${LLDB_GTEST_COMMON_INCLUDE})
index 62dd0ef..2e24959 100644 (file)
@@ -672,21 +672,6 @@ 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 it's available, and only if it doesn't
-  # suggest adding 'override' to functions that are already marked 'final'
-  # (which means it is disabled for GCC < 9.2).
-  check_cxx_compiler_flag("-Wsuggest-override" CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-    set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-    set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=suggest-override")
-    CHECK_CXX_SOURCE_COMPILES("class base {public: virtual void anchor();};
-                               class derived : base {public: void anchor() final;};
-                               int main() { return 0; }"
-                              CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL)
-    set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
-    append_if(CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL "-Wsuggest-override" CMAKE_CXX_FLAGS)
-  endif()
-
   # 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})
index 4d2f46e..fe460ae 100644 (file)
@@ -15,10 +15,6 @@ add_llvm_library(LLVMTestingSupport
   Support
   )
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock/include)
 target_link_libraries(LLVMTestingSupport PRIVATE gtest)
index c1e0231..d7dbaea 100644 (file)
@@ -14,10 +14,6 @@ function(add_llvm_target_unittest test_dir_name)
   add_llvm_unittest(${test_dir_name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
 endfunction()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 add_subdirectory(ADT)
 add_subdirectory(Analysis)
 add_subdirectory(AsmParser)
index ce1d38e..38bc8c6 100644 (file)
@@ -156,10 +156,6 @@ 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)
index 36761a6..5aad048 100644 (file)
@@ -43,9 +43,6 @@ 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 )
index 69b5842..851092c 100644 (file)
@@ -5,10 +5,6 @@ function(add_mlir_unittest test_dirname)
   add_unittest(MLIRUnitTests ${test_dirname} ${ARGN})
 endfunction()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 add_subdirectory(Analysis)
 add_subdirectory(Dialect)
 add_subdirectory(IR)
index f2ebe48..547dd62 100644 (file)
@@ -36,9 +36,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
 # Add warning flags.
 set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -Wall -Wextra")
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
 
 add_library(
     acxxel
index 1a05849..fac7038 100644 (file)
@@ -19,10 +19,6 @@ function(add_polly_unittest test_name)
   target_link_libraries(${test_name} PRIVATE Polly)
 endfunction()
 
-if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
-  add_definitions("-Wno-suggest-override")
-endif()
-
 add_subdirectory(Isl)
 add_subdirectory(Flatten)
 add_subdirectory(DeLICM)