[PATCH] D84244: [clang] Disable -Wsuggest-override for unittests/

Logan Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 21 09:10:59 PDT 2020


logan-5 created this revision.
logan-5 added a reviewer: mgorny.
logan-5 added a project: clang.
Herald added a subscriber: cfe-commits.

Yesterday I enabled `-Wsuggest-override` in the main LLVM build and have been fighting with the -Werror bots ever since. The key culprits making this difficult are googletest and googlemock, which do not use the `override` keyword in their sources, so any files that include them are met with massive warning (or error, in the case of -Werror) spam.

I've been going through and playing whack-a-mole by adding `-Wno-suggest-override` to directories that have code that uses gtest and/or gmock; this approach is feeling increasingly inelegant the more I do it, but all the patches I've submitted for review have been LGTM'd so far.

I'm wondering if I should do this a different way, or if it's fine to just proceed along this path until the bots are green again.

Thank you for your review.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84244

Files:
  clang/unittests/CMakeLists.txt


Index: clang/unittests/CMakeLists.txt
===================================================================
--- clang/unittests/CMakeLists.txt
+++ clang/unittests/CMakeLists.txt
@@ -10,6 +10,10 @@
   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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84244.279548.patch
Type: text/x-patch
Size: 442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200721/49ac4df5/attachment-0001.bin>


More information about the cfe-commits mailing list