| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
| 6 import("//build/config/chrome_build.gni") | 6 import("//build/config/chrome_build.gni") |
| 7 if (current_cpu == "arm") { | 7 if (current_cpu == "arm") { |
| 8 import("//build/config/arm.gni") | 8 import("//build/config/arm.gni") |
| 9 } | 9 } |
| 10 if (current_cpu == "mipsel" || current_cpu == "mips64el") { | 10 if (current_cpu == "mipsel" || current_cpu == "mips64el") { |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 "m", | 697 "m", |
| 698 ] | 698 ] |
| 699 | 699 |
| 700 # Clang with libc++ does not require an explicit atomic library reference. | 700 # Clang with libc++ does not require an explicit atomic library reference. |
| 701 if (!is_clang) { | 701 if (!is_clang) { |
| 702 libs += [ "atomic" ] | 702 libs += [ "atomic" ] |
| 703 } | 703 } |
| 704 } | 704 } |
| 705 } | 705 } |
| 706 | 706 |
| 707 # default_warning_flags collects all warning flags that are used by default. |
| 708 # This is in a variable instead of a config so that it can be used in |
| 709 # both chromium_code and no_chromium_code. This way these flags are guaranteed |
| 710 # to appear on the compile command line after -Wall. |
| 711 |
| 712 default_warning_flags = [] |
| 713 default_warning_flags_cc = [] |
| 714 if (is_win) { |
| 715 if (!is_clang || current_cpu != "x86") { |
| 716 default_warning_flags += [ "/WX" ] # Treat warnings as errors. |
| 717 } |
| 718 |
| 719 default_warning_flags += [ |
| 720 # Warnings permanently disabled: |
| 721 |
| 722 # TODO(GYP) The GYP build doesn't have this globally enabled but disabled |
| 723 # for a bunch of individual targets. Re-enable this globally when those |
| 724 # targets are fixed. |
| 725 "/wd4018", # Comparing signed and unsigned values. |
| 726 |
| 727 # C4127: conditional expression is constant |
| 728 # This warning can in theory catch dead code and other problems, but |
| 729 # triggers in far too many desirable cases where the conditional |
| 730 # expression is either set by macros or corresponds some legitimate |
| 731 # compile-time constant expression (due to constant template args, |
| 732 # conditionals comparing the sizes of different types, etc.). Some of |
| 733 # these can be worked around, but it's not worth it. |
| 734 "/wd4127", |
| 735 |
| 736 # C4251: 'identifier' : class 'type' needs to have dll-interface to be |
| 737 # used by clients of class 'type2' |
| 738 # This is necessary for the shared library build. |
| 739 "/wd4251", |
| 740 |
| 741 # C4351: new behavior: elements of array 'array' will be default |
| 742 # initialized |
| 743 # This is a silly "warning" that basically just alerts you that the |
| 744 # compiler is going to actually follow the language spec like it's |
| 745 # supposed to, instead of not following it like old buggy versions did. |
| 746 # There's absolutely no reason to turn this on. |
| 747 "/wd4351", |
| 748 |
| 749 # C4355: 'this': used in base member initializer list |
| 750 # It's commonly useful to pass |this| to objects in a class' initializer |
| 751 # list. While this warning can catch real bugs, most of the time the |
| 752 # constructors in question don't attempt to call methods on the passed-in |
| 753 # pointer (until later), and annotating every legit usage of this is |
| 754 # simply more hassle than the warning is worth. |
| 755 "/wd4355", |
| 756 |
| 757 # C4503: 'identifier': decorated name length exceeded, name was |
| 758 # truncated |
| 759 # This only means that some long error messages might have truncated |
| 760 # identifiers in the presence of lots of templates. It has no effect on |
| 761 # program correctness and there's no real reason to waste time trying to |
| 762 # prevent it. |
| 763 "/wd4503", |
| 764 |
| 765 # C4611: interaction between 'function' and C++ object destruction is |
| 766 # non-portable |
| 767 # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN |
| 768 # suggests using exceptions instead of setjmp/longjmp for C++, but |
| 769 # Chromium code compiles without exception support. We therefore have to |
| 770 # use setjmp/longjmp for e.g. JPEG decode error handling, which means we |
| 771 # have to turn off this warning (and be careful about how object |
| 772 # destruction happens in such cases). |
| 773 "/wd4611", |
| 774 |
| 775 # Warnings to evaluate and possibly fix/reenable later: |
| 776 |
| 777 "/wd4100", # Unreferenced formal function parameter. |
| 778 "/wd4121", # Alignment of a member was sensitive to packing. |
| 779 "/wd4244", # Conversion: possible loss of data. |
| 780 "/wd4481", # Nonstandard extension: override specifier. |
| 781 "/wd4505", # Unreferenced local function has been removed. |
| 782 "/wd4510", # Default constructor could not be generated. |
| 783 "/wd4512", # Assignment operator could not be generated. |
| 784 "/wd4610", # Class can never be instantiated, constructor required. |
| 785 "/wd4996", # Deprecated function warning. |
| 786 ] |
| 787 |
| 788 # VS xtree header file needs to be patched or 4702 (unreachable code |
| 789 # warning) is reported if _HAS_EXCEPTIONS=0. Disable the warning if xtree is |
| 790 # not patched. |
| 791 if (!msvs_xtree_patched && |
| 792 exec_script("../../win_is_xtree_patched.py", [], "value") == 0) { |
| 793 default_warning_flags += [ "/wd4702" ] # Unreachable code. |
| 794 } |
| 795 |
| 796 # Building with Clang on Windows is a work in progress and very |
| 797 # experimental. See crbug.com/82385. |
| 798 # Keep this in sync with the similar block in build/common.gypi |
| 799 if (is_clang) { |
| 800 default_warning_flags += [ |
| 801 # TODO(hans): Make this list shorter eventually. |
| 802 "-Qunused-arguments", |
| 803 "-Wno-c++11-compat-deprecated-writable-strings", |
| 804 "-Wno-deprecated-declarations", |
| 805 "-Wno-empty-body", |
| 806 "-Wno-enum-conversion", |
| 807 "-Wno-extra-tokens", |
| 808 "-Wno-ignored-attributes", |
| 809 "-Wno-incompatible-pointer-types", |
| 810 "-Wno-int-to-void-pointer-cast", |
| 811 "-Wno-invalid-noreturn", |
| 812 "-Wno-logical-op-parentheses", |
| 813 "-Wno-microsoft", |
| 814 "-Wno-missing-braces", |
| 815 "-Wno-missing-declarations", |
| 816 "-Wno-msvc-include", |
| 817 "-Wno-null-dereference", |
| 818 "-Wno-overloaded-virtual", |
| 819 "-Wno-parentheses", |
| 820 "-Wno-pointer-sign", |
| 821 "-Wno-reorder", |
| 822 "-Wno-return-type-c-linkage", |
| 823 "-Wno-self-assign", |
| 824 "-Wno-sometimes-uninitialized", |
| 825 "-Wno-switch", |
| 826 "-Wno-tautological-compare", |
| 827 "-Wno-unknown-pragmas", |
| 828 "-Wno-unsequenced", |
| 829 "-Wno-unused-function", |
| 830 "-Wno-unused-private-field", |
| 831 "-Wno-unused-value", |
| 832 "-Wno-unused-variable", |
| 833 "-Wno-unused-local-typedef", # http://crbug.com/411648 |
| 834 "-Wno-inconsistent-missing-override", #http://crbug.com/428099 |
| 835 ] |
| 836 } |
| 837 } else { |
| 838 # Common GCC warning setup. |
| 839 default_warning_flags += [ |
| 840 # Enables. |
| 841 "-Wendif-labels", # Weird old-style text after an #endif. |
| 842 "-Werror", # Warnings as errors. |
| 843 |
| 844 # Disables. |
| 845 "-Wno-missing-field-initializers", # "struct foo f = {0};" |
| 846 "-Wno-unused-parameter", # Unused function parameters. |
| 847 ] |
| 848 |
| 849 if (is_mac) { |
| 850 default_warning_flags += [ "-Wnewline-eof" ] |
| 851 if (!is_nacl) { |
| 852 # When compiling Objective-C, warns if a method is used whose |
| 853 # availability is newer than the deployment target. This is not |
| 854 # required when compiling Chrome for iOS. |
| 855 default_warning_flags += [ "-Wpartial-availability" ] |
| 856 } |
| 857 } |
| 858 |
| 859 if (gcc_version >= 48) { |
| 860 default_warning_flags_cc += [ |
| 861 # See comment for -Wno-c++11-narrowing. |
| 862 "-Wno-narrowing", |
| 863 |
| 864 # TODO(thakis): Remove, http://crbug.com/263960 |
| 865 "-Wno-literal-suffix", |
| 866 ] |
| 867 } |
| 868 |
| 869 # Suppress warnings about ABI changes on ARM (Clang doesn't give this |
| 870 # warning). |
| 871 if (current_cpu == "arm" && !is_clang) { |
| 872 default_warning_flags += [ "-Wno-psabi" ] |
| 873 } |
| 874 |
| 875 if (is_android) { |
| 876 # Disable any additional warnings enabled by the Android build system but |
| 877 # which chromium does not build cleanly with (when treating warning as |
| 878 # errors). |
| 879 default_warning_flags += [ |
| 880 "-Wno-extra", |
| 881 "-Wno-ignored-qualifiers", |
| 882 "-Wno-type-limits", |
| 883 ] |
| 884 default_warning_flags_cc += [ |
| 885 # Disabling c++0x-compat should be handled in WebKit, but |
| 886 # this currently doesn't work because gcc_version is not set |
| 887 # correctly when building with the Android build system. |
| 888 # TODO(torne): Fix this in WebKit. |
| 889 "-Wno-error=c++0x-compat", |
| 890 |
| 891 # Other things unrelated to -Wextra: |
| 892 "-Wno-non-virtual-dtor", |
| 893 "-Wno-sign-promo", |
| 894 ] |
| 895 } |
| 896 |
| 897 if (gcc_version >= 48) { |
| 898 # Don't warn about the "typedef 'foo' locally defined but not used" |
| 899 # for gcc 4.8. |
| 900 # TODO: remove this flag once all builds work. See crbug.com/227506 |
| 901 default_warning_flags += [ "-Wno-unused-local-typedefs" ] |
| 902 } |
| 903 } |
| 904 if (is_clang) { |
| 905 default_warning_flags += [ |
| 906 # This warns on using ints as initializers for floats in |
| 907 # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|), |
| 908 # which happens in several places in chrome code. Not sure if |
| 909 # this is worth fixing. |
| 910 "-Wno-c++11-narrowing", |
| 911 |
| 912 # Don't die on dtoa code that uses a char as an array index. |
| 913 # This is required solely for base/third_party/dmg_fp/dtoa.cc. |
| 914 # TODO(brettw) move this to that project then! |
| 915 "-Wno-char-subscripts", |
| 916 |
| 917 # Warns on switches on enums that cover all enum values but |
| 918 # also contain a default: branch. Chrome is full of that. |
| 919 "-Wno-covered-switch-default", |
| 920 |
| 921 # Clang considers the `register` keyword as deprecated, but e.g. |
| 922 # code generated by flex (used in angle) contains that keyword. |
| 923 # http://crbug.com/255186 |
| 924 "-Wno-deprecated-register", |
| 925 |
| 926 # TODO(thakis): This used to be implied by -Wno-unused-function, |
| 927 # which we no longer use. Check if it makes sense to remove |
| 928 # this as well. http://crbug.com/316352 |
| 929 "-Wno-unneeded-internal-declaration", |
| 930 |
| 931 # TODO(thakis): Remove, http://crbug.com/263960 |
| 932 "-Wno-reserved-user-defined-literal", |
| 933 ] |
| 934 |
| 935 # NaCl's Clang compiler and Chrome's hermetic Clang compiler will almost |
| 936 # always have different versions. Certain flags may not be recognized by |
| 937 # one version or the other. |
| 938 if (!is_nacl) { |
| 939 # Flags NaCl does not recognize. |
| 940 default_warning_flags += [ |
| 941 # TODO(hans): Get this cleaned up. |
| 942 "-Wno-inconsistent-missing-override", |
| 943 ] |
| 944 } |
| 945 } |
| 946 |
| 707 # chromium_code --------------------------------------------------------------- | 947 # chromium_code --------------------------------------------------------------- |
| 708 # | 948 # |
| 709 # Toggles between higher and lower warnings for code that is (or isn't) | 949 # Toggles between higher and lower warnings for code that is (or isn't) |
| 710 # part of Chromium. | 950 # part of Chromium. |
| 711 | 951 |
| 712 config("chromium_code") { | 952 config("chromium_code") { |
| 713 if (is_win) { | 953 if (is_win) { |
| 714 cflags = [ "/W4" ] # Warning level 4. | 954 cflags = [ "/W4" ] # Warning level 4. |
| 715 } else { | 955 } else { |
| 716 cflags = [ | 956 cflags = [ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 735 # http://llvm.org/bugs/show_bug.cgi?id=16821. | 975 # http://llvm.org/bugs/show_bug.cgi?id=16821. |
| 736 # It seems to work fine with Ubuntu 12 headers though, so use it in | 976 # It seems to work fine with Ubuntu 12 headers though, so use it in |
| 737 # official builds. | 977 # official builds. |
| 738 # | 978 # |
| 739 # Non-chromium code is not guaranteed to compile cleanly with | 979 # Non-chromium code is not guaranteed to compile cleanly with |
| 740 # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are | 980 # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are |
| 741 # disabled, so only do that for Release build. | 981 # disabled, so only do that for Release build. |
| 742 defines += [ "_FORTIFY_SOURCE=2" ] | 982 defines += [ "_FORTIFY_SOURCE=2" ] |
| 743 } | 983 } |
| 744 } | 984 } |
| 985 cflags += default_warning_flags |
| 986 cflags_cc = default_warning_flags_cc |
| 745 } | 987 } |
| 746 config("no_chromium_code") { | 988 config("no_chromium_code") { |
| 747 cflags = [] | 989 cflags = [] |
| 748 cflags_cc = [] | 990 cflags_cc = [] |
| 749 defines = [] | 991 defines = [] |
| 750 | 992 |
| 751 if (is_win) { | 993 if (is_win) { |
| 752 cflags += [ | 994 cflags += [ |
| 753 "/W3", # Warning level 3. | 995 "/W3", # Warning level 3. |
| 754 "/wd4800", # Disable warning when forcing value to bool. | 996 "/wd4800", # Disable warning when forcing value to bool. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 773 cflags += [ | 1015 cflags += [ |
| 774 # Don't warn about printf format problems. This is off by default in gcc | 1016 # Don't warn about printf format problems. This is off by default in gcc |
| 775 # but on in Ubuntu's gcc(!). | 1017 # but on in Ubuntu's gcc(!). |
| 776 "-Wno-format", | 1018 "-Wno-format", |
| 777 ] | 1019 ] |
| 778 cflags_cc += [ | 1020 cflags_cc += [ |
| 779 # Don't warn about hash_map in third-party code. | 1021 # Don't warn about hash_map in third-party code. |
| 780 "-Wno-deprecated", | 1022 "-Wno-deprecated", |
| 781 ] | 1023 ] |
| 782 } | 1024 } |
| 1025 cflags += default_warning_flags |
| 1026 cflags_cc += default_warning_flags_cc |
| 783 } | 1027 } |
| 784 | 1028 |
| 785 # rtti ------------------------------------------------------------------------ | 1029 # rtti ------------------------------------------------------------------------ |
| 786 # | 1030 # |
| 787 # Allows turning Run-Time Type Identification on or off. | 1031 # Allows turning Run-Time Type Identification on or off. |
| 788 | 1032 |
| 789 config("rtti") { | 1033 config("rtti") { |
| 790 if (is_win) { | 1034 if (is_win) { |
| 791 cflags_cc = [ "/GR" ] | 1035 cflags_cc = [ "/GR" ] |
| 792 } | 1036 } |
| 793 } | 1037 } |
| 794 config("no_rtti") { | 1038 config("no_rtti") { |
| 795 if (is_win) { | 1039 if (is_win) { |
| 796 cflags_cc = [ "/GR-" ] | 1040 cflags_cc = [ "/GR-" ] |
| 797 } else { | 1041 } else { |
| 798 cflags_cc = [ "-fno-rtti" ] | 1042 cflags_cc = [ "-fno-rtti" ] |
| 799 } | 1043 } |
| 800 } | 1044 } |
| 801 | 1045 |
| 802 # Warnings --------------------------------------------------------------------- | 1046 # Warnings --------------------------------------------------------------------- |
| 803 # | |
| 804 # This is where we disable various warnings that we've decided aren't | |
| 805 # worthwhile, and enable special warnings. | |
| 806 | |
| 807 config("default_warnings") { | |
| 808 if (is_win) { | |
| 809 cflags = [] | |
| 810 | |
| 811 if (!is_clang || current_cpu != "x86") { | |
| 812 cflags += [ "/WX" ] # Treat warnings as errors. | |
| 813 } | |
| 814 | |
| 815 cflags += [ | |
| 816 # Warnings permanently disabled: | |
| 817 | |
| 818 # TODO(GYP) The GYP build doesn't have this globally enabled but disabled | |
| 819 # for a bunch of individual targets. Re-enable this globally when those | |
| 820 # targets are fixed. | |
| 821 "/wd4018", # Comparing signed and unsigned values. | |
| 822 | |
| 823 # C4127: conditional expression is constant | |
| 824 # This warning can in theory catch dead code and other problems, but | |
| 825 # triggers in far too many desirable cases where the conditional | |
| 826 # expression is either set by macros or corresponds some legitimate | |
| 827 # compile-time constant expression (due to constant template args, | |
| 828 # conditionals comparing the sizes of different types, etc.). Some of | |
| 829 # these can be worked around, but it's not worth it. | |
| 830 "/wd4127", | |
| 831 | |
| 832 # C4251: 'identifier' : class 'type' needs to have dll-interface to be | |
| 833 # used by clients of class 'type2' | |
| 834 # This is necessary for the shared library build. | |
| 835 "/wd4251", | |
| 836 | |
| 837 # C4351: new behavior: elements of array 'array' will be default | |
| 838 # initialized | |
| 839 # This is a silly "warning" that basically just alerts you that the | |
| 840 # compiler is going to actually follow the language spec like it's | |
| 841 # supposed to, instead of not following it like old buggy versions did. | |
| 842 # There's absolutely no reason to turn this on. | |
| 843 "/wd4351", | |
| 844 | |
| 845 # C4355: 'this': used in base member initializer list | |
| 846 # It's commonly useful to pass |this| to objects in a class' initializer | |
| 847 # list. While this warning can catch real bugs, most of the time the | |
| 848 # constructors in question don't attempt to call methods on the passed-in | |
| 849 # pointer (until later), and annotating every legit usage of this is | |
| 850 # simply more hassle than the warning is worth. | |
| 851 "/wd4355", | |
| 852 | |
| 853 # C4503: 'identifier': decorated name length exceeded, name was | |
| 854 # truncated | |
| 855 # This only means that some long error messages might have truncated | |
| 856 # identifiers in the presence of lots of templates. It has no effect on | |
| 857 # program correctness and there's no real reason to waste time trying to | |
| 858 # prevent it. | |
| 859 "/wd4503", | |
| 860 | |
| 861 # C4611: interaction between 'function' and C++ object destruction is | |
| 862 # non-portable | |
| 863 # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN | |
| 864 # suggests using exceptions instead of setjmp/longjmp for C++, but | |
| 865 # Chromium code compiles without exception support. We therefore have to | |
| 866 # use setjmp/longjmp for e.g. JPEG decode error handling, which means we | |
| 867 # have to turn off this warning (and be careful about how object | |
| 868 # destruction happens in such cases). | |
| 869 "/wd4611", | |
| 870 | |
| 871 # Warnings to evaluate and possibly fix/reenable later: | |
| 872 | |
| 873 "/wd4100", # Unreferenced formal function parameter. | |
| 874 "/wd4121", # Alignment of a member was sensitive to packing. | |
| 875 "/wd4244", # Conversion: possible loss of data. | |
| 876 "/wd4481", # Nonstandard extension: override specifier. | |
| 877 "/wd4505", # Unreferenced local function has been removed. | |
| 878 "/wd4510", # Default constructor could not be generated. | |
| 879 "/wd4512", # Assignment operator could not be generated. | |
| 880 "/wd4610", # Class can never be instantiated, constructor required. | |
| 881 "/wd4996", # Deprecated function warning. | |
| 882 ] | |
| 883 | |
| 884 # VS xtree header file needs to be patched or 4702 (unreachable code | |
| 885 # warning) is reported if _HAS_EXCEPTIONS=0. Disable the warning if xtree is | |
| 886 # not patched. | |
| 887 if (!msvs_xtree_patched && | |
| 888 exec_script("../../win_is_xtree_patched.py", [], "value") == 0) { | |
| 889 cflags += [ "/wd4702" ] # Unreachable code. | |
| 890 } | |
| 891 | |
| 892 # Building with Clang on Windows is a work in progress and very | |
| 893 # experimental. See crbug.com/82385. | |
| 894 # Keep this in sync with the similar block in build/common.gypi | |
| 895 if (is_clang) { | |
| 896 cflags += [ | |
| 897 # TODO(hans): Make this list shorter eventually. | |
| 898 "-Qunused-arguments", | |
| 899 "-Wno-c++11-compat-deprecated-writable-strings", | |
| 900 "-Wno-deprecated-declarations", | |
| 901 "-Wno-empty-body", | |
| 902 "-Wno-enum-conversion", | |
| 903 "-Wno-extra-tokens", | |
| 904 "-Wno-ignored-attributes", | |
| 905 "-Wno-incompatible-pointer-types", | |
| 906 "-Wno-int-to-void-pointer-cast", | |
| 907 "-Wno-invalid-noreturn", | |
| 908 "-Wno-logical-op-parentheses", | |
| 909 "-Wno-microsoft", | |
| 910 "-Wno-missing-braces", | |
| 911 "-Wno-missing-declarations", | |
| 912 "-Wno-msvc-include", | |
| 913 "-Wno-null-dereference", | |
| 914 "-Wno-overloaded-virtual", | |
| 915 "-Wno-parentheses", | |
| 916 "-Wno-pointer-sign", | |
| 917 "-Wno-reorder", | |
| 918 "-Wno-return-type-c-linkage", | |
| 919 "-Wno-self-assign", | |
| 920 "-Wno-sometimes-uninitialized", | |
| 921 "-Wno-switch", | |
| 922 "-Wno-tautological-compare", | |
| 923 "-Wno-unknown-pragmas", | |
| 924 "-Wno-unsequenced", | |
| 925 "-Wno-unused-function", | |
| 926 "-Wno-unused-private-field", | |
| 927 "-Wno-unused-value", | |
| 928 "-Wno-unused-variable", | |
| 929 "-Wno-unused-local-typedef", # http://crbug.com/411648 | |
| 930 "-Wno-inconsistent-missing-override", #http://crbug.com/428099 | |
| 931 ] | |
| 932 } | |
| 933 } else { | |
| 934 # Common GCC warning setup. | |
| 935 cflags = [ | |
| 936 # Enables. | |
| 937 "-Wendif-labels", # Weird old-style text after an #endif. | |
| 938 "-Werror", # Warnings as errors. | |
| 939 | |
| 940 # Disables. | |
| 941 "-Wno-missing-field-initializers", # "struct foo f = {0};" | |
| 942 "-Wno-unused-parameter", # Unused function parameters. | |
| 943 ] | |
| 944 cflags_cc = [] | |
| 945 | |
| 946 if (is_mac) { | |
| 947 cflags += [ "-Wnewline-eof" ] | |
| 948 if (!is_nacl) { | |
| 949 # When compiling Objective-C, warns if a method is used whose | |
| 950 # availability is newer than the deployment target. This is not | |
| 951 # required when compiling Chrome for iOS. | |
| 952 cflags += [ "-Wpartial-availability" ] | |
| 953 } | |
| 954 } | |
| 955 | |
| 956 if (gcc_version >= 48) { | |
| 957 cflags_cc += [ | |
| 958 # See comment for -Wno-c++11-narrowing. | |
| 959 "-Wno-narrowing", | |
| 960 | |
| 961 # TODO(thakis): Remove, http://crbug.com/263960 | |
| 962 "-Wno-literal-suffix", | |
| 963 ] | |
| 964 } | |
| 965 | |
| 966 # Suppress warnings about ABI changes on ARM (Clang doesn't give this | |
| 967 # warning). | |
| 968 if (current_cpu == "arm" && !is_clang) { | |
| 969 cflags += [ "-Wno-psabi" ] | |
| 970 } | |
| 971 | |
| 972 if (is_android) { | |
| 973 # Disable any additional warnings enabled by the Android build system but | |
| 974 # which chromium does not build cleanly with (when treating warning as | |
| 975 # errors). | |
| 976 cflags += [ | |
| 977 "-Wno-extra", | |
| 978 "-Wno-ignored-qualifiers", | |
| 979 "-Wno-type-limits", | |
| 980 ] | |
| 981 cflags_cc += [ | |
| 982 # Disabling c++0x-compat should be handled in WebKit, but | |
| 983 # this currently doesn't work because gcc_version is not set | |
| 984 # correctly when building with the Android build system. | |
| 985 # TODO(torne): Fix this in WebKit. | |
| 986 "-Wno-error=c++0x-compat", | |
| 987 | |
| 988 # Other things unrelated to -Wextra: | |
| 989 "-Wno-non-virtual-dtor", | |
| 990 "-Wno-sign-promo", | |
| 991 ] | |
| 992 } | |
| 993 | |
| 994 if (gcc_version >= 48) { | |
| 995 # Don't warn about the "typedef 'foo' locally defined but not used" | |
| 996 # for gcc 4.8. | |
| 997 # TODO: remove this flag once all builds work. See crbug.com/227506 | |
| 998 cflags += [ "-Wno-unused-local-typedefs" ] | |
| 999 } | |
| 1000 } | |
| 1001 | |
| 1002 if (is_clang) { | |
| 1003 cflags += [ | |
| 1004 # This warns on using ints as initializers for floats in | |
| 1005 # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|), | |
| 1006 # which happens in several places in chrome code. Not sure if | |
| 1007 # this is worth fixing. | |
| 1008 "-Wno-c++11-narrowing", | |
| 1009 | |
| 1010 # Don't die on dtoa code that uses a char as an array index. | |
| 1011 # This is required solely for base/third_party/dmg_fp/dtoa.cc. | |
| 1012 # TODO(brettw) move this to that project then! | |
| 1013 "-Wno-char-subscripts", | |
| 1014 | |
| 1015 # Warns on switches on enums that cover all enum values but | |
| 1016 # also contain a default: branch. Chrome is full of that. | |
| 1017 "-Wno-covered-switch-default", | |
| 1018 | |
| 1019 # Clang considers the `register` keyword as deprecated, but e.g. | |
| 1020 # code generated by flex (used in angle) contains that keyword. | |
| 1021 # http://crbug.com/255186 | |
| 1022 "-Wno-deprecated-register", | |
| 1023 | |
| 1024 # TODO(thakis): This used to be implied by -Wno-unused-function, | |
| 1025 # which we no longer use. Check if it makes sense to remove | |
| 1026 # this as well. http://crbug.com/316352 | |
| 1027 "-Wno-unneeded-internal-declaration", | |
| 1028 | |
| 1029 # TODO(thakis): Remove, http://crbug.com/263960 | |
| 1030 "-Wno-reserved-user-defined-literal", | |
| 1031 ] | |
| 1032 | |
| 1033 # NaCl's Clang compiler and Chrome's hermetic Clang compiler will almost | |
| 1034 # always have different versions. Certain flags may not be recognized by | |
| 1035 # one version or the other. | |
| 1036 if (!is_nacl) { | |
| 1037 # Flags NaCl does not recognize. | |
| 1038 cflags += [ | |
| 1039 # TODO(hans): Get this cleaned up. | |
| 1040 "-Wno-inconsistent-missing-override", | |
| 1041 ] | |
| 1042 } | |
| 1043 } | |
| 1044 } | |
| 1045 | 1047 |
| 1046 # This will generate warnings when using Clang if code generates exit-time | 1048 # This will generate warnings when using Clang if code generates exit-time |
| 1047 # destructors, which will slow down closing the program. | 1049 # destructors, which will slow down closing the program. |
| 1048 # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600 | 1050 # TODO(thakis): Make this a blacklist instead, http://crbug.com/101600 |
| 1049 config("wexit_time_destructors") { | 1051 config("wexit_time_destructors") { |
| 1050 # TODO: Enable on Windows too, http://crbug.com/404525 | 1052 # TODO: Enable on Windows too, http://crbug.com/404525 |
| 1051 if (is_clang && !is_win) { | 1053 if (is_clang && !is_win) { |
| 1052 cflags = [ "-Wexit-time-destructors" ] | 1054 cflags = [ "-Wexit-time-destructors" ] |
| 1053 } | 1055 } |
| 1054 } | 1056 } |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1246 cflags += [ "-gsplit-dwarf" ] | 1248 cflags += [ "-gsplit-dwarf" ] |
| 1247 } | 1249 } |
| 1248 } | 1250 } |
| 1249 } | 1251 } |
| 1250 | 1252 |
| 1251 config("no_symbols") { | 1253 config("no_symbols") { |
| 1252 if (!is_win) { | 1254 if (!is_win) { |
| 1253 cflags = [ "-g0" ] | 1255 cflags = [ "-g0" ] |
| 1254 } | 1256 } |
| 1255 } | 1257 } |
| OLD | NEW |