Skip to content

Commit 3eec657

Browse files
committed
Revert "Enable -Wsuggest-override in the LLVM build" and the follow-ups.
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 21c0b4c. This reverts commit 81d68ad. This reverts commit a361aa5. This reverts commit fa42b7c. This reverts commit 955f87f. This reverts commit 8b16e45. This reverts commit 308a127. This reverts commit 274b6b0. This reverts commit 1c7037a.
1 parent 652e304 commit 3eec657

File tree

18 files changed

+1
-72
lines changed

18 files changed

+1
-72
lines changed

clang-tools-extra/clangd/unittests/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ if(CLANG_BUILT_STANDALONE)
2222
endif()
2323
endif()
2424

25-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
26-
add_definitions("-Wno-suggest-override")
27-
endif()
28-
2925
if (CLANGD_ENABLE_REMOTE)
3026
include_directories(${CMAKE_CURRENT_BINARY_DIR}/../index/remote)
3127
add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)

clang-tools-extra/unittests/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ function(add_extra_unittest test_dirname)
55
add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN})
66
endfunction()
77

8-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
9-
add_definitions("-Wno-suggest-override")
10-
endif()
11-
128
add_subdirectory(clang-apply-replacements)
139
add_subdirectory(clang-change-namespace)
1410
add_subdirectory(clang-doc)

clang/unittests/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ if(CLANG_BUILT_STANDALONE)
1010
endif()
1111
endif()
1212

13-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
14-
add_definitions("-Wno-suggest-override")
15-
endif()
16-
1713
# add_clang_unittest(test_dirname file1.cpp file2.cpp)
1814
#
1915
# Will compile the list of files together and link against the clang

compiler-rt/cmake/Modules/AddCompilerRT.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ set(COMPILER_RT_GMOCK_CFLAGS
403403

404404
append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS)
405405
append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG -Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS)
406-
append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override COMPILER_RT_UNITTEST_CFLAGS)
407406

408407
if(MSVC)
409408
# gtest use a lot of stuff marked as deprecated on Windows.

compiler-rt/cmake/config-ix.cmake

-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor" COMPILER_RT_HAS_WNON_VIRT
106106
check_cxx_compiler_flag("-Werror -Wvariadic-macros" COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
107107
check_cxx_compiler_flag("-Werror -Wunused-parameter" COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
108108
check_cxx_compiler_flag("-Werror -Wcovered-switch-default" COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG)
109-
check_cxx_compiler_flag("-Werror -Wsuggest-override" COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG)
110109
check_cxx_compiler_flag(-Wno-pedantic COMPILER_RT_HAS_WNO_PEDANTIC)
111110

112111
check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG)

flang/unittests/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ function(add_flang_unittest test_dirname)
55
add_unittest(FlangUnitTests ${test_dirname} ${ARGN})
66
endfunction()
77

8-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
9-
add_definitions("-Wno-suggest-override")
10-
endif()
11-
128
add_subdirectory(Optimizer)
139
add_subdirectory(Decimal)
1410
add_subdirectory(Evaluate)

libcxx/CMakeLists.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@ function(cxx_add_warning_flags target)
578578
target_add_compile_flags_if_supported(${target} PRIVATE
579579
-Wno-user-defined-literals
580580
-Wno-covered-switch-default
581-
-Wno-suggest-override
582581
-Wno-ignored-attributes # FIXME: Caused by _LIBCPP_NODEBUG_TYPE not being supported on older clangs
583582
)
584583
if (LIBCXX_TARGETING_CLANG_CL)
@@ -603,8 +602,7 @@ function(cxx_add_warning_flags target)
603602
target_add_compile_flags_if_supported(${target} PRIVATE
604603
-Wno-literal-suffix
605604
-Wno-c++14-compat
606-
-Wno-noexcept-type
607-
-Wno-suggest-override)
605+
-Wno-noexcept-type)
608606
endif()
609607
if (LIBCXX_ENABLE_WERROR)
610608
target_add_compile_flags_if_supported(${target} PRIVATE -Werror)

libcxxabi/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,6 @@ add_compile_flags_if_supported(-Wunused-variable)
283283
add_compile_flags_if_supported(-Wwrite-strings)
284284
add_compile_flags_if_supported(-Wundef)
285285

286-
add_compile_flags_if_supported(-Wno-suggest-override)
287-
288286
if (LIBCXXABI_ENABLE_WERROR)
289287
add_compile_flags_if_supported(-Werror)
290288
add_compile_flags_if_supported(-WX)

lld/unittests/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,5 @@ function(add_lld_unittest test_dirname)
1212
target_link_libraries(${test_dirname} ${LLVM_COMMON_LIBS})
1313
endfunction()
1414

15-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
16-
add_definitions("-Wno-suggest-override")
17-
endif()
18-
1915
add_subdirectory(DriverTests)
2016
add_subdirectory(MachOTests)

lldb/unittests/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ add_dependencies(lldb-test-deps LLDBUnitTests)
55
include_directories(${LLDB_SOURCE_ROOT})
66
include_directories(${LLDB_PROJECT_ROOT}/unittests)
77

8-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
9-
add_definitions("-Wno-suggest-override")
10-
endif()
11-
128
set(LLDB_GTEST_COMMON_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/gtest_common.h)
139
if (MSVC)
1410
list(APPEND LLVM_COMPILE_FLAGS /FI ${LLDB_GTEST_COMMON_INCLUDE})

llvm/cmake/modules/HandleLLVMOptions.cmake

-15
Original file line numberDiff line numberDiff line change
@@ -672,21 +672,6 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL))
672672
# Enable -Wdelete-non-virtual-dtor if available.
673673
add_flag_if_supported("-Wdelete-non-virtual-dtor" DELETE_NON_VIRTUAL_DTOR_FLAG)
674674

675-
# Enable -Wsuggest-override if it's available, and only if it doesn't
676-
# suggest adding 'override' to functions that are already marked 'final'
677-
# (which means it is disabled for GCC < 9.2).
678-
check_cxx_compiler_flag("-Wsuggest-override" CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
679-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
680-
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
681-
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=suggest-override")
682-
CHECK_CXX_SOURCE_COMPILES("class base {public: virtual void anchor();};
683-
class derived : base {public: void anchor() final;};
684-
int main() { return 0; }"
685-
CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL)
686-
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
687-
append_if(CXX_WSUGGEST_OVERRIDE_ALLOWS_ONLY_FINAL "-Wsuggest-override" CMAKE_CXX_FLAGS)
688-
endif()
689-
690675
# Check if -Wcomment is OK with an // comment ending with '\' if the next
691676
# line is also a // comment.
692677
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})

llvm/lib/Testing/Support/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ add_llvm_library(LLVMTestingSupport
1515
Support
1616
)
1717

18-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
19-
add_definitions("-Wno-suggest-override")
20-
endif()
21-
2218
include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
2319
include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock/include)
2420
target_link_libraries(LLVMTestingSupport PRIVATE gtest)

llvm/unittests/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ function(add_llvm_target_unittest test_dir_name)
1414
add_llvm_unittest(${test_dir_name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
1515
endfunction()
1616

17-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
18-
add_definitions("-Wno-suggest-override")
19-
endif()
20-
2117
add_subdirectory(ADT)
2218
add_subdirectory(Analysis)
2319
add_subdirectory(AsmParser)

llvm/utils/benchmark/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ else()
156156
add_cxx_compiler_flag(-fno-exceptions)
157157
endif()
158158

159-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
160-
add_cxx_compiler_flag(-Wno-suggest-override)
161-
endif()
162-
163159
if (HAVE_CXX_FLAG_FSTRICT_ALIASING)
164160
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "Intel") #ICC17u2: Many false positives for Wstrict-aliasing
165161
add_cxx_compiler_flag(-Wstrict-aliasing)

llvm/utils/unittest/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ endif()
4343
if(CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG)
4444
add_definitions("-Wno-covered-switch-default")
4545
endif()
46-
if(CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
47-
add_definitions("-Wno-suggest-override")
48-
endif()
4946

5047
set(LLVM_REQUIRES_RTTI 1)
5148
add_definitions( -DGTEST_HAS_RTTI=0 )

mlir/unittests/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ function(add_mlir_unittest test_dirname)
55
add_unittest(MLIRUnitTests ${test_dirname} ${ARGN})
66
endfunction()
77

8-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
9-
add_definitions("-Wno-suggest-override")
10-
endif()
11-
128
add_subdirectory(Analysis)
139
add_subdirectory(Dialect)
1410
add_subdirectory(IR)

parallel-libs/acxxel/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
3636

3737
# Add warning flags.
3838
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
39-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
40-
add_definitions("-Wno-suggest-override")
41-
endif()
4239

4340
add_library(
4441
acxxel

polly/unittests/CMakeLists.txt

-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ function(add_polly_unittest test_name)
1919
target_link_libraries(${test_name} PRIVATE Polly)
2020
endfunction()
2121

22-
if (CXX_SUPPORTS_SUGGEST_OVERRIDE_FLAG)
23-
add_definitions("-Wno-suggest-override")
24-
endif()
25-
2622
add_subdirectory(Isl)
2723
add_subdirectory(Flatten)
2824
add_subdirectory(DeLICM)

0 commit comments

Comments
 (0)