Chromium Code Reviews| Index: build/config/compiler/BUILD.gn |
| diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
| index a022d3f19f850c626caded10cb1b9ec2772bca5d..bf73bbd41f5bf9a4d34a18da026f7256ddd9cd98 100644 |
| --- a/build/config/compiler/BUILD.gn |
| +++ b/build/config/compiler/BUILD.gn |
| @@ -48,15 +48,7 @@ declare_args() { |
| # with some utilities such as icecc and ccache. Requires gold and |
| # gcc >= 4.8 or clang. |
| # http://gcc.gnu.org/wiki/DebugFission |
| - use_debug_fission = |
| - !is_win && use_gold && linux_use_bundled_binutils && !use_ccache |
| - |
| - if (is_win) { |
| - # Whether the VS xtree header has been patched to disable warning 4702. If |
| - # it has, then we don't need to disable 4702 (unreachable code warning). |
| - # The patch is preapplied to the internal toolchain and hence all bots. |
| - msvs_xtree_patched = false |
| - } |
| + use_debug_fission = use_gold && linux_use_bundled_binutils && !use_ccache |
| } |
| # default_include_dirs --------------------------------------------------------- |
| @@ -72,9 +64,7 @@ config("default_include_dirs") { |
| } |
| # TODO(GYP): is_ubsan, is_ubsan_vptr |
| -if (!is_win) { |
| - using_sanitizer = is_asan || is_lsan || is_tsan || is_msan |
| -} |
| +using_sanitizer = is_asan || is_lsan || is_tsan || is_msan |
| # compiler --------------------------------------------------------------------- |
| # |
| @@ -91,121 +81,81 @@ config("compiler") { |
| ldflags = [] |
| defines = [] |
| - # In general, Windows is totally different, but all the other builds share |
| - # some common GCC configuration. This section sets up Windows and the common |
| - # GCC flags, and then we handle the other non-Windows platforms specifically |
| - # below. |
| - if (is_win) { |
| - # Windows compiler flags setup. |
| - # ----------------------------- |
| - cflags += [ |
| - "/Gy", # Enable function-level linking. |
| - "/GS", # Enable buffer security checking. |
| - "/FS", # Preserve previous PDB behavior. |
| - ] |
| + # Common GCC compiler flags setup. |
| + # -------------------------------- |
| + cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204 |
| + cflags_cc += [ |
| + "-fno-threadsafe-statics", |
| - # Building with Clang on Windows is a work in progress and very |
| - # experimental. See crbug.com/82385. |
| - # Keep this in sync with the similar block in build/common.gypi |
| - if (is_clang) { |
| - cflags += [ |
| - # Many files use intrinsics without including this header. |
| - # TODO(hans): Fix those files, or move this to sub-GYPs. |
| - "/FIIntrin.h", |
| - ] |
| + # Not exporting C++ inline functions can generally be applied anywhere |
| + # so we do so here. Normal function visibility is controlled by |
| + # //build/config/gcc:symbol_visibility_hidden. |
| + "-fvisibility-inlines-hidden", |
| + ] |
| - if (visual_studio_version == "2013") { |
| - cflags += [ "-fmsc-version=1800" ] |
| - } else if (visual_studio_version == "2015") { |
| - cflags += [ "-fmsc-version=1900" ] |
| - } |
| + # Stack protection. |
| + if (is_mac) { |
| + cflags += [ "-fstack-protector-all" ] |
| + } else if (is_linux) { |
| + cflags += [ |
| + "-fstack-protector", |
| + "--param=ssp-buffer-size=4", |
| + ] |
| + } |
| - if (current_cpu == "x86") { |
| - cflags += [ |
| - "/fallback", |
| - "-m32", |
| - ] |
| - } else { |
| - cflags += [ "-m64" ] |
| - } |
| - } |
| - } else { |
| - # Common GCC compiler flags setup. |
| - # -------------------------------- |
| - cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204 |
| - cflags_cc += [ |
| - "-fno-threadsafe-statics", |
| + # Linker warnings. |
| + if (!(is_chromeos && current_cpu == "arm") && !is_mac && !is_ios) { |
| + # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 |
|
jamesr
2015/11/09 17:41:58
we don't have chromeos, but that's for a future pa
Petr Hosek
2015/11/10 01:35:54
That'll be removed in a follow-up patch together w
|
| + ldflags += [ "-Wl,--fatal-warnings" ] |
| + } |
| - # Not exporting C++ inline functions can generally be applied anywhere |
| - # so we do so here. Normal function visibility is controlled by |
| - # //build/config/gcc:symbol_visibility_hidden. |
| - "-fvisibility-inlines-hidden", |
| + # Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer and |
| + # MemorySanitizer |
| + if (using_sanitizer) { |
| + cflags += [ |
| + "-fno-omit-frame-pointer", |
| + "-gline-tables-only", |
| + ] |
| + } |
| + if (is_asan) { |
| + asan_blacklist_path = |
| + rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) |
| + cflags += [ |
| + "-fsanitize=address", |
| + "-fsanitize-blacklist=$asan_blacklist_path", |
| ] |
| - |
| - # Stack protection. |
| if (is_mac) { |
| - cflags += [ "-fstack-protector-all" ] |
| - } else if (is_linux) { |
| - cflags += [ |
| - "-fstack-protector", |
| - "--param=ssp-buffer-size=4", |
| - ] |
| - } |
| - |
| - # Linker warnings. |
| - if (!(is_chromeos && current_cpu == "arm") && !is_mac && !is_ios) { |
| - # TODO(jochen): Enable this on chromeos on arm. http://crbug.com/356580 |
| - ldflags += [ "-Wl,--fatal-warnings" ] |
| - } |
| - |
| - # Common options for AddressSanitizer, LeakSanitizer, ThreadSanitizer and |
| - # MemorySanitizer |
| - if (using_sanitizer) { |
| - cflags += [ |
| - "-fno-omit-frame-pointer", |
| - "-gline-tables-only", |
| - ] |
| - } |
| - if (is_asan) { |
| - asan_blacklist_path = |
| - rebase_path("//tools/memory/asan/blacklist.txt", root_build_dir) |
| - cflags += [ |
| - "-fsanitize=address", |
| - "-fsanitize-blacklist=$asan_blacklist_path", |
| - ] |
| - if (is_mac) { |
| - cflags += [ "-mllvm -asan-globals=0" ] # http://crbug.com/352073 |
| - # TODO(GYP): deal with mac_bundles. |
| - } |
| - } |
| - if (is_lsan) { |
| - cflags += [ "-fsanitize=leak" ] |
| - } |
| - if (is_tsan) { |
| - tsan_blacklist_path = |
| - rebase_path("//tools/memory/tsan_v2/ignores.txt", root_build_dir) |
| - cflags += [ |
| - "-fsanitize=thread", |
| - "-fsanitize-blacklist=$tsan_blacklist_path", |
| - ] |
| - } |
| - if (is_msan) { |
| - msan_blacklist_path = |
| - rebase_path("//tools/msan/blacklist.txt", root_build_dir) |
| - cflags += [ |
| - "-fsanitize=memory", |
| - "-fsanitize-memory-track-origins=$msan_track_origins", |
| - "-fsanitize-blacklist=$msan_blacklist_path", |
| - ] |
| + cflags += [ "-mllvm -asan-globals=0" ] # http://crbug.com/352073 |
| + # TODO(GYP): deal with mac_bundles. |
| } |
| + } |
| + if (is_lsan) { |
| + cflags += [ "-fsanitize=leak" ] |
| + } |
| + if (is_tsan) { |
| + tsan_blacklist_path = |
| + rebase_path("//tools/memory/tsan_v2/ignores.txt", root_build_dir) |
| + cflags += [ |
| + "-fsanitize=thread", |
| + "-fsanitize-blacklist=$tsan_blacklist_path", |
| + ] |
| + } |
| + if (is_msan) { |
| + msan_blacklist_path = |
| + rebase_path("//tools/msan/blacklist.txt", root_build_dir) |
| + cflags += [ |
| + "-fsanitize=memory", |
| + "-fsanitize-memory-track-origins=$msan_track_origins", |
| + "-fsanitize-blacklist=$msan_blacklist_path", |
| + ] |
| + } |
| - if (use_custom_libcxx) { |
| - cflags_cc += [ "-nostdinc++" ] |
| - include_dirs = [ |
| - "//buildtools/third_party/libc++/trunk/include", |
| - "//buildtools/third_party/libc++abi/trunk/include", |
| - ] |
| - } |
| + if (use_custom_libcxx) { |
| + cflags_cc += [ "-nostdinc++" ] |
| + include_dirs = [ |
| + "//buildtools/third_party/libc++/trunk/include", |
| + "//buildtools/third_party/libc++abi/trunk/include", |
| + ] |
| } |
| if (is_clang && is_debug) { |
| @@ -505,7 +455,7 @@ config("compiler") { |
| # TODO(thakis): Eventually switch this to c++11 instead, |
| # http://crbug.com/427584 |
| cflags_cc += [ "-std=gnu++11" ] |
| - } else if (!is_win) { |
| + } else { |
| cflags_cc += [ "-std=c++11" ] |
| } |
| @@ -711,34 +661,6 @@ config("runtime_library") { |
| if (is_component_build) { |
| # Component mode: dynamic CRT. |
| defines += [ "COMPONENT_BUILD" ] |
| - if (is_win) { |
| - # Since the library is shared, it requires exceptions or will give errors |
| - # about things not matching, so keep exceptions on. |
| - if (is_debug) { |
| - cflags += [ "/MDd" ] |
| - } else { |
| - cflags += [ "/MD" ] |
| - } |
| - } |
| - } else { |
| - # Static CRT. |
| - if (is_win) { |
| - if (is_debug) { |
| - cflags += [ "/MTd" ] |
| - } else { |
| - cflags += [ "/MT" ] |
| - } |
| - } |
| - } |
| - |
| - if (is_win) { |
| - defines += [ |
| - "__STD_C", |
| - "_CRT_RAND_S", |
| - "_CRT_SECURE_NO_DEPRECATE", |
| - "_HAS_EXCEPTIONS=0", |
| - "_SCL_SECURE_NO_DEPRECATE", |
| - ] |
| } |
| # Android standard library setup. |
| @@ -825,196 +747,73 @@ config("runtime_library") { |
| default_warning_flags = [] |
| default_warning_flags_cc = [] |
| -if (is_win) { |
| - if (!is_clang || current_cpu != "x86") { |
| - default_warning_flags += [ "/WX" ] # Treat warnings as errors. |
| - } |
| - default_warning_flags += [ |
| - # Warnings permanently disabled: |
| - |
| - # TODO(GYP) The GYP build doesn't have this globally enabled but disabled |
| - # for a bunch of individual targets. Re-enable this globally when those |
| - # targets are fixed. |
| - "/wd4018", # Comparing signed and unsigned values. |
| - |
| - # C4127: conditional expression is constant |
| - # This warning can in theory catch dead code and other problems, but |
| - # triggers in far too many desirable cases where the conditional |
| - # expression is either set by macros or corresponds some legitimate |
| - # compile-time constant expression (due to constant template args, |
| - # conditionals comparing the sizes of different types, etc.). Some of |
| - # these can be worked around, but it's not worth it. |
| - "/wd4127", |
| - |
| - # C4251: 'identifier' : class 'type' needs to have dll-interface to be |
| - # used by clients of class 'type2' |
| - # This is necessary for the shared library build. |
| - "/wd4251", |
| - |
| - # C4351: new behavior: elements of array 'array' will be default |
| - # initialized |
| - # This is a silly "warning" that basically just alerts you that the |
| - # compiler is going to actually follow the language spec like it's |
| - # supposed to, instead of not following it like old buggy versions did. |
| - # There's absolutely no reason to turn this on. |
| - "/wd4351", |
| - |
| - # C4355: 'this': used in base member initializer list |
| - # It's commonly useful to pass |this| to objects in a class' initializer |
| - # list. While this warning can catch real bugs, most of the time the |
| - # constructors in question don't attempt to call methods on the passed-in |
| - # pointer (until later), and annotating every legit usage of this is |
| - # simply more hassle than the warning is worth. |
| - "/wd4355", |
| - |
| - # C4503: 'identifier': decorated name length exceeded, name was |
| - # truncated |
| - # This only means that some long error messages might have truncated |
| - # identifiers in the presence of lots of templates. It has no effect on |
| - # program correctness and there's no real reason to waste time trying to |
| - # prevent it. |
| - "/wd4503", |
| - |
| - # C4611: interaction between 'function' and C++ object destruction is |
| - # non-portable |
| - # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN |
| - # suggests using exceptions instead of setjmp/longjmp for C++, but |
| - # Chromium code compiles without exception support. We therefore have to |
| - # use setjmp/longjmp for e.g. JPEG decode error handling, which means we |
| - # have to turn off this warning (and be careful about how object |
| - # destruction happens in such cases). |
| - "/wd4611", |
| - |
| - # Warnings to evaluate and possibly fix/reenable later: |
| - |
| - "/wd4100", # Unreferenced formal function parameter. |
| - "/wd4121", # Alignment of a member was sensitive to packing. |
| - "/wd4244", # Conversion: possible loss of data. |
| - "/wd4481", # Nonstandard extension: override specifier. |
| - "/wd4505", # Unreferenced local function has been removed. |
| - "/wd4510", # Default constructor could not be generated. |
| - "/wd4512", # Assignment operator could not be generated. |
| - "/wd4610", # Class can never be instantiated, constructor required. |
| - "/wd4996", # Deprecated function warning. |
| - ] |
| +# Common GCC warning setup. |
| +default_warning_flags += [ |
| + # Enables. |
| + "-Wendif-labels", # Weird old-style text after an #endif. |
| + "-Werror", # Warnings as errors. |
| - # VS xtree header file needs to be patched or 4702 (unreachable code |
| - # warning) is reported if _HAS_EXCEPTIONS=0. Disable the warning if xtree is |
| - # not patched. |
| - if (!msvs_xtree_patched && |
| - exec_script("../../win_is_xtree_patched.py", [], "value") == 0) { |
| - default_warning_flags += [ "/wd4702" ] # Unreachable code. |
| - } |
| + # Disables. |
| + "-Wno-missing-field-initializers", # "struct foo f = {0};" |
| + "-Wno-unused-parameter", # Unused function parameters. |
| +] |
| - # Building with Clang on Windows is a work in progress and very |
| - # experimental. See crbug.com/82385. |
| - # Keep this in sync with the similar block in build/common.gypi |
| - if (is_clang) { |
| - default_warning_flags += [ |
| - # TODO(hans): Make this list shorter eventually. |
| - "-Qunused-arguments", |
| - "-Wno-c++11-compat-deprecated-writable-strings", |
| - "-Wno-deprecated-declarations", |
| - "-Wno-empty-body", |
| - "-Wno-enum-conversion", |
| - "-Wno-extra-tokens", |
| - "-Wno-ignored-attributes", |
| - "-Wno-incompatible-pointer-types", |
| - "-Wno-int-to-void-pointer-cast", |
| - "-Wno-invalid-noreturn", |
| - "-Wno-logical-op-parentheses", |
| - "-Wno-microsoft", |
| - "-Wno-missing-braces", |
| - "-Wno-missing-declarations", |
| - "-Wno-msvc-include", |
| - "-Wno-null-dereference", |
| - "-Wno-overloaded-virtual", |
| - "-Wno-parentheses", |
| - "-Wno-pointer-sign", |
| - "-Wno-reorder", |
| - "-Wno-return-type-c-linkage", |
| - "-Wno-self-assign", |
| - "-Wno-sometimes-uninitialized", |
| - "-Wno-switch", |
| - "-Wno-tautological-compare", |
| - "-Wno-unknown-pragmas", |
| - "-Wno-unsequenced", |
| - "-Wno-unused-function", |
| - "-Wno-unused-private-field", |
| - "-Wno-unused-value", |
| - "-Wno-unused-variable", |
| - "-Wno-unused-local-typedef", # http://crbug.com/411648 |
| - "-Wno-inconsistent-missing-override", #http://crbug.com/428099 |
| - ] |
| - } |
| -} else { |
| - # Common GCC warning setup. |
| - default_warning_flags += [ |
| - # Enables. |
| - "-Wendif-labels", # Weird old-style text after an #endif. |
| - "-Werror", # Warnings as errors. |
| - |
| - # Disables. |
| - "-Wno-missing-field-initializers", # "struct foo f = {0};" |
| - "-Wno-unused-parameter", # Unused function parameters. |
| - ] |
| - |
| - if (is_mac) { |
| - default_warning_flags += [ "-Wnewline-eof" ] |
| - if (!is_nacl) { |
| - # When compiling Objective-C, warns if a method is used whose |
| - # availability is newer than the deployment target. This is not |
| - # required when compiling Chrome for iOS. |
| - default_warning_flags += [ "-Wpartial-availability" ] |
| - } |
| +if (is_mac) { |
| + default_warning_flags += [ "-Wnewline-eof" ] |
| + if (!is_nacl) { |
| + # When compiling Objective-C, warns if a method is used whose |
| + # availability is newer than the deployment target. This is not |
| + # required when compiling Chrome for iOS. |
| + default_warning_flags += [ "-Wpartial-availability" ] |
| } |
| +} |
| - if (gcc_version >= 48) { |
| - default_warning_flags_cc += [ |
| - # See comment for -Wno-c++11-narrowing. |
| - "-Wno-narrowing", |
| +if (gcc_version >= 48) { |
| + default_warning_flags_cc += [ |
| + # See comment for -Wno-c++11-narrowing. |
| + "-Wno-narrowing", |
| - # TODO(thakis): Remove, http://crbug.com/263960 |
| - "-Wno-literal-suffix", |
| - ] |
| - } |
| + # TODO(thakis): Remove, http://crbug.com/263960 |
| + "-Wno-literal-suffix", |
| + ] |
| +} |
| - # Suppress warnings about ABI changes on ARM (Clang doesn't give this |
| - # warning). |
| - if (current_cpu == "arm" && !is_clang) { |
| - default_warning_flags += [ "-Wno-psabi" ] |
| - } |
| +# Suppress warnings about ABI changes on ARM (Clang doesn't give this |
| +# warning). |
| +if (current_cpu == "arm" && !is_clang) { |
| + default_warning_flags += [ "-Wno-psabi" ] |
| +} |
| - if (is_android) { |
| - # Disable any additional warnings enabled by the Android build system but |
| - # which chromium does not build cleanly with (when treating warning as |
| - # errors). |
| - default_warning_flags += [ |
| - "-Wno-extra", |
| - "-Wno-ignored-qualifiers", |
| - "-Wno-type-limits", |
| - ] |
| - default_warning_flags_cc += [ |
| - # Disabling c++0x-compat should be handled in WebKit, but |
| - # this currently doesn't work because gcc_version is not set |
| - # correctly when building with the Android build system. |
| - # TODO(torne): Fix this in WebKit. |
| - "-Wno-error=c++0x-compat", |
| - |
| - # Other things unrelated to -Wextra: |
| - "-Wno-non-virtual-dtor", |
| - "-Wno-sign-promo", |
| - ] |
| - } |
| +if (is_android) { |
| + # Disable any additional warnings enabled by the Android build system but |
| + # which chromium does not build cleanly with (when treating warning as |
| + # errors). |
| + default_warning_flags += [ |
| + "-Wno-extra", |
| + "-Wno-ignored-qualifiers", |
| + "-Wno-type-limits", |
| + ] |
| + default_warning_flags_cc += [ |
| + # Disabling c++0x-compat should be handled in WebKit, but |
| + # this currently doesn't work because gcc_version is not set |
| + # correctly when building with the Android build system. |
| + # TODO(torne): Fix this in WebKit. |
| + "-Wno-error=c++0x-compat", |
| + |
| + # Other things unrelated to -Wextra: |
| + "-Wno-non-virtual-dtor", |
| + "-Wno-sign-promo", |
| + ] |
| +} |
| - if (gcc_version >= 48) { |
| - # Don't warn about the "typedef 'foo' locally defined but not used" |
| - # for gcc 4.8. |
| - # TODO: remove this flag once all builds work. See crbug.com/227506 |
| - default_warning_flags += [ "-Wno-unused-local-typedefs" ] |
| - } |
| +if (gcc_version >= 48) { |
| + # Don't warn about the "typedef 'foo' locally defined but not used" |
| + # for gcc 4.8. |
| + # TODO: remove this flag once all builds work. See crbug.com/227506 |
| + default_warning_flags += [ "-Wno-unused-local-typedefs" ] |
| } |
| + |
| if (is_clang) { |
| default_warning_flags += [ |
| # This warns on using ints as initializers for floats in |
| @@ -1070,39 +869,36 @@ if (is_clang) { |
| # part of Chromium. |
| config("chromium_code") { |
| - if (is_win) { |
| - cflags = [ "/W4" ] # Warning level 4. |
| - } else { |
| - cflags = [ |
| - "-Wall", |
| - |
| - # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't, |
| - # so we specify it explicitly. |
| - # TODO(fischman): remove this if http://llvm.org/PR10448 obsoletes it. |
| - # http://code.google.com/p/chromium/issues/detail?id=90453 |
| - "-Wsign-compare", |
| - ] |
| + cflags = [ |
| + "-Wall", |
| + |
| + # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't, |
| + # so we specify it explicitly. |
| + # TODO(fischman): remove this if http://llvm.org/PR10448 obsoletes it. |
| + # http://code.google.com/p/chromium/issues/detail?id=90453 |
| + "-Wsign-compare", |
| + ] |
| - # In Chromium code, we define __STDC_foo_MACROS in order to get the |
| - # C99 macros on Mac and Linux. |
| - defines = [ |
| - "__STDC_CONSTANT_MACROS", |
| - "__STDC_FORMAT_MACROS", |
| - ] |
| + # In Chromium code, we define __STDC_foo_MACROS in order to get the |
| + # C99 macros on Mac and Linux. |
| + defines = [ |
| + "__STDC_CONSTANT_MACROS", |
| + "__STDC_FORMAT_MACROS", |
| + ] |
| - if (!is_debug && !using_sanitizer && |
| - (!is_linux || !is_clang || is_official_build)) { |
| - # _FORTIFY_SOURCE isn't really supported by Clang now, see |
| - # http://llvm.org/bugs/show_bug.cgi?id=16821. |
| - # It seems to work fine with Ubuntu 12 headers though, so use it in |
| - # official builds. |
| - # |
| - # Non-chromium code is not guaranteed to compile cleanly with |
| - # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are |
| - # disabled, so only do that for Release build. |
| - defines += [ "_FORTIFY_SOURCE=2" ] |
| - } |
| + if (!is_debug && !using_sanitizer && |
| + (!is_linux || !is_clang || is_official_build)) { |
| + # _FORTIFY_SOURCE isn't really supported by Clang now, see |
| + # http://llvm.org/bugs/show_bug.cgi?id=16821. |
| + # It seems to work fine with Ubuntu 12 headers though, so use it in |
| + # official builds. |
| + # |
| + # Non-chromium code is not guaranteed to compile cleanly with |
| + # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are |
| + # disabled, so only do that for Release build. |
| + defines += [ "_FORTIFY_SOURCE=2" ] |
| } |
| + |
| cflags += default_warning_flags |
| cflags_cc = default_warning_flags_cc |
| } |
| @@ -1111,19 +907,6 @@ config("no_chromium_code") { |
| cflags_cc = [] |
| defines = [] |
| - if (is_win) { |
| - cflags += [ |
| - "/W3", # Warning level 3. |
| - "/wd4800", # Disable warning when forcing value to bool. |
| - "/wd4267", # TODO(jschuh): size_t to int. |
| - "/wd4996", # Deprecated function warning. |
| - ] |
| - defines += [ |
| - "_CRT_NONSTDC_NO_WARNINGS", |
| - "_CRT_NONSTDC_NO_DEPRECATE", |
| - ] |
| - } |
| - |
| if (is_linux) { |
| # Don't warn about ignoring the return value from e.g. close(). This is |
| # off by default in some gccs but on by default in others. BSD systems do |
| @@ -1155,16 +938,9 @@ config("no_chromium_code") { |
| # 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 { |
| - cflags_cc = [ "-fno-rtti" ] |
| - } |
| + cflags_cc = [ "-fno-rtti" ] |
| } |
| # Warnings --------------------------------------------------------------------- |
| @@ -1173,8 +949,7 @@ config("no_rtti") { |
| # destructors, which will slow down closing the program. |
| # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600 |
| config("wexit_time_destructors") { |
| - # TODO: Enable on Windows too, http://crbug.com/404525 |
| - if (is_clang && !is_win) { |
| + if (is_clang) { |
| cflags = [ "-Wexit-time-destructors" ] |
| } |
| } |
| @@ -1190,9 +965,6 @@ config("wexit_time_destructors") { |
| # |
| # TODO(jschuh): crbug.com/167187 fix this and delete this config. |
| config("no_size_t_to_int_warning") { |
| - if (is_win && current_cpu == "x64") { |
| - cflags = [ "/wd4267" ] |
| - } |
| } |
| # Some code presumes that pointers to structures/objects are compatible |
| @@ -1216,72 +988,52 @@ config("no_incompatible_pointer_warnings") { |
| # configs += [ "//build/config/compiler/optimize_max" ] |
| # Shared settings for both "optimize" and "optimize_max" configs. |
| -if (is_win) { |
| - common_optimize_on_cflags = [ |
| - "/O2", |
| - "/Ob2", # both explicit and auto inlining. |
| - "/Oy-", # disable omitting frame pointers, must be after /o2. |
| - "/Os", # favor size over speed. |
| - ] |
| - if (!is_asan) { |
| - common_optimize_on_cflags += [ |
| - # Put data in separate COMDATs. This allows the linker |
| - # to put bit-identical constants at the same address even if |
| - # they're unrelated constants, which saves binary size. |
| - # This optimization can't be used when ASan is enabled because |
| - # it is not compatible with the ASan ODR checker. |
| - "/Gw", |
| - ] |
| - } |
| - common_optimize_on_ldflags = [ "/OPT:REF" ] |
| -} else { |
| - common_optimize_on_cflags = [ |
| - # Don't emit the GCC version ident directives, they just end up in the |
| - # .comment section taking up binary size. |
| - "-fno-ident", |
| - |
| - # Put data and code in their own sections, so that unused symbols |
| - # can be removed at link time with --gc-sections. |
| - "-fdata-sections", |
| - "-ffunction-sections", |
| - ] |
| - common_optimize_on_ldflags = [] |
| - |
| - if (is_android) { |
| - if (!using_sanitizer) { |
| - common_optimize_on_cflags += [ "-fomit-frame-pointer" ] |
| - } |
| - |
| - # TODO(jdduke) Re-enable on mips after resolving linking |
| - # issues with libc++ (crbug.com/456380). |
| - if (current_cpu != "mipsel" && current_cpu != "mips64el") { |
| - common_optimize_on_ldflags += [ |
| - # Warn in case of text relocations. |
| - "-Wl,--warn-shared-textrel", |
| - ] |
| - } |
| +common_optimize_on_cflags = [ |
| + # Don't emit the GCC version ident directives, they just end up in the |
| + # .comment section taking up binary size. |
| + "-fno-ident", |
| + |
| + # Put data and code in their own sections, so that unused symbols |
| + # can be removed at link time with --gc-sections. |
| + "-fdata-sections", |
| + "-ffunction-sections", |
| +] |
| +common_optimize_on_ldflags = [] |
| + |
| +if (is_android) { |
| + if (!using_sanitizer) { |
| + common_optimize_on_cflags += [ "-fomit-frame-pointer" ] |
| } |
| - if (is_mac) { |
| - if (symbol_level == 2) { |
| - # Mac dead code stripping requires symbols. |
| - common_optimize_on_ldflags += [ "-Wl,-dead_strip" ] |
| - } |
| - } else { |
| - # Non-Mac Posix linker flags. |
| + # TODO(jdduke) Re-enable on mips after resolving linking |
| + # issues with libc++ (crbug.com/456380). |
| + if (current_cpu != "mipsel" && current_cpu != "mips64el") { |
| common_optimize_on_ldflags += [ |
| - # Specifically tell the linker to perform optimizations. |
| - # See http://lwn.net/Articles/192624/ . |
| - "-Wl,-O1", |
| - "-Wl,--gc-sections", |
| + # Warn in case of text relocations. |
| + "-Wl,--warn-shared-textrel", |
| ] |
| + } |
| +} |
| - if (!using_sanitizer) { |
| - # Functions interposed by the sanitizers can make ld think |
| - # that some libraries aren't needed when they actually are, |
| - # http://crbug.com/234010. As workaround, disable --as-needed. |
| - common_optimize_on_ldflags += [ "-Wl,--as-needed" ] |
| - } |
| +if (is_mac) { |
| + if (symbol_level == 2) { |
| + # Mac dead code stripping requires symbols. |
| + common_optimize_on_ldflags += [ "-Wl,-dead_strip" ] |
| + } |
| +} else { |
| + # Non-Mac Posix linker flags. |
| + common_optimize_on_ldflags += [ |
| + # Specifically tell the linker to perform optimizations. |
| + # See http://lwn.net/Articles/192624/ . |
| + "-Wl,-O1", |
| + "-Wl,--gc-sections", |
| + ] |
| + |
| + if (!using_sanitizer) { |
| + # Functions interposed by the sanitizers can make ld think |
| + # that some libraries aren't needed when they actually are, |
| + # http://crbug.com/234010. As workaround, disable --as-needed. |
| + common_optimize_on_ldflags += [ "-Wl,--as-needed" ] |
| } |
| } |
| @@ -1289,9 +1041,7 @@ if (is_win) { |
| config("optimize") { |
| cflags = common_optimize_on_cflags |
| ldflags = common_optimize_on_ldflags |
| - if (is_win) { |
| - cflags += [ "/Os" ] # favor size over speed. |
| - } else if (is_android || is_ios) { |
| + if (is_android || is_ios) { |
| cflags += [ "-Os" ] # Favor size over speed. |
| } else { |
| cflags += [ "-O2" ] |
| @@ -1300,13 +1050,7 @@ config("optimize") { |
| # Turn off optimizations. |
| config("no_optimize") { |
| - if (is_win) { |
| - cflags = [ |
| - "/Od", # Disable optimization. |
| - "/Ob0", # Disable all inlining (on by default). |
| - "/RTC1", # Runtime checks for stack frame and uninitialized variables. |
| - ] |
| - } else if (is_android && !android_full_debug) { |
| + if (is_android && !android_full_debug) { |
| # On Android we kind of optimize some things that don't affect debugging |
| # much even when optimization is disabled to get the binary size down. |
| cflags = [ |
| @@ -1329,27 +1073,8 @@ config("no_optimize") { |
| config("optimize_max") { |
| cflags = common_optimize_on_cflags |
| ldflags = common_optimize_on_ldflags |
| - if (is_win) { |
| - cflags -= [ "/Os" ] |
| - cflags += [ "/Ot" ] # Favor speed over size. |
| - if (is_official_build) { |
| - # TODO(GYP): TODO(dpranke): Should these only be on in an official |
| - # build, or on all the time? For now we'll require official build so |
| - # that the compile is clean. |
| - cflags += [ |
| - "/GL", # Whole program optimization. |
| - # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. |
| - # Probably anything that this would catch that wouldn't be caught in a |
| - # normal build isn't going to actually be a bug, so the incremental |
| - # value of C4702 for PGO builds is likely very small. |
| - "/wd4702", |
| - ] |
| - ldflags += [ "/LTCG" ] |
| - } |
| - } else { |
| - cflags += [ "-O2" ] |
| - } |
| + cflags += [ "-O2" ] |
| } |
| # The default optimization applied to all targets. This will be equivalent to |
| @@ -1369,43 +1094,26 @@ config("default_optimization") { |
| # Symbols ---------------------------------------------------------------------- |
| config("symbols") { |
| - if (is_win) { |
| - import("//build/toolchain/goma.gni") |
| - if (use_goma) { |
| - cflags = [ "/Z7" ] # No PDB file |
| - } else { |
| - cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. |
| - } |
| - ldflags = [ "/DEBUG" ] |
| - } else { |
| - cflags = [ "-g2" ] |
| - if (use_debug_fission) { |
| - cflags += [ "-gsplit-dwarf" ] |
| - } |
| - asmflags = cflags |
| - ldflags = [] |
| + cflags = [ "-g2" ] |
| + if (use_debug_fission) { |
| + cflags += [ "-gsplit-dwarf" ] |
| } |
| + asmflags = cflags |
| + ldflags = [] |
| } |
| config("minimal_symbols") { |
| - if (is_win) { |
| - # Linker symbols for backtraces only. |
| - ldflags = [ "/DEBUG" ] |
| - } else { |
| - cflags = [ "-g1" ] |
| - if (use_debug_fission) { |
| - cflags += [ "-gsplit-dwarf" ] |
| - } |
| - asmflags = cflags |
| - ldflags = [] |
| + cflags = [ "-g1" ] |
| + if (use_debug_fission) { |
| + cflags += [ "-gsplit-dwarf" ] |
| } |
| + asmflags = cflags |
| + ldflags = [] |
| } |
| config("no_symbols") { |
| - if (!is_win) { |
| - cflags = [ "-g0" ] |
| - asmflags = cflags |
| - } |
| + cflags = [ "-g0" ] |
| + asmflags = cflags |
| } |
| # Default symbols. |