[PATCH] D98942: [cmake] Disable GCC 9's -Wpessimizing-move

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 04:51:58 PDT 2021


mstorsjo created this revision.
mstorsjo added reviewers: labath, tbaeder, craig.topper.
Herald added a subscriber: mgorny.
mstorsjo requested review of this revision.
Herald added a project: LLVM.

Similar to the existing code for disabling GCC's -Wredudant-move,
also check for the -Wpessimizing-move option and disable it if
possible.

This silences another bunch of noisy warnings when building LLVM
with GCC 9.

As noted for -Wredundant-move, the cases can't be fixed while
retaining support for older compilers.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98942

Files:
  llvm/cmake/modules/HandleLLVMOptions.cmake


Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -688,6 +688,8 @@
   if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
     check_cxx_compiler_flag("-Wredundant-move" CXX_SUPPORTS_REDUNDANT_MOVE_FLAG)
     append_if(CXX_SUPPORTS_REDUNDANT_MOVE_FLAG "-Wno-redundant-move" CMAKE_CXX_FLAGS)
+    check_cxx_compiler_flag("-Wpessimizing-move" CXX_SUPPORTS_PESSIMIZING_MOVE_FLAG)
+    append_if(CXX_SUPPORTS_PESSIMIZING_MOVE_FLAG "-Wno-pessimizing-move" CMAKE_CXX_FLAGS)
   endif()
 
   # The LLVM libraries have no stable C++ API, so -Wnoexcept-type is not useful.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98942.331829.patch
Type: text/x-patch
Size: 718 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210319/55a551a0/attachment.bin>


More information about the llvm-commits mailing list