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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 ] | 465 ] |
466 | 466 |
467 } | 467 } |
468 } | 468 } |
469 | 469 |
470 # chromium_code --------------------------------------------------------------- | 470 # chromium_code --------------------------------------------------------------- |
471 # | 471 # |
472 # Toggles between higher and lower warnings for code that is (or isn't) | 472 # Toggles between higher and lower warnings for code that is (or isn't) |
473 # part of Chromium. | 473 # part of Chromium. |
474 | 474 |
475 # TODO: -Werror should always be on, independent of chromium_code | |
476 # http://crbug.com/393046 | |
477 config("chromium_code") { | 475 config("chromium_code") { |
478 if (is_win) { | 476 if (is_win) { |
479 cflags = [ | 477 cflags = [ |
480 "/W4", # Warning level 4. | 478 "/W4", # Warning level 4. |
481 ] | 479 ] |
482 } else { | 480 } else { |
483 cflags = [ | 481 cflags = [ |
484 "-Wall", | 482 "-Wall", |
| 483 "-Wextra", |
485 | 484 |
486 # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't, | 485 # GCC turns on -Wsign-compare for C++ under -Wall, but clang doesn't, |
487 # so we specify it explicitly. | 486 # so we specify it explicitly. |
488 # TODO(fischman): remove this if http://llvm.org/PR10448 obsoletes it. | 487 # TODO(fischman): remove this if http://llvm.org/PR10448 obsoletes it. |
489 # http://code.google.com/p/chromium/issues/detail?id=90453 | 488 # http://code.google.com/p/chromium/issues/detail?id=90453 |
490 "-Wsign-compare", | 489 "-Wsign-compare", |
491 ] | 490 ] |
492 if (!is_linux) { | |
493 # TODO: Add this unconditionally once linux builds without warnings with | |
494 # clang in the gn build. | |
495 cflags += [ "-Werror" ] | |
496 } | |
497 | 491 |
498 # In Chromium code, we define __STDC_foo_MACROS in order to get the | 492 # In Chromium code, we define __STDC_foo_MACROS in order to get the |
499 # C99 macros on Mac and Linux. | 493 # C99 macros on Mac and Linux. |
500 defines = [ | 494 defines = [ |
501 "__STDC_CONSTANT_MACROS", | 495 "__STDC_CONSTANT_MACROS", |
502 "__STDC_FORMAT_MACROS", | 496 "__STDC_FORMAT_MACROS", |
503 ] | 497 ] |
504 | |
505 # TODO(brettw) this should also be enabled on Linux but some files | |
506 # currently fail. | |
507 if (is_mac) { | |
508 cflags += [ "-Wextra" ] | |
509 } | |
510 } | 498 } |
511 } | 499 } |
512 config("no_chromium_code") { | 500 config("no_chromium_code") { |
513 cflags = [] | 501 cflags = [] |
514 cflags_cc = [] | 502 cflags_cc = [] |
515 defines = [] | 503 defines = [] |
516 | 504 |
517 if (is_win) { | 505 if (is_win) { |
518 cflags += [ | 506 cflags += [ |
519 "/W3", # Warning level 3. | 507 "/W3", # Warning level 3. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 "/wd4505", # Unreferenced local function has been removed. | 640 "/wd4505", # Unreferenced local function has been removed. |
653 "/wd4510", # Default constructor could not be generated. | 641 "/wd4510", # Default constructor could not be generated. |
654 "/wd4512", # Assignment operator could not be generated. | 642 "/wd4512", # Assignment operator could not be generated. |
655 "/wd4610", # Class can never be instantiated, constructor required. | 643 "/wd4610", # Class can never be instantiated, constructor required. |
656 ] | 644 ] |
657 } else { | 645 } else { |
658 # Common GCC warning setup. | 646 # Common GCC warning setup. |
659 cflags = [ | 647 cflags = [ |
660 # Enables. | 648 # Enables. |
661 "-Wendif-labels", # Weird old-style text after an #endif. | 649 "-Wendif-labels", # Weird old-style text after an #endif. |
| 650 "-Werror", # Warnings as errors. |
662 | 651 |
663 # Disables. | 652 # Disables. |
664 "-Wno-missing-field-initializers", # "struct foo f = {0};" | 653 "-Wno-missing-field-initializers", # "struct foo f = {0};" |
665 "-Wno-unused-parameter", # Unused function parameters. | 654 "-Wno-unused-parameter", # Unused function parameters. |
666 ] | 655 ] |
667 cflags_cc = [] | 656 cflags_cc = [] |
668 | 657 |
669 if (is_mac) { | 658 if (is_mac) { |
670 cflags += [ | 659 cflags += [ |
671 "-Wnewline-eof", | 660 "-Wnewline-eof", |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 cflags += [ "-gsplit-dwarf" ] | 899 cflags += [ "-gsplit-dwarf" ] |
911 } | 900 } |
912 } | 901 } |
913 } | 902 } |
914 | 903 |
915 config("no_symbols") { | 904 config("no_symbols") { |
916 if (!is_win) { | 905 if (!is_win) { |
917 cflags = [ "-g0" ] | 906 cflags = [ "-g0" ] |
918 } | 907 } |
919 } | 908 } |
OLD | NEW |