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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 } | 556 } |
557 } | 557 } |
558 | 558 |
559 # Warnings --------------------------------------------------------------------- | 559 # Warnings --------------------------------------------------------------------- |
560 # | 560 # |
561 # This is where we disable various warnings that we've decided aren't | 561 # This is where we disable various warnings that we've decided aren't |
562 # worthwhile, and enable special warnings. | 562 # worthwhile, and enable special warnings. |
563 | 563 |
564 config("default_warnings") { | 564 config("default_warnings") { |
565 if (is_win) { | 565 if (is_win) { |
566 # Please keep ordered and add names if you add more. | |
567 cflags = [ | 566 cflags = [ |
568 "/WX", # Treat warnings as errors. | 567 "/WX", # Treat warnings as errors. |
569 "/wd4018", # Comparing signed and unsigned values. | 568 |
| 569 # Warnings permanently disabled: |
| 570 |
| 571 # C4127: conditional expression is constant |
| 572 # This warning can in theory catch dead code and other problems, but |
| 573 # triggers in far too many desirable cases where the conditional |
| 574 # expression is either set by macros or corresponds some legitimate |
| 575 # compile-time constant expression (due to constant template args, |
| 576 # conditionals comparing the sizes of different types, etc.). Some of |
| 577 # these can be worked around, but it's not worth it. |
| 578 "/wd4127", |
| 579 |
| 580 # C4251: 'identifier' : class 'type' needs to have dll-interface to be |
| 581 # used by clients of class 'type2' |
| 582 # This is necessary for the shared library build. |
| 583 "/wd4251", |
| 584 |
| 585 # C4351: new behavior: elements of array 'array' will be default |
| 586 # initialized |
| 587 # This is a silly "warning" that basically just alerts you that the |
| 588 # compiler is going to actually follow the language spec like it's |
| 589 # supposed to, instead of not following it like old buggy versions did. |
| 590 # There's absolutely no reason to turn this on. |
| 591 "/wd4351", |
| 592 |
| 593 # C4355: 'this': used in base member initializer list |
| 594 # It's commonly useful to pass |this| to objects in a class' initializer |
| 595 # list. While this warning can catch real bugs, most of the time the |
| 596 # constructors in question don't attempt to call methods on the passed-in |
| 597 # pointer (until later), and annotating every legit usage of this is |
| 598 # simply more hassle than the warning is worth. |
| 599 "/wd4355", |
| 600 |
| 601 # C4503: 'identifier': decorated name length exceeded, name was |
| 602 # truncated |
| 603 # This only means that some long error messages might have truncated |
| 604 # identifiers in the presence of lots of templates. It has no effect on |
| 605 # program correctness and there's no real reason to waste time trying to |
| 606 # prevent it. |
| 607 "/wd4503", |
| 608 |
| 609 # C4611: interaction between 'function' and C++ object destruction is |
| 610 # non-portable |
| 611 # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN |
| 612 # suggests using exceptions instead of setjmp/longjmp for C++, but |
| 613 # Chromium code compiles without exception support. We therefore have to |
| 614 # use setjmp/longjmp for e.g. JPEG decode error handling, which means we |
| 615 # have to turn off this warning (and be careful about how object |
| 616 # destruction happens in such cases). |
| 617 "/wd4611", |
| 618 |
| 619 |
| 620 # Warnings to evaluate and possibly fix/reenable later: |
| 621 |
570 "/wd4100", # Unreferenced formal function parameter. | 622 "/wd4100", # Unreferenced formal function parameter. |
571 "/wd4121", # Alignment of a member was sensitive to packing. | |
572 "/wd4125", # Decimal digit terminates octal escape sequence. | |
573 "/wd4127", # Conditional expression is constant. | |
574 "/wd4130", # Logical operation on address of string constant. | |
575 "/wd4189", # A variable was declared and initialized but never used. | 623 "/wd4189", # A variable was declared and initialized but never used. |
576 "/wd4201", # Nonstandard extension used: nameless struct/union. | |
577 "/wd4238", # Nonstandard extension used: class rvalue used as lvalue. | |
578 "/wd4244", # Conversion: possible loss of data. | 624 "/wd4244", # Conversion: possible loss of data. |
579 "/wd4245", # Conversion: signed/unsigned mismatch, | |
580 "/wd4251", # Class needs to have dll-interface. | |
581 "/wd4310", # Cast truncates constant value. | |
582 "/wd4351", # Elements of array will be default initialized. | |
583 "/wd4355", # 'this' used in base member initializer list. | |
584 "/wd4396", # Inline friend template thing. | |
585 "/wd4428", # Universal character name encountered in source. | |
586 "/wd4481", # Nonstandard extension: override specifier. | 625 "/wd4481", # Nonstandard extension: override specifier. |
587 "/wd4503", # Decorated name length exceeded, name was truncated. | |
588 "/wd4505", # Unreferenced local function has been removed. | 626 "/wd4505", # Unreferenced local function has been removed. |
589 "/wd4510", # Default constructor could not be generated. | 627 "/wd4510", # Default constructor could not be generated. |
590 "/wd4512", # Assignment operator could not be generated. | 628 "/wd4512", # Assignment operator could not be generated. |
591 "/wd4530", # Exception handler used, but unwind semantics not enabled. | |
592 "/wd4610", # Class can never be instantiated, constructor required. | 629 "/wd4610", # Class can never be instantiated, constructor required. |
593 "/wd4611", # C++ object destruction and 'catch'. | |
594 "/wd4701", # Potentially uninitialized local variable name used. | |
595 "/wd4702", # Unreachable code. | |
596 "/wd4706", # Assignment within conditional expression. | |
597 "/wd4819", # Character not in the current code page. | |
598 ] | 630 ] |
599 } else { | 631 } else { |
600 # Common GCC warning setup. | 632 # Common GCC warning setup. |
601 cflags = [ | 633 cflags = [ |
602 # Enables. | 634 # Enables. |
603 "-Wendif-labels", # Weird old-style text after an #endif. | 635 "-Wendif-labels", # Weird old-style text after an #endif. |
604 | 636 |
605 # Disables. | 637 # Disables. |
606 "-Wno-missing-field-initializers", # "struct foo f = {0};" | 638 "-Wno-missing-field-initializers", # "struct foo f = {0};" |
607 "-Wno-unused-parameter", # Unused function parameters. | 639 "-Wno-unused-parameter", # Unused function parameters. |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 } else { | 878 } else { |
847 cflags = [ "-g1" ] | 879 cflags = [ "-g1" ] |
848 } | 880 } |
849 } | 881 } |
850 | 882 |
851 config("no_symbols") { | 883 config("no_symbols") { |
852 if (!is_win) { | 884 if (!is_win) { |
853 cflags = [ "-g0" ] | 885 cflags = [ "-g0" ] |
854 } | 886 } |
855 } | 887 } |
OLD | NEW |