From daeaaf51d07ac8c670cbd51bd6a296ca83aca642 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 9 May 2017 17:13:55 -0700 Subject: [PATCH] Move rtti configs from compiler/BUILD.gn to config/BUILD.gn. (#65) --- build/config/BUILD.gn | 20 ++++++++++++++++++++ build/config/BUILDCONFIG.gn | 8 +++----- build/config/compiler/BUILD.gn | 34 +++++++++------------------------- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/build/config/BUILD.gn b/build/config/BUILD.gn index 84d393de88068..e372e7ab77be8 100644 --- a/build/config/BUILD.gn +++ b/build/config/BUILD.gn @@ -231,3 +231,23 @@ config("precompiled_headers") { cflags = [ "/FI$precompiled_header" ] } } + +# rtti ------------------------------------------------------------------------ +# +# Allows turning Run-Time Type Identification on or off. + +config("rtti") { + if (is_win) { + cflags_cc = [ "/GR" ] + } +} + +config("no_rtti") { + if (is_win) { + cflags_cc = [ "/GR-" ] + } else { + rtti_flags = [ "-fno-rtti" ] + cflags_cc = rtti_flags + cflags_objcc = rtti_flags + } +} diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn index 8f03cd8e59c4c..8f4bb8f6276a2 100644 --- a/build/config/BUILDCONFIG.gn +++ b/build/config/BUILDCONFIG.gn @@ -412,11 +412,11 @@ if (!is_clang && (is_asan || is_lsan || is_tsan || is_msan)) { # duplication in each target below. _native_compiler_configs = [ "//build/config:feature_flags", + "//build/config:no_rtti", "//build/config/compiler:compiler", "//build/config/compiler:compiler_arm_fpu", "//build/config/compiler:chromium_code", "//build/config/compiler:default_include_dirs", - "//build/config/compiler:no_rtti", "//build/config/compiler:runtime_library", ] if (is_win) { @@ -448,9 +448,7 @@ if (is_fnl) { } if (is_clang) { - _native_compiler_configs += [ - "//build/config/clang:extra_warnings", - ] + _native_compiler_configs += [ "//build/config/clang:extra_warnings" ] } # Optimizations and debug checking. @@ -617,7 +615,7 @@ if (is_win) { host_toolchain = "//build/toolchain/mac:clang_x64" set_default_toolchain(host_toolchain) } else if (is_ios) { - import("//build/config/ios/ios_sdk.gni") # For use_ios_simulator + import("//build/config/ios/ios_sdk.gni") # For use_ios_simulator host_toolchain = "//build/toolchain/mac:clang_x64" if (use_ios_simulator) { set_default_toolchain("//build/toolchain/mac:ios_clang_x64") diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 598bf4a1915b0..83026047d207f 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -423,7 +423,8 @@ config("compiler") { defines += [ "HAVE_SYS_UIO_H" ] # Use gold for Android for most CPU architectures. - if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm" || current_cpu == "arm64") { + if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm" || + current_cpu == "arm64") { ldflags += [ "-fuse-ld=gold" ] if (is_clang) { # Let clang find the ld.gold in the NDK. @@ -434,7 +435,7 @@ config("compiler") { ldflags += [ "-Wl,--no-undefined", - "-Wl,--exclude-libs,ALL" + "-Wl,--exclude-libs,ALL", ] if (current_cpu == "arm") { ldflags += [ @@ -573,15 +574,16 @@ config("runtime_library") { # also require C++14. # Tracked in https://fuchsia.atlassian.net/browse/TO-61 if (is_linux && current_cpu != "x86") { - cflags_cc += [ - "-stdlib=libc++" - ] + cflags_cc += [ "-stdlib=libc++" ] ldflags += [ "-stdlib=libc++", "-static-libstdc++", + # Remove one the toolchain distribution is fixed # https://github.com/flutter/flutter/issues/6145 - "-Wl,-Bstatic", "-lc++abi", "-Wl,-Bdynamic", + "-Wl,-Bstatic", + "-lc++abi", + "-Wl,-Bdynamic", "-fuse-ld=lld", ] } @@ -602,6 +604,7 @@ if (is_win) { default_warning_flags += [ # Permanent. "/wd4091", # typedef warning from dbghelp.h + # Investigate. "/wd4312", # int to pointer of greater size conversion. "/wd4838", # Narrowing conversion required. @@ -797,25 +800,6 @@ config("no_chromium_code") { cflags_cc += default_warning_flags_cc } -# rtti ------------------------------------------------------------------------ -# -# Allows turning Run-Time Type Identification on or off. - -config("rtti") { - if (is_win) { - cflags_cc = [ "/GR" ] - } -} -config("no_rtti") { - if (is_win) { - cflags_cc = [ "/GR-" ] - } else { - rtti_flags = [ "-fno-rtti" ] - cflags_cc = rtti_flags - cflags_objcc = rtti_flags - } -} - # Warnings --------------------------------------------------------------------- # This will generate warnings when using Clang if code generates exit-time