From 76d6bce629458a37470cef304df3bc35f042eace Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 11 Feb 2020 10:03:35 -0800 Subject: [PATCH] gn build: Make scudo cflags more consistent with the cmake build. --- .../compiler-rt/lib/scudo/standalone/BUILD.gn | 12 ++++++++++-- .../compiler-rt/lib/scudo/standalone/tests/BUILD.gn | 11 +++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) 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 14bff487fff5a..bcf28662f7511 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 3c8ed7353e1a4..4574278677aa2 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 }