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 if (cpu_arch == "arm") { | 6 if (cpu_arch == "arm") { |
7 import("//build/config/arm.gni") | 7 import("//build/config/arm.gni") |
8 } | 8 } |
9 if (is_posix) { | 9 if (is_posix) { |
10 import("//build/config/gcc/gcc_version.gni") | 10 import("//build/config/gcc/gcc_version.gni") |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 # an Objective C struct won't be called, which is very bad. | 98 # an Objective C struct won't be called, which is very bad. |
99 cflags_objcc = [ "-fobjc-call-cxx-cdtors", ] | 99 cflags_objcc = [ "-fobjc-call-cxx-cdtors", ] |
100 | 100 |
101 cflags_c += [ "-std=c99" ] | 101 cflags_c += [ "-std=c99" ] |
102 cflags_cc += [ "-std=gnu++11" ] | 102 cflags_cc += [ "-std=gnu++11" ] |
103 | 103 |
104 ldflags += common_mac_flags | 104 ldflags += common_mac_flags |
105 } else if (is_posix) { | 105 } else if (is_posix) { |
106 # Non-Mac Posix compiler flags setup. | 106 # Non-Mac Posix compiler flags setup. |
107 # ----------------------------------- | 107 # ----------------------------------- |
| 108 if (gcc_version >= 48) { |
| 109 cflags_cc += [ |
| 110 "-std=gnu++11", |
| 111 ] |
| 112 } |
108 | 113 |
109 # CPU architecture. We may or may not be doing a cross compile now, so for | 114 # CPU architecture. We may or may not be doing a cross compile now, so for |
110 # simplicity we always explicitly set the architecture. | 115 # simplicity we always explicitly set the architecture. |
111 if (cpu_arch == "x64") { | 116 if (cpu_arch == "x64") { |
112 cflags += [ "-m64" ] | 117 cflags += [ "-m64" ] |
113 ldflags += [ "-m64" ] | 118 ldflags += [ "-m64" ] |
114 } else if (cpu_arch == "x86") { | 119 } else if (cpu_arch == "x86") { |
115 cflags += [ "-m32" ] | 120 cflags += [ "-m32" ] |
116 ldflags += [ "-m32" ] | 121 ldflags += [ "-m32" ] |
117 } else if (cpu_arch == "arm") { | 122 } else if (cpu_arch == "arm") { |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 } else { | 570 } else { |
566 # Common GCC warning setup. | 571 # Common GCC warning setup. |
567 cflags = [ | 572 cflags = [ |
568 # Enables. | 573 # Enables. |
569 "-Wendif-labels", # Weird old-style text after an #endif. | 574 "-Wendif-labels", # Weird old-style text after an #endif. |
570 | 575 |
571 # Disables. | 576 # Disables. |
572 "-Wno-missing-field-initializers", # "struct foo f = {0};" | 577 "-Wno-missing-field-initializers", # "struct foo f = {0};" |
573 "-Wno-unused-parameter", # Unused function parameters. | 578 "-Wno-unused-parameter", # Unused function parameters. |
574 ] | 579 ] |
| 580 cflags_cc = [] |
575 | 581 |
576 if (is_mac) { | 582 if (is_mac) { |
577 cflags += [ | 583 cflags += [ |
578 "-Wnewline-eof", | 584 "-Wnewline-eof", |
579 ] | 585 ] |
580 } | 586 } |
581 | 587 |
582 if (is_clang) { | 588 if (is_clang) { |
583 cflags += [ | 589 cflags += [ |
584 # This warns on using ints as initializers for floats in | 590 # This warns on using ints as initializers for floats in |
(...skipping 12 matching lines...) Expand all Loading... |
597 "-Wno-covered-switch-default", | 603 "-Wno-covered-switch-default", |
598 | 604 |
599 # Clang considers the `register` keyword as deprecated, but e.g. | 605 # Clang considers the `register` keyword as deprecated, but e.g. |
600 # code generated by flex (used in angle) contains that keyword. | 606 # code generated by flex (used in angle) contains that keyword. |
601 # http://crbug.com/255186 | 607 # http://crbug.com/255186 |
602 "-Wno-deprecated-register", | 608 "-Wno-deprecated-register", |
603 | 609 |
604 # Clang spots more unused functions. | 610 # Clang spots more unused functions. |
605 "-Wno-unused-function", | 611 "-Wno-unused-function", |
606 ] | 612 ] |
| 613 |
| 614 if (!is_mac && !is_ios) { |
| 615 cflags_cc += [ |
| 616 "-Wno-reserved-user-defined-literal", |
| 617 ] |
| 618 } |
| 619 } |
| 620 if (gcc_version >= 48) { |
| 621 cflags_cc += [ |
| 622 # See comment for -Wno-c++11-narrowing. |
| 623 "-Wno-narrowing", |
| 624 # TODO(thakis): Remove, http://crbug.com/263960 |
| 625 "-Wno-literal-suffix", |
| 626 ] |
607 } | 627 } |
608 | 628 |
609 # Suppress warnings about ABI changes on ARM (Clang doesn't give this | 629 # Suppress warnings about ABI changes on ARM (Clang doesn't give this |
610 # warning). | 630 # warning). |
611 if (cpu_arch == "arm" && !is_clang) { | 631 if (cpu_arch == "arm" && !is_clang) { |
612 cflags += [ "-Wno-psabi" ] | 632 cflags += [ "-Wno-psabi" ] |
613 } | 633 } |
614 | 634 |
615 if (is_android) { | 635 if (is_android) { |
616 # Disable any additional warnings enabled by the Android build system but | 636 # Disable any additional warnings enabled by the Android build system but |
617 # which chromium does not build cleanly with (when treating warning as | 637 # which chromium does not build cleanly with (when treating warning as |
618 # errors). | 638 # errors). |
619 cflags += [ | 639 cflags += [ |
620 "-Wno-extra", | 640 "-Wno-extra", |
621 "-Wno-ignored-qualifiers", | 641 "-Wno-ignored-qualifiers", |
622 "-Wno-type-limits", | 642 "-Wno-type-limits", |
623 ] | 643 ] |
624 cflags_cc = [ | 644 cflags_cc += [ |
625 # Disabling c++0x-compat should be handled in WebKit, but | 645 # Disabling c++0x-compat should be handled in WebKit, but |
626 # this currently doesn't work because gcc_version is not set | 646 # this currently doesn't work because gcc_version is not set |
627 # correctly when building with the Android build system. | 647 # correctly when building with the Android build system. |
628 # TODO(torne): Fix this in WebKit. | 648 # TODO(torne): Fix this in WebKit. |
629 "-Wno-error=c++0x-compat", | 649 "-Wno-error=c++0x-compat", |
630 # Other things unrelated to -Wextra: | 650 # Other things unrelated to -Wextra: |
631 "-Wno-non-virtual-dtor", | 651 "-Wno-non-virtual-dtor", |
632 "-Wno-sign-promo", | 652 "-Wno-sign-promo", |
633 ] | 653 ] |
634 } | 654 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 } else { | 817 } else { |
798 cflags = [ "-g1" ] | 818 cflags = [ "-g1" ] |
799 } | 819 } |
800 } | 820 } |
801 | 821 |
802 config("no_symbols") { | 822 config("no_symbols") { |
803 if (!is_win) { | 823 if (!is_win) { |
804 cflags = [ "-g0" ] | 824 cflags = [ "-g0" ] |
805 } | 825 } |
806 } | 826 } |
OLD | NEW |