Skip to content

Commit

Permalink
gn build: Make scudo cflags more consistent with the cmake build.
Browse files Browse the repository at this point in the history
  • Loading branch information
pcc committed Feb 11, 2020
1 parent 99451b4 commit 76d6bce
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 10 additions & 2 deletions 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",
Expand Down Expand Up @@ -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" ]
Expand All @@ -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",
Expand All @@ -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",
Expand Down
@@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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
}

0 comments on commit 76d6bce

Please sign in to comment.