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

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 06:16:14 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc027553d95fa: [cmake] Disable GCC 9's -Wpessimizing-move (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D98942?vs=331829&id=332265#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98942/new/

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
@@ -690,14 +690,17 @@
   check_cxx_compiler_flag("-Wclass-memaccess" CXX_SUPPORTS_CLASS_MEMACCESS_FLAG)
   append_if(CXX_SUPPORTS_CLASS_MEMACCESS_FLAG "-Wno-class-memaccess" CMAKE_CXX_FLAGS)
 
-  # Disable -Wredundant-move on GCC>=9. GCC wants to remove std::move in code
-  # like "A foo(ConvertibleToA a) { return std::move(a); }", but this code does
-  # not compile (or uses the copy constructor instead) on clang<=3.8. Clang also
-  # has a -Wredundant-move, but it only fires when the types match exactly, so
-  # we can keep it here.
+  # Disable -Wredundant-move and -Wpessimizing-move on GCC>=9. GCC wants to
+  # remove std::move in code like "A foo(ConvertibleToA a) {
+  # return std::move(a); }", but this code does not compile (or uses the copy
+  # constructor instead) on clang<=3.8. Clang also has a -Wredundant-move and
+  # -Wpessimizing-move, but they only fire when the types match exactly, so we
+  # can keep them here.
   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.332265.patch
Type: text/x-patch
Size: 1641 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210322/37e4280c/attachment.bin>


More information about the llvm-commits mailing list