[llvm] 76d6bce - gn build: Make scudo cflags more consistent with the cmake build.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 10:06:10 PST 2020


Author: Peter Collingbourne
Date: 2020-02-11T10:05:48-08:00
New Revision: 76d6bce629458a37470cef304df3bc35f042eace

URL: https://github.com/llvm/llvm-project/commit/76d6bce629458a37470cef304df3bc35f042eace
DIFF: https://github.com/llvm/llvm-project/commit/76d6bce629458a37470cef304df3bc35f042eace.diff

LOG: gn build: Make scudo cflags more consistent with the cmake build.

Added: 
    

Modified: 
    llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/BUILD.gn
    llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/tests/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/BUILD.gn
index 14bff487fff5..bcf28662f751 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/BUILD.gn
@@ -1,8 +1,14 @@
 import("//compiler-rt/target.gni")
 
+scudo_cflags = [
+  "-Werror=conversion",
+  "-nostdinc++",
+]
+
 source_set("sources") {
   configs -= [ "//llvm/utils/gn/build:llvm_code" ]
   configs += [ "//llvm/utils/gn/build:crt_code" ]
+  cflags = scudo_cflags
   sources = [
     "allocator_config.h",
     "atomic_helpers.h",
@@ -47,10 +53,10 @@ source_set("sources") {
   ]
 
   if (current_cpu == "arm" || current_cpu == "arm64") {
-    cflags = [ "-mcrc" ]
+    cflags += [ "-mcrc" ]
   }
   if (current_cpu == "x64") {
-    cflags = [ "-msse4.2" ]
+    cflags += [ "-msse4.2" ]
   }
 
   public_configs = [ ":scudo_config" ]
@@ -59,6 +65,7 @@ source_set("sources") {
 source_set("c_wrapper_sources") {
   configs -= [ "//llvm/utils/gn/build:llvm_code" ]
   configs += [ "//llvm/utils/gn/build:crt_code" ]
+  cflags = scudo_cflags
   sources = [
     # Make `gn format` not collapse this, for sync_source_lists_from_cmake.py.
     "wrappers_c.cpp",
@@ -70,6 +77,7 @@ source_set("c_wrapper_sources") {
 source_set("cxx_wrapper_sources") {
   configs -= [ "//llvm/utils/gn/build:llvm_code" ]
   configs += [ "//llvm/utils/gn/build:crt_code" ]
+  cflags = scudo_cflags
   sources = [
     # Make `gn format` not collapse this, for sync_source_lists_from_cmake.py.
     "wrappers_cpp.cpp",

diff  --git a/llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/tests/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/tests/BUILD.gn
index 3c8ed7353e1a..4574278677aa 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/tests/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/scudo/standalone/tests/BUILD.gn
@@ -1,9 +1,14 @@
 import("//llvm/utils/gn/build/toolchain/compiler.gni")
 import("//llvm/utils/unittest/unittest.gni")
 
+test_cflags = [ "-DSCUDO_DEBUG=1" ]
+
 unittest("ScudoUnitTest") {
   configs += [ "//llvm/utils/gn/build:crt_code" ]
-  deps = [ "//compiler-rt/lib/scudo/standalone:sources" ]
+  cflags = test_cflags
+  deps = [
+    "//compiler-rt/lib/scudo/standalone:sources",
+  ]
   sources = [
     "atomic_test.cpp",
     "bytemap_test.cpp",
@@ -31,6 +36,7 @@ unittest("ScudoUnitTest") {
 
 unittest("ScudoCUnitTest") {
   configs += [ "//llvm/utils/gn/build:crt_code" ]
+  cflags = test_cflags
   deps = [
     "//compiler-rt/lib/scudo/standalone:c_wrapper_sources",
     "//compiler-rt/lib/scudo/standalone:sources",
@@ -44,6 +50,7 @@ unittest("ScudoCUnitTest") {
 
 unittest("ScudoCxxUnitTest") {
   configs += [ "//llvm/utils/gn/build:crt_code" ]
+  cflags = test_cflags
   deps = [
     "//compiler-rt/lib/scudo/standalone:c_wrapper_sources",
     "//compiler-rt/lib/scudo/standalone:cxx_wrapper_sources",
@@ -54,7 +61,7 @@ unittest("ScudoCxxUnitTest") {
     "wrappers_cpp_test.cpp",
   ]
   if (is_clang) {
-    cflags = [ "-Wno-mismatched-new-delete" ]
+    cflags += [ "-Wno-mismatched-new-delete" ]
   }
   has_custom_main = true
 }


        


More information about the llvm-commits mailing list