@@ -19,15 +19,6 @@ if (is_win) {
19
19
import (" //build/toolchain/ccache.gni" )
20
20
import (" //build/config/sanitizers/sanitizers.gni" )
21
21
22
- declare_args () {
23
- if (is_win ) {
24
- # Whether the VS xtree header has been patched to disable warning 4702. If
25
- # it has, then we don't need to disable 4702 (unreachable code warning).
26
- # The patch is preapplied to the internal toolchain and hence all bots.
27
- msvs_xtree_patched = false
28
- }
29
- }
30
-
31
22
# default_include_dirs ---------------------------------------------------------
32
23
#
33
24
# This is a separate config so that third_party code (which would not use the
@@ -40,7 +31,6 @@ config("default_include_dirs") {
40
31
]
41
32
}
42
33
43
- # TODO(GYP ): is_ubsan, is_ubsan_vptr
44
34
if (! is_win ) {
45
35
using_sanitizer = is_asan || is_lsan || is_tsan || is_msan
46
36
}
@@ -73,40 +63,6 @@ config("compiler") {
73
63
" /GS" , # Enable buffer security checking.
74
64
" /FS" , # Preserve previous PDB behavior.
75
65
]
76
-
77
- # Building with Clang on Windows is a work in progress and very
78
- # experimental. See crbug.com/82385.
79
- # Keep this in sync with the similar block in build/common.gypi
80
- if (is_clang ) {
81
- cflags += [
82
- # Many files use intrinsics without including this header.
83
- # TODO(hans ): Fix those files, or move this to sub-GYPs.
84
- " /FIIntrin.h" ,
85
- ]
86
-
87
- if (visual_studio_version == " 2013" ) {
88
- cflags += [ " -fmsc-version=1800" ]
89
- } else if (visual_studio_version == " 2015" ) {
90
- cflags += [ " -fmsc-version=1900" ]
91
- }
92
-
93
- if (current_cpu == " x86" ) {
94
- cflags += [
95
- " /fallback" ,
96
- " -m32" ,
97
- ]
98
- } else {
99
- cflags += [ " -m64" ]
100
- }
101
- if (exec_script (" //build/win/use_ansi_codes.py" , [], " trim string" ) ==
102
- " True" ) {
103
- cflags += [
104
- # cmd.exe doesn't understand ANSI escape codes by default,
105
- # so only enable them if something emulating them is around.
106
- " -fansi-escape-codes" ,
107
- ]
108
- }
109
- }
110
66
} else {
111
67
# Common GCC compiler flags setup.
112
68
# --------------------------------
@@ -470,9 +426,9 @@ config("compiler_arm_fpu") {
470
426
#
471
427
# How do you determine what should go in here vs. "compiler" above? Consider if
472
428
# a target might choose to use a different runtime library (ignore for a moment
473
- # if this is possible or reasonable on your system). If such a target would want
474
- # to change or remove your option, put it in the runtime_library config. If a
475
- # target wants the option regardless, put it in the compiler config.
429
+ # if this is possible or reasonable on your system). If such a target would
430
+ # want to change or remove your option, put it in the runtime_library config.
431
+ # If a target wants the option regardless, put it in the compiler config.
476
432
477
433
config (" runtime_library" ) {
478
434
cflags = []
@@ -481,30 +437,13 @@ config("runtime_library") {
481
437
lib_dirs = []
482
438
libs = []
483
439
484
- if (is_component_build ) {
485
- # Component mode: dynamic CRT.
486
- defines += [ " COMPONENT_BUILD" ]
487
- if (is_win ) {
488
- # Since the library is shared, it requires exceptions or will give errors
489
- # about things not matching, so keep exceptions on.
490
- if (is_debug ) {
491
- cflags += [ " /MDd" ]
492
- } else {
493
- cflags += [ " /MD" ]
494
- }
495
- }
496
- } else {
497
- # Static CRT.
498
- if (is_win ) {
499
- if (is_debug ) {
500
- cflags += [ " /MTd" ]
501
- } else {
502
- cflags += [ " /MT" ]
503
- }
504
- }
505
- }
506
-
440
+ # Static CRT.
507
441
if (is_win ) {
442
+ if (is_debug ) {
443
+ cflags += [ " /MTd" ]
444
+ } else {
445
+ cflags += [ " /MT" ]
446
+ }
508
447
defines += [
509
448
" __STD_C" ,
510
449
" _CRT_RAND_S" ,
@@ -590,108 +529,21 @@ config("runtime_library") {
590
529
default_warning_flags = []
591
530
default_warning_flags_cc = []
592
531
if (is_win ) {
593
- if (! is_clang || current_cpu != " x86" ) {
532
+ if (current_cpu != " x86" ) {
594
533
default_warning_flags += [ " /WX" ] # Treat warnings as errors.
595
534
}
596
535
597
536
default_warning_flags += [
598
- # Warnings permanently disabled:
599
-
600
- # TODO(GYP) The GYP build doesn't have this globally enabled but disabled
601
- # for a bunch of individual targets. Re-enable this globally when those
602
- # targets are fixed.
603
- " /wd4018" , # Comparing signed and unsigned values.
604
-
605
- # C4127: conditional expression is constant
606
- # This warning can in theory catch dead code and other problems, but
607
- # triggers in far too many desirable cases where the conditional
608
- # expression is either set by macros or corresponds some legitimate
609
- # compile-time constant expression (due to constant template args,
610
- # conditionals comparing the sizes of different types, etc.). Some of
611
- # these can be worked around, but it's not worth it.
612
- " /wd4127" ,
613
-
614
- # C4251: 'identifier' : class 'type' needs to have dll-interface to be
615
- # used by clients of class 'type2'
616
- # This is necessary for the shared library build.
617
- " /wd4251" ,
618
-
619
- # C4351: new behavior: elements of array 'array' will be default
620
- # initialized
621
- # This is a silly "warning" that basically just alerts you that the
622
- # compiler is going to actually follow the language spec like it's
623
- # supposed to, instead of not following it like old buggy versions did.
624
- # There's absolutely no reason to turn this on.
625
- " /wd4351" ,
626
-
627
- # C4355: 'this': used in base member initializer list
628
- # It's commonly useful to pass |this| to objects in a class' initializer
629
- # list. While this warning can catch real bugs, most of the time the
630
- # constructors in question don't attempt to call methods on the passed-in
631
- # pointer (until later), and annotating every legit usage of this is
632
- # simply more hassle than the warning is worth.
633
- " /wd4355" ,
634
-
635
- # C4503: 'identifier': decorated name length exceeded, name was
636
- # truncated
637
- # This only means that some long error messages might have truncated
638
- # identifiers in the presence of lots of templates. It has no effect on
639
- # program correctness and there's no real reason to waste time trying to
640
- # prevent it.
641
- " /wd4503" ,
642
-
643
- # Warning C4589 says: "Constructor of abstract class ignores
644
- # initializer for virtual base class." Disable this warning because it
645
- # is flaky in VS 2015 RTM. It triggers on compiler generated
646
- # copy-constructors in some cases.
647
- " /wd4589" ,
648
-
649
- # C4611: interaction between 'function' and C++ object destruction is
650
- # non-portable
651
- # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN
652
- # suggests using exceptions instead of setjmp/longjmp for C++, but
653
- # Chromium code compiles without exception support. We therefore have to
654
- # use setjmp/longjmp for e.g. JPEG decode error handling, which means we
655
- # have to turn off this warning (and be careful about how object
656
- # destruction happens in such cases).
657
- " /wd4611" ,
658
-
659
- # Warnings to evaluate and possibly fix/reenable later:
660
-
661
- " /wd4100" , # Unreferenced formal function parameter.
662
- " /wd4121" , # Alignment of a member was sensitive to packing.
663
- " /wd4244" , # Conversion: possible loss of data.
664
- " /wd4481" , # Nonstandard extension: override specifier.
665
- " /wd4505" , # Unreferenced local function has been removed.
666
- " /wd4510" , # Default constructor could not be generated.
667
- " /wd4512" , # Assignment operator could not be generated.
668
- " /wd4610" , # Class can never be instantiated, constructor required.
669
- " /wd4996" , # Deprecated function warning.
537
+ # Permanent.
538
+ " /wd4091" , # typedef warning from dbghelp.h
539
+ # Investigate.
540
+ " /wd4312" , # int to pointer of greater size conversion.
541
+ " /wd4838" , # Narrowing conversion required.
542
+ " /wd4172" , # Returning address of local.
543
+ " /wd4005" , # Redefinition of macros for PRId64 etc.
544
+ " /wd4311" , # Pointer truncation from PVOID to DWORD.
545
+ " /wd4477" , # Format string requires wchar_t*
670
546
]
671
-
672
- # VS xtree header file needs to be patched or 4702 (unreachable code
673
- # warning) is reported if _HAS_EXCEPTIONS=0. Disable the warning if xtree is
674
- # not patched.
675
- if (! msvs_xtree_patched &&
676
- exec_script (" ../../win_is_xtree_patched.py" , [], " value" ) == 0 ) {
677
- default_warning_flags += [ " /wd4702" ] # Unreachable code.
678
- }
679
-
680
- # Building with Clang on Windows is a work in progress and very
681
- # experimental. See crbug.com/82385.
682
- # Keep this in sync with the similar block in build/common.gypi
683
- if (is_clang ) {
684
- default_warning_flags += [
685
- # TODO(hans ): Make this list shorter eventually, http://crbug.com/504657
686
- " -Qunused-arguments" , # http://crbug.com/504658
687
- " -Wno-microsoft" , # http://crbug.com/505296
688
- " -Wno-switch" , # http://crbug.com/505308
689
- " -Wno-unknown-pragmas" , # http://crbug.com/505314
690
- " -Wno-unused-function" , # http://crbug.com/505316
691
- " -Wno-unused-value" , # http://crbug.com/505318
692
- " -Wno-unused-local-typedef" , # http://crbug.com/411648
693
- ]
694
- }
695
547
} else {
696
548
# Common GCC warning setup.
697
549
default_warning_flags += [
@@ -757,7 +609,9 @@ if (is_win) {
757
609
758
610
config (" chromium_code" ) {
759
611
if (is_win ) {
760
- cflags = [ " /W4" ] # Warning level 4.
612
+ # TODO(zra ): Enable higher warning levels.
613
+ # cflags = [ "/W4" ] # Warning level 4.
614
+ cflags = []
761
615
} else {
762
616
cflags = [
763
617
" -Wall" ,
@@ -787,12 +641,6 @@ config("no_chromium_code") {
787
641
defines = []
788
642
789
643
if (is_win ) {
790
- cflags += [
791
- " /W3" , # Warning level 3.
792
- " /wd4800" , # Disable warning when forcing value to bool.
793
- " /wd4267" , # TODO(jschuh ): size_t to int.
794
- " /wd4996" , # Deprecated function warning.
795
- ]
796
644
defines += [
797
645
" _CRT_NONSTDC_NO_WARNINGS" ,
798
646
" _CRT_NONSTDC_NO_DEPRECATE" ,
0 commit comments