| Index: build/config/compiler/BUILD.gn
|
| diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
|
| index 0e28e7da8be6dce3e5b5d93500416c894b8513cd..f7797958044ce13f30fbba5f579e81fd282ed097 100644
|
| --- a/build/config/compiler/BUILD.gn
|
| +++ b/build/config/compiler/BUILD.gn
|
| @@ -15,6 +15,7 @@ if (is_posix) {
|
| }
|
|
|
| import("//build/toolchain/ccache.gni")
|
| +import("//build/config/sanitizers/sanitizers.gni")
|
|
|
| declare_args() {
|
| # Normally, Android builds are lightly optimized, even for debug builds, to
|
| @@ -101,6 +102,32 @@ config("compiler") {
|
| "/GS", # Enable buffer security checking.
|
| "/FS", # Preserve previous PDB behavior.
|
| ]
|
| +
|
| + # 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",
|
| + ]
|
| +
|
| + if (visual_studio_version == "2013") {
|
| + cflags += [ "-fmsc-version=1800" ]
|
| + } else if (visual_studio_version == "2015") {
|
| + cflags += [ "-fmsc-version=1900" ]
|
| + }
|
| +
|
| + if (current_cpu == "x86") {
|
| + cflags += [
|
| + "/fallback",
|
| + "-m32",
|
| + ]
|
| + } else {
|
| + cflags += [ "-m64" ]
|
| + }
|
| + }
|
| } else {
|
| # Common GCC compiler flags setup.
|
| # --------------------------------
|
| @@ -125,7 +152,7 @@ config("compiler") {
|
| }
|
|
|
| # Linker warnings.
|
| - if (!(is_chromeos && current_cpu == "arm") && !is_mac) {
|
| + 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" ]
|
| }
|
| @@ -139,12 +166,45 @@ config("compiler") {
|
| ]
|
| }
|
| if (is_asan) {
|
| - cflags += [ "-fsanitize=address" ]
|
| + 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",
|
| + ]
|
| + }
|
| +
|
| + 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) {
|
| @@ -186,6 +246,11 @@ config("compiler") {
|
| "-arch",
|
| "i386",
|
| ]
|
| + } else if (current_cpu == "arm") {
|
| + common_mac_flags += [
|
| + "-arch",
|
| + "armv7",
|
| + ]
|
| }
|
|
|
| cflags += common_mac_flags
|
| @@ -340,6 +405,13 @@ config("compiler") {
|
| } else {
|
| cflags += [ "-funwind-tables" ]
|
| }
|
| +
|
| + if (is_clang && !is_nacl && !is_debug) {
|
| + # Non-unique section names appears to make linker dead stripping
|
| + # less effective. See http://crbug.com/483026#c20
|
| + # TODO(hans): Remove this if resolved upstream.
|
| + cflags += [ "-funique-section-names" ]
|
| + }
|
| }
|
|
|
| # Linux/Android common flags setup.
|
| @@ -378,9 +450,6 @@ config("compiler") {
|
| # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html
|
| "-fuse-ld=gold",
|
|
|
| - # TODO(brettw) common.gypi has this only for target toolset.
|
| - "-Wl,--icf=safe",
|
| -
|
| # Experimentation found that using four linking threads
|
| # saved ~20% of link time.
|
| # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
|
| @@ -392,6 +461,21 @@ config("compiler") {
|
| #"-Wl,--thread-count=4",
|
| ]
|
|
|
| + if (!is_asan && !is_msan && !is_lsan && !is_tsan) {
|
| + # TODO(brettw) common.gypi has this only for target toolset.
|
| + if (current_cpu == "x64") {
|
| + # --icf=safe disables much more folding on x86_64 than elsewhere, see
|
| + # http://crbug.com/492177. Turning it on saves over 12 MB of binary
|
| + # size, but it seems to regress cold startup time by over a second
|
| + # (see http://crbug.com/492809).
|
| + # TODO(thakis): Check if disabling ICF would inmprove android cold start
|
| + # times by several seconds too.
|
| + ldflags += [ "-Wl,--icf=safe" ]
|
| + } else {
|
| + ldflags += [ "-Wl,--icf=all" ]
|
| + }
|
| + }
|
| +
|
| # TODO(thestig): Make this flag work with GN.
|
| #if (!is_official_build && !is_chromeos && !(is_asan || is_lsan || is_tsan || is_msan)) {
|
| # ldflags += [
|
| @@ -493,7 +577,7 @@ config("compiler") {
|
| }
|
|
|
| config("compiler_arm_fpu") {
|
| - if (current_cpu == "arm") {
|
| + if (current_cpu == "arm" && !is_ios) {
|
| cflags = [ "-mfpu=$arm_fpu" ]
|
| }
|
| }
|
| @@ -594,12 +678,25 @@ config("runtime_library") {
|
| android_libcpp_library = "c++_static"
|
| }
|
|
|
| - libs += [
|
| - "$android_libcpp_library",
|
| + libs += [ "$android_libcpp_library" ]
|
|
|
| - # Manually link the libgcc.a that the cross compiler uses. This is
|
| - # absolute because the linker will look inside the sysroot if it's not.
|
| - rebase_path(android_libgcc_file),
|
| + if (current_cpu == "mipsel") {
|
| + libs += [
|
| + # ld linker is used for mips Android, and ld does not accept library
|
| + # absolute path prefixed by "-l"; Since libgcc does not exist in mips
|
| + # sysroot the proper library will be linked.
|
| + # TODO(gordanac): Remove once gold linker is used for mips Android.
|
| + "gcc",
|
| + ]
|
| + } else {
|
| + libs += [
|
| + # Manually link the libgcc.a that the cross compiler uses. This is
|
| + # absolute because the linker will look inside the sysroot if it's not.
|
| + rebase_path(android_libgcc_file),
|
| + ]
|
| + }
|
| +
|
| + libs += [
|
| "c",
|
| "dl",
|
| "m",
|
| @@ -612,6 +709,246 @@ config("runtime_library") {
|
| }
|
| }
|
|
|
| +# default_warning_flags collects all warning flags that are used by default.
|
| +# This is in a variable instead of a config so that it can be used in
|
| +# both chromium_code and no_chromium_code. This way these flags are guaranteed
|
| +# to appear on the compile command line after -Wall.
|
| +
|
| +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.
|
| + ]
|
| +
|
| + # 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.
|
| + }
|
| +
|
| + # 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 (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",
|
| + ]
|
| + }
|
| +
|
| + # 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 (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
|
| + # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
|
| + # which happens in several places in chrome code. Not sure if
|
| + # this is worth fixing.
|
| + "-Wno-c++11-narrowing",
|
| +
|
| + # Don't die on dtoa code that uses a char as an array index.
|
| + # This is required solely for base/third_party/dmg_fp/dtoa.cc.
|
| + # TODO(brettw) move this to that project then!
|
| + "-Wno-char-subscripts",
|
| +
|
| + # Warns on switches on enums that cover all enum values but
|
| + # also contain a default: branch. Chrome is full of that.
|
| + "-Wno-covered-switch-default",
|
| +
|
| + # Clang considers the `register` keyword as deprecated, but e.g.
|
| + # code generated by flex (used in angle) contains that keyword.
|
| + # http://crbug.com/255186
|
| + "-Wno-deprecated-register",
|
| +
|
| + # TODO(thakis): This used to be implied by -Wno-unused-function,
|
| + # which we no longer use. Check if it makes sense to remove
|
| + # this as well. http://crbug.com/316352
|
| + "-Wno-unneeded-internal-declaration",
|
| +
|
| + # TODO(thakis): Remove, http://crbug.com/263960
|
| + "-Wno-reserved-user-defined-literal",
|
| + ]
|
| +
|
| + # NaCl's Clang compiler and Chrome's hermetic Clang compiler will almost
|
| + # always have different versions. Certain flags may not be recognized by
|
| + # one version or the other.
|
| + if (!is_nacl) {
|
| + # Flags NaCl does not recognize.
|
| + default_warning_flags += [
|
| + # TODO(hans): Get this cleaned up.
|
| + "-Wno-inconsistent-missing-override",
|
| + ]
|
| + }
|
| +}
|
| +
|
| # chromium_code ---------------------------------------------------------------
|
| #
|
| # Toggles between higher and lower warnings for code that is (or isn't)
|
| @@ -638,7 +975,7 @@ config("chromium_code") {
|
| "__STDC_FORMAT_MACROS",
|
| ]
|
|
|
| - if (using_sanitizer) {
|
| + if (!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
|
| @@ -650,6 +987,8 @@ config("chromium_code") {
|
| defines += [ "_FORTIFY_SOURCE=2" ]
|
| }
|
| }
|
| + cflags += default_warning_flags
|
| + cflags_cc = default_warning_flags_cc
|
| }
|
| config("no_chromium_code") {
|
| cflags = []
|
| @@ -688,6 +1027,8 @@ config("no_chromium_code") {
|
| "-Wno-deprecated",
|
| ]
|
| }
|
| + cflags += default_warning_flags
|
| + cflags_cc += default_warning_flags_cc
|
| }
|
|
|
| # rtti ------------------------------------------------------------------------
|
| @@ -708,201 +1049,13 @@ config("no_rtti") {
|
| }
|
|
|
| # Warnings ---------------------------------------------------------------------
|
| -#
|
| -# This is where we disable various warnings that we've decided aren't
|
| -# worthwhile, and enable special warnings.
|
| -
|
| -config("default_warnings") {
|
| - if (is_win) {
|
| - cflags = [
|
| - "/WX", # Treat warnings as errors.
|
| -
|
| - # 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.
|
| - ]
|
| -
|
| - # 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) {
|
| - cflags += [ "/wd4702" ] # Unreachable code.
|
| - }
|
| - } else {
|
| - # Common GCC warning setup.
|
| - cflags = [
|
| - # 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.
|
| - ]
|
| - cflags_cc = []
|
| -
|
| - if (is_mac) {
|
| - cflags += [ "-Wnewline-eof" ]
|
| - }
|
| -
|
| - if (is_clang) {
|
| - cflags += [
|
| - # This warns on using ints as initializers for floats in
|
| - # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
|
| - # which happens in several places in chrome code. Not sure if
|
| - # this is worth fixing.
|
| - "-Wno-c++11-narrowing",
|
| -
|
| - # Don't die on dtoa code that uses a char as an array index.
|
| - # This is required solely for base/third_party/dmg_fp/dtoa.cc.
|
| - # TODO(brettw) move this to that project then!
|
| - "-Wno-char-subscripts",
|
| -
|
| - # Warns on switches on enums that cover all enum values but
|
| - # also contain a default: branch. Chrome is full of that.
|
| - "-Wno-covered-switch-default",
|
| -
|
| - # Clang considers the `register` keyword as deprecated, but e.g.
|
| - # code generated by flex (used in angle) contains that keyword.
|
| - # http://crbug.com/255186
|
| - "-Wno-deprecated-register",
|
| -
|
| - # TODO(thakis): This used to be implied by -Wno-unused-function,
|
| - # which we no longer use. Check if it makes sense to remove
|
| - # this as well. http://crbug.com/316352
|
| - "-Wno-unneeded-internal-declaration",
|
| -
|
| - # TODO(thakis): Remove, http://crbug.com/263960
|
| - "-Wno-reserved-user-defined-literal",
|
| - ]
|
| -
|
| - # NaCl's Clang compiler and Chrome's hermetic Clang compiler will almost
|
| - # always have different versions. Certain flags may not be recognized by
|
| - # one version or the other.
|
| - if (!is_nacl) {
|
| - # Flags NaCl does not recognize.
|
| - cflags += [
|
| - # TODO(hans): Get this cleaned up.
|
| - "-Wno-inconsistent-missing-override",
|
| - ]
|
| - }
|
| - }
|
| - if (gcc_version >= 48) {
|
| - cflags_cc += [
|
| - # See comment for -Wno-c++11-narrowing.
|
| - "-Wno-narrowing",
|
| -
|
| - # 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) {
|
| - cflags += [ "-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).
|
| - cflags += [
|
| - "-Wno-extra",
|
| - "-Wno-ignored-qualifiers",
|
| - "-Wno-type-limits",
|
| - ]
|
| - cflags_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
|
| - cflags += [ "-Wno-unused-local-typedefs" ]
|
| - }
|
| - }
|
| -}
|
|
|
| # This will generate warnings when using Clang if code generates exit-time
|
| # destructors, which will slow down closing the program.
|
| # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600
|
| config("wexit_time_destructors") {
|
| - if (is_clang) {
|
| + # TODO: Enable on Windows too, http://crbug.com/404525
|
| + if (is_clang && !is_win) {
|
| cflags = [ "-Wexit-time-destructors" ]
|
| }
|
| }
|
|
|