Skip to content

Commit 9a6797e

Browse files
committed
1 parent 0c603e1 commit 9a6797e

File tree

14 files changed

+439
-335
lines changed

14 files changed

+439
-335
lines changed

DEPS

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ vars = {
4444
"barback_tag" : "@0.15.2+9",
4545
"bazel_worker_tag": "@0.1.1",
4646
"boolean_selector_tag" : "@1.0.2",
47-
"boringssl_gen_rev": "@922830c0aad900dd3d143eef1ba06faa83fe263b",
47+
"boringssl_gen_rev": "@62c20247d582444cb2804f9ea4e3abaa6e47f6a5",
4848
"boringssl_rev" : "@8d343b44bbab829d1a28fdef650ca95f7db4412e",
4949
"charcode_tag": "@1.1.0",
5050
"chrome_rev" : "@19997",
@@ -561,6 +561,12 @@ hooks = [
561561
'pattern': '.',
562562
'action': ['python', 'sdk/tools/clang/scripts/update.py', '--if-needed'],
563563
},
564+
{
565+
# Update the Windows toolchain if necessary.
566+
'name': 'win_toolchain',
567+
'pattern': '.',
568+
'action': ['python', 'sdk/build/vs_toolchain.py', 'update'],
569+
},
564570
{
565571
"pattern": ".",
566572
"action": ["python", Var("dart_root") + "/tools/gyp_dart.py"],

build/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Generated file containing information about the VS toolchain on Windows
2+
win_toolchain.json

build/config/BUILDCONFIG.gn

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,7 @@ set_defaults("component") {
337337

338338
if (is_win) {
339339
# On windows we use the same toolchain for host and target by default.
340-
if (is_clang) {
341-
host_toolchain = "//build/toolchain/win:clang_$current_cpu"
342-
} else {
343-
host_toolchain = "//build/toolchain/win:$current_cpu"
344-
}
340+
host_toolchain = "//build/toolchain/win:$current_cpu"
345341
set_default_toolchain("$host_toolchain")
346342
} else if (is_android) {
347343
if (host_os == "linux") {

build/config/compiler/BUILD.gn

Lines changed: 22 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,6 @@ if (is_win) {
1919
import("//build/toolchain/ccache.gni")
2020
import("//build/config/sanitizers/sanitizers.gni")
2121

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-
3122
# default_include_dirs ---------------------------------------------------------
3223
#
3324
# This is a separate config so that third_party code (which would not use the
@@ -40,7 +31,6 @@ config("default_include_dirs") {
4031
]
4132
}
4233

43-
# TODO(GYP): is_ubsan, is_ubsan_vptr
4434
if (!is_win) {
4535
using_sanitizer = is_asan || is_lsan || is_tsan || is_msan
4636
}
@@ -73,40 +63,6 @@ config("compiler") {
7363
"/GS", # Enable buffer security checking.
7464
"/FS", # Preserve previous PDB behavior.
7565
]
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-
}
11066
} else {
11167
# Common GCC compiler flags setup.
11268
# --------------------------------
@@ -470,9 +426,9 @@ config("compiler_arm_fpu") {
470426
#
471427
# How do you determine what should go in here vs. "compiler" above? Consider if
472428
# 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.
476432

477433
config("runtime_library") {
478434
cflags = []
@@ -481,30 +437,13 @@ config("runtime_library") {
481437
lib_dirs = []
482438
libs = []
483439

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.
507441
if (is_win) {
442+
if (is_debug) {
443+
cflags += [ "/MTd" ]
444+
} else {
445+
cflags += [ "/MT" ]
446+
}
508447
defines += [
509448
"__STD_C",
510449
"_CRT_RAND_S",
@@ -590,108 +529,21 @@ config("runtime_library") {
590529
default_warning_flags = []
591530
default_warning_flags_cc = []
592531
if (is_win) {
593-
if (!is_clang || current_cpu != "x86") {
532+
if (current_cpu != "x86") {
594533
default_warning_flags += [ "/WX" ] # Treat warnings as errors.
595534
}
596535

597536
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*
670546
]
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-
}
695547
} else {
696548
# Common GCC warning setup.
697549
default_warning_flags += [
@@ -757,7 +609,9 @@ if (is_win) {
757609

758610
config("chromium_code") {
759611
if (is_win) {
760-
cflags = [ "/W4" ] # Warning level 4.
612+
# TODO(zra): Enable higher warning levels.
613+
# cflags = [ "/W4" ] # Warning level 4.
614+
cflags = []
761615
} else {
762616
cflags = [
763617
"-Wall",
@@ -787,12 +641,6 @@ config("no_chromium_code") {
787641
defines = []
788642

789643
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-
]
796644
defines += [
797645
"_CRT_NONSTDC_NO_WARNINGS",
798646
"_CRT_NONSTDC_NO_DEPRECATE",

build/config/win/BUILD.gn

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ config("common_linker_setup") {
6565
"/FIXED:NO",
6666
"/ignore:4199",
6767
"/ignore:4221",
68+
"/ignore:4197", # Disable multiple Dart_True export warning.
6869
"/NXCOMPAT",
6970

7071
# Suggested by Microsoft Devrel to avoid
@@ -85,17 +86,9 @@ config("common_linker_setup") {
8586
} else {
8687
ldflags += [ "/DYNAMICBASE" ]
8788
}
88-
89-
# Delay loaded DLLs.
90-
ldflags += [
91-
"/DELAYLOAD:dbghelp.dll",
92-
"/DELAYLOAD:dwmapi.dll",
93-
"/DELAYLOAD:shell32.dll",
94-
"/DELAYLOAD:uxtheme.dll",
95-
]
9689
}
9790

98-
# Subsystem --------------------------------------------------------------------
91+
# Subsystem -------------------------------------------------------------------
9992

10093
# This is appended to the subsystem to specify a minimum version.
10194
if (current_cpu == "x64") {
@@ -114,7 +107,7 @@ config("windowed") {
114107
ldflags = [ "/SUBSYSTEM:WINDOWS$subsystem_version_suffix" ]
115108
}
116109

117-
# Incremental linking ----------------------------------------------------------
110+
# Incremental linking ---------------------------------------------------------
118111

119112
incremental_linking_on_switch = [ "/INCREMENTAL" ]
120113
incremental_linking_off_switch = [ "/INCREMENTAL:NO" ]
@@ -151,7 +144,7 @@ config("default_large_module_incremental_linking") {
151144
}
152145
}
153146

154-
# Character set ----------------------------------------------------------------
147+
# Character set ---------------------------------------------------------------
155148

156149
# Not including this config means "ansi" (8-bit system codepage).
157150
config("unicode") {
@@ -161,7 +154,7 @@ config("unicode") {
161154
]
162155
}
163156

164-
# Lean and mean ----------------------------------------------------------------
157+
# Lean and mean ---------------------------------------------------------------
165158

166159
# Some third party code might not compile with WIN32_LEAN_AND_MEAN so we have
167160
# to have a separate config for it. Remove this config from your target to

build/config/win/visual_studio_version.gni

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ declare_args() {
2323
}
2424

2525
if (visual_studio_path == "") {
26-
toolchain_data =
26+
_toolchain_data =
2727
exec_script("../../vs_toolchain.py", [ "get_toolchain_dir" ], "scope")
28-
visual_studio_path = toolchain_data.vs_path
29-
windows_sdk_path = toolchain_data.sdk_path
30-
visual_studio_version = toolchain_data.vs_version
31-
wdk_path = toolchain_data.wdk_dir
32-
visual_studio_runtime_dirs = toolchain_data.runtime_dirs
28+
visual_studio_path = _toolchain_data.vs_path
29+
windows_sdk_path = _toolchain_data.sdk_path
30+
visual_studio_version = _toolchain_data.vs_version
31+
wdk_path = _toolchain_data.wdk_dir
32+
visual_studio_runtime_dirs = _toolchain_data.runtime_dirs
3333
} else {
3434
assert(visual_studio_version != "",
3535
"You must set the visual_studio_version if you set the path")

0 commit comments

Comments
 (0)