[llvm] 3871ad3 - [gn build] port some -Wno flags for gcc from the cmake build.

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 05:10:41 PDT 2020


Author: Nico Weber
Date: 2020-06-04T08:10:29-04:00
New Revision: 3871ad366b11710afc0f8c1397ec6ffc4be64736

URL: https://github.com/llvm/llvm-project/commit/3871ad366b11710afc0f8c1397ec6ffc4be64736
DIFF: https://github.com/llvm/llvm-project/commit/3871ad366b11710afc0f8c1397ec6ffc4be64736.diff

LOG: [gn build] port some -Wno flags for gcc from the cmake build.

Added: 
    

Modified: 
    llvm/utils/gn/build/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index a1a4b065d6ff..f926eee5afe6 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -19,6 +19,9 @@ declare_args() {
   # http://blog.llvm.org/2019/11/deterministic-builds-with-clang-and-lld.html
   # for more information.
   use_relative_paths_in_debug_info = false
+
+  # The version of host gcc. Ignored if is_clang is true.
+  gcc_version = 9
 }
 
 assert(!llvm_build_instrumented_coverage || is_clang,
@@ -155,6 +158,23 @@ config("compiler_defaults") {
         # useful.
         "-Wno-noexcept-type",
       ]
+      if (gcc_version >= 8) {
+        cflags_cc += [
+          # Disable -Wclass-memaccess, a C++-only warning from GCC 8 that fires
+          # on LLVM's ADT classes.
+          "-Wno-class-memaccess",
+        ]
+      }
+      if (gcc_version >= 9) {
+        cflags_cc += [
+          # 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.
+          "-Wno-redundant-move",
+        ]
+      }
     }
     if (is_clang && use_goma) {
       # goma converts all paths to lowercase on the server, breaking this


        


More information about the llvm-commits mailing list