summaryrefslogtreecommitdiffstats
path: root/chromium/build/config/win/BUILD.gn
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-24 11:40:17 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-24 12:42:11 +0000
commit5d87695f37678f96492b258bbab36486c59866b4 (patch)
treebe9783bbaf04fb930c4d74ca9c00b5e7954c8bc6 /chromium/build/config/win/BUILD.gn
parent6c11fb357ec39bf087b8b632e2b1e375aef1b38b (diff)
BASELINE: Update Chromium to 75.0.3770.56
Change-Id: I86d2007fd27a45d5797eee06f4c9369b8b50ac4f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/build/config/win/BUILD.gn')
-rw-r--r--chromium/build/config/win/BUILD.gn126
1 files changed, 57 insertions, 69 deletions
diff --git a/chromium/build/config/win/BUILD.gn b/chromium/build/config/win/BUILD.gn
index f09326af6e3..b5a58459acb 100644
--- a/chromium/build/config/win/BUILD.gn
+++ b/chromium/build/config/win/BUILD.gn
@@ -14,12 +14,6 @@ import("//build/toolchain/toolchain.gni")
assert(is_win)
declare_args() {
- # Set this to true to enable static analysis through Visual Studio's
- # /analyze. This dramatically slows compiles and reports thousands of
- # warnings, so normally this is done on a build machine and only the new
- # warnings are examined.
- use_vs_code_analysis = false
-
# Turn this on to have the linker output extra timing information.
win_linker_timing = false
@@ -45,6 +39,12 @@ declare_args() {
# and with this switch, clang emits it like this:
# foo/bar.cc:12:34: error: something went wrong
use_clang_diagnostics_format = false
+
+ # Use absolute file paths in the compiler diagnostics and (for non-clang)
+ # __FILE__ macro if needed. Note that enabling this makes your build
+ # dependent your checkout's path, which means you won't get to use goma's
+ # global cache, and without clang your builds won't be deterministic.
+ msvc_use_absolute_paths = false
}
# This is included by reference in the //build/config/compiler config that
@@ -66,6 +66,7 @@ config("compiler") {
"/Gy", # Enable function-level linking.
"/FS", # Preserve previous PDB behavior.
"/bigobj", # Some of our files are bigger than the regular limits.
+ "/utf-8", # Assume UTF-8 by default to avoid code page dependencies.
]
# Force C/C++ mode for the given GN detected file type. This is necessary
@@ -75,17 +76,40 @@ config("compiler") {
cflags_cc = [ "/TP" ]
cflags += [
- # Tell the compiler to crash on failures. This is undocumented
- # and unsupported but very handy.
- "/d2FastFail",
-
# Work around crbug.com/526851, bug in VS 2015 RTM compiler.
"/Zc:sizedDealloc-",
]
+ if (msvc_use_absolute_paths) {
+ # Pass /FC flag to the compiler if needed.
+ cflags += [ "/FC" ]
+
+ # Print absolute paths in diagnostics. There is no precedent for doing this
+ # on Linux/Mac (GCC doesn't support it), but MSVC does this with /FC and
+ # Windows developers rely on it (crbug.com/636109) so only do this on
+ # Windows.
+ # TODO(thakis): This comment no longer really make sense after
+ # https://chromium-review.googlesource.com/c/chromium/src/+/558871/
+ # See if we can remove msvc_use_absolute_paths. See also discussion in
+ # https://reviews.llvm.org/D23816
+ if (is_clang) {
+ cflags += [ "-fdiagnostics-absolute-paths" ]
+ }
+ }
+
if (is_clang) {
+ # Don't look for includes in %INCLUDE%.
+ cflags += [ "/X" ]
+
+ # Tell clang which version of MSVC to emulate.
cflags += [ "-fmsc-version=1911" ]
+ # Emit table of address-taken functions for Control-Flow Guard (CFG). We
+ # don't emit the CFG checks themselves, but this enables the functions to
+ # be called by code that is built with those checks enabled, such as system
+ # libraries.
+ cflags += [ "/guard:cf,nochecks" ]
+
if (is_component_build) {
cflags += [
# Do not export inline member functions. This makes component builds
@@ -96,8 +120,12 @@ config("compiler") {
if (current_cpu == "x86") {
cflags += [ "-m32" ]
- } else {
+ } else if (current_cpu == "x64") {
cflags += [ "-m64" ]
+ } else if (current_cpu == "arm64") {
+ cflags += [ "--target=arm64-windows" ]
+ } else {
+ assert(false, "unknown current_cpu " + current_cpu)
}
if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
@@ -110,12 +138,7 @@ config("compiler") {
}
if (use_clang_diagnostics_format) {
- cflags += [
- "-Xclang",
- "-fdiagnostics-format",
- "-Xclang",
- "clang",
- ]
+ cflags += [ "/clang:-fdiagnostics-format=clang" ]
}
# Clang runtime libraries, such as the sanitizer runtimes, live here.
@@ -184,46 +207,6 @@ config("compiler") {
]
}
-config("vs_code_analysis") {
- if (use_vs_code_analysis && !is_clang) {
- # When use_vs_code_analysis is specified add the /analyze switch to enable
- # static analysis. Specifying /analyze:WX- says that /analyze warnings
- # should not be treated as errors.
- cflags = [ "/analyze:WX-" ]
-
- # Also, disable various noisy warnings that have low value.
- cflags += [
- "/wd6011", # Dereferencing NULL pointer
-
- # C6285 is ~16% of raw warnings and has low value
- "/wd6285", # non-zero constant || non-zero constant
- "/wd6308", # realloc might return null pointer
-
- # Possible infinite loop: use of the constant
- # EXCEPTION_CONTINUE_EXECUTION in the exception-filter
- "/wd6312",
-
- "/wd6322", # Empty _except block
- "/wd6330", # 'char' used instead of 'unsigned char' for istype() call
-
- # C6334 is ~80% of raw warnings and has low value
- "/wd6334", # sizeof applied to an expression with an operator
- "/wd6326", # Potential comparison of constant with constant
- "/wd6340", # Sign mismatch in function parameter
- "/wd28159", # Consider using 'GetTickCount64'
- "/wd28196", # The precondition is not satisfied
- "/wd28204", # Inconsistent SAL annotations
- "/wd28251", # Inconsistent SAL annotations
- "/wd28252", # Inconsistent SAL annotations
- "/wd28253", # Inconsistent SAL annotations
- "/wd28278", # Function appears with no prototype in scope
- "/wd28285", # syntax error in SAL annotation (in algorithm)
- "/wd28301", # Inconsistent SAL annotations
- "/wd28182", # Dereferencing NULL pointer
- ]
- }
-}
-
# This is included by reference in the //build/config/compiler:runtime_library
# config that is applied to all targets. It is here to separate out the logic
# that is Windows-only. Please see that target for advice on what should go in
@@ -250,11 +233,9 @@ config("runtime_library") {
"_SECURE_ATL",
]
- if (!use_vs_code_analysis) {
- # This is required for ATL to use XP-safe versions of its functions.
- # However it is prohibited when using /analyze
- defines += [ "_USING_V110_SDK71_" ]
- }
+ # This is required for ATL to use XP-safe versions of its functions.
+ # TODO(thakis): We no longer support XP; try removing this.
+ defines += [ "_USING_V110_SDK71_" ]
if (current_os == "winuwp") {
# When targeting Windows Runtime, certain compiler/linker flags are
@@ -301,11 +282,20 @@ config("runtime_library") {
}
}
-# Sets the default Windows build version. This is separated because some
-# targets need to manually override it for their compiles.
+# Chromium supports running on Windows 7, but if these constants are set to
+# Windows 7, then newer APIs aren't made available by the Windows SDK.
+# So we set this to Windows 10 and then are careful to check at runtime
+# to only call newer APIs when they're available.
+# Some third-party libraries assume that these defines set what version of
+# Windows is available at runtime. Targets using these libraries need to
+# manually override this config for their compiles.
config("winver") {
defines = [
- "NTDDI_VERSION=0x0A000003", # NTDDI_WIN10_RS2
+ "NTDDI_VERSION=NTDDI_WIN10_RS2",
+
+ # We can't say `=_WIN32_WINNT_WIN10` here because some files do
+ # `#if WINVER < 0x0600` without including windows.h before,
+ # and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00.
"_WIN32_WINNT=0x0A00",
"WINVER=0x0A00",
]
@@ -361,7 +351,6 @@ config("sdk_link") {
# their own.
config("common_linker_setup") {
ldflags = [
- "/fastfail",
"/FIXED:NO",
"/ignore:4199",
"/ignore:4221",
@@ -388,9 +377,8 @@ config("cfi_linker") {
# lots of child processes, so this means things are really slow. Disable CFG
# for now. https://crbug.com/846966
if (!is_debug && !is_component_build && !is_asan) {
- # Turn on CFG in msvc linker, regardless of compiler used. Turn off CFG for
- # longjmp (new in VS 2017) because it relies on compiler support which we do
- # not have enabled.
+ # Turn on CFG, except for longjmp because it relies on compiler support
+ # which clang doesn't have yet.
ldflags = [ "/guard:cf,nolongjmp" ]
}
}