[llvm] r337492 - Disable GCC's -Wclass-memaccess warning
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 19 13:14:46 PDT 2018
Author: rnk
Date: Thu Jul 19 13:14:46 2018
New Revision: 337492
URL: http://llvm.org/viewvc/llvm-project?rev=337492&view=rev
Log:
Disable GCC's -Wclass-memaccess warning
It fires on things like SmallVector<std::pair<int, int>>, where we
intentionally use memcpy instead of calling the assignment operator.
This warning fires in practically every LLVM TU, so we have to do
something about it, even if we aren't interested in being 100% warning
clean with GCC.
Reported as PR37337
Modified:
llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=337492&r1=337491&r2=337492&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Thu Jul 19 13:14:46 2018
@@ -579,6 +579,11 @@ if (LLVM_ENABLE_WARNINGS AND (LLVM_COMPI
append_if(USE_NO_UNINITIALIZED "-Wno-uninitialized" CMAKE_CXX_FLAGS)
append_if(USE_NO_MAYBE_UNINITIALIZED "-Wno-maybe-uninitialized" CMAKE_CXX_FLAGS)
+ # Disable -Wclass-memaccess, a C++-only warning from GCC 8 that fires on
+ # LLVM's ADT classes.
+ check_cxx_compiler_flag("-Wclass-memaccess" CXX_SUPPORTS_CLASS_MEMACCESS_FLAG)
+ append_if(CXX_SUPPORTS_CLASS_MEMACCESS_FLAG "-Wno-class-memaccess" CMAKE_CXX_FLAGS)
+
# Check if -Wnon-virtual-dtor warns even though the class is marked final.
# If it does, don't add it. So it won't be added on clang 3.4 and older.
# This also catches cases when -Wnon-virtual-dtor isn't supported by
More information about the llvm-commits
mailing list