Reapply "Try enabling -Wsuggest-override again, using add_compile_options instead of add_compile_definitions for disabling it in unittests/ directories."
add_compile_options is more sensitive to its location in the file than add_definitions--it only takes effect for sources that are added after it. This updated patch ensures that the add_compile_options is done before adding any source files that depend on it.
Using add_definitions caused the flag to be passed to rc.exe on Windows and thus broke Windows builds.
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index bf2ae67..5fa3b66 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -578,6 +578,7 @@
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)
@@ -602,7 +603,8 @@
target_add_compile_flags_if_supported(${target} PRIVATE
-Wno-literal-suffix
-Wno-c++14-compat
- -Wno-noexcept-type)
+ -Wno-noexcept-type
+ -Wno-suggest-override)
endif()
if (LIBCXX_ENABLE_WERROR)
target_add_compile_flags_if_supported(${target} PRIVATE -Werror)