Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: build/config/win/BUILD.gn

Issue 2581893002: Use the /WX flag to have link warnings treated as errors. (Closed)
Patch Set: Restore exceptions and update comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/clang/clang.gni") 5 import("//build/config/clang/clang.gni")
6 import("//build/config/compiler/compiler.gni") 6 import("//build/config/compiler/compiler.gni")
7 import("//build/config/sanitizers/sanitizers.gni") 7 import("//build/config/sanitizers/sanitizers.gni")
8 import("//build/config/win/visual_studio_version.gni") 8 import("//build/config/win/visual_studio_version.gni")
9 import("//build/toolchain/toolchain.gni") 9 import("//build/toolchain/toolchain.gni")
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (is_syzyasan) { 95 if (is_syzyasan) {
96 assert(!is_win_fastlink) 96 assert(!is_win_fastlink)
97 ldflags = [ "/PROFILE" ] 97 ldflags = [ "/PROFILE" ]
98 } else { 98 } else {
99 if (!is_debug && !is_component_build) { 99 if (!is_debug && !is_component_build) {
100 if (is_win_fastlink || is_clang) { 100 if (is_win_fastlink || is_clang) {
101 # /PROFILE implies the following linker flags. Therefore if we are 101 # /PROFILE implies the following linker flags. Therefore if we are
102 # skipping /PROFILE because it is incompatible with /DEBUG:FASTLINK 102 # skipping /PROFILE because it is incompatible with /DEBUG:FASTLINK
103 # we should explicitly add these flags in order to avoid unintended 103 # we should explicitly add these flags in order to avoid unintended
104 # consequences such as larger binaries. 104 # consequences such as larger binaries.
105 ldflags = [ 105 ldflags += [
brucedawson 2016/12/21 22:22:53 This is wrong. "+=" should only be allowed if ldfl
Wez 2016/12/22 00:03:08 Done.
106 "/OPT:REF", 106 "/OPT:REF",
107 "/OPT:ICF", 107 "/OPT:ICF",
108 "/INCREMENTAL:NO", 108 "/INCREMENTAL:NO",
109 "/FIXED:NO", 109 "/FIXED:NO",
110 ] 110 ]
111 } else { 111 } else {
112 ldflags = [ "/PROFILE" ] 112 ldflags = [ "/PROFILE" ]
113 } 113 }
114 } 114 }
115 } 115 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 config("winver") { 205 config("winver") {
206 defines = [ 206 defines = [
207 "NTDDI_VERSION=0x0A000000", 207 "NTDDI_VERSION=0x0A000000",
208 "_WIN32_WINNT=0x0A00", 208 "_WIN32_WINNT=0x0A00",
209 "WINVER=0x0A00", 209 "WINVER=0x0A00",
210 ] 210 ]
211 } 211 }
212 212
213 # Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs. 213 # Linker flags for Windows SDK setup, this is applied only to EXEs and DLLs.
214 config("sdk_link") { 214 config("sdk_link") {
215 # Treat linker warnings as errors, to avoid spammy build output.
216 ldflags = [ "/WX" ]
217
215 if (current_cpu == "x64") { 218 if (current_cpu == "x64") {
216 ldflags = [ "/MACHINE:X64" ] 219 ldflags += [ "/MACHINE:X64" ]
217 lib_dirs = [ 220 lib_dirs = [
218 "$windows_sdk_path\Lib\winv6.3\um\x64", 221 "$windows_sdk_path\Lib\winv6.3\um\x64",
219 "$visual_studio_path\VC\lib\amd64", 222 "$visual_studio_path\VC\lib\amd64",
220 "$visual_studio_path\VC\atlmfc\lib\amd64", 223 "$visual_studio_path\VC\atlmfc\lib\amd64",
221 ] 224 ]
222 } else { 225 } else {
223 ldflags = [ 226 ldflags += [
224 "/MACHINE:X86", 227 "/MACHINE:X86",
225 "/SAFESEH", # Not compatible with x64 so use only for x86. 228 "/SAFESEH", # Not compatible with x64 so use only for x86.
226 "/largeaddressaware", 229 "/largeaddressaware",
227 ] 230 ]
228 lib_dirs = [ 231 lib_dirs = [
229 "$windows_sdk_path\Lib\winv6.3\um\x86", 232 "$windows_sdk_path\Lib\winv6.3\um\x86",
230 "$visual_studio_path\VC\lib", 233 "$visual_studio_path\VC\lib",
231 "$visual_studio_path\VC\atlmfc\lib", 234 "$visual_studio_path\VC\atlmfc\lib",
232 ] 235 ]
233 } 236 }
234 } 237 }
235 238
236 # This default linker setup is provided separately from the SDK setup so 239 # This default linker setup is provided separately from the SDK setup so
237 # targets who want different library configurations can remove this and specify 240 # targets who want different library configurations can remove this and specify
238 # their own. 241 # their own.
239 config("common_linker_setup") { 242 config("common_linker_setup") {
240 ldflags = [ 243 ldflags = [
244 "/WX",
241 "/FIXED:NO", 245 "/FIXED:NO",
242 "/ignore:4199", 246 "/ignore:4199",
243 "/ignore:4221", 247 "/ignore:4221",
244 "/NXCOMPAT", 248 "/NXCOMPAT",
245 ] 249 ]
246 250
247 ldflags += [ 251 ldflags += [
brucedawson 2016/12/21 22:22:53 Odd that this is separate. For historical reasons
Wez 2016/12/22 00:03:08 Done.
248 # Tell the linker to crash on failures. 252 # Tell the linker to crash on failures.
249 "/fastfail", 253 "/fastfail",
250 ] 254 ]
251 255
252 # ASLR makes debugging with windbg difficult because Chrome.exe and 256 # ASLR makes debugging with windbg difficult because Chrome.exe and
253 # Chrome.dll share the same base name. As result, windbg will name the 257 # Chrome.dll share the same base name. As result, windbg will name the
254 # Chrome.dll module like chrome_<base address>, where <base address> 258 # Chrome.dll module like chrome_<base address>, where <base address>
255 # typically changes with each launch. This in turn means that breakpoints in 259 # typically changes with each launch. This in turn means that breakpoints in
256 # Chrome.dll don't stick from one launch to the next. For this reason, we 260 # Chrome.dll don't stick from one launch to the next. For this reason, we
257 # turn ASLR off in debug builds. 261 # turn ASLR off in debug builds.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 427
424 # Internal stuff -------------------------------------------------------------- 428 # Internal stuff --------------------------------------------------------------
425 429
426 # Config used by the MIDL template to disable warnings. 430 # Config used by the MIDL template to disable warnings.
427 config("midl_warnings") { 431 config("midl_warnings") {
428 if (is_clang) { 432 if (is_clang) {
429 # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_". 433 # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_".
430 cflags = [ "-Wno-extra-tokens" ] 434 cflags = [ "-Wno-extra-tokens" ]
431 } 435 }
432 } 436 }
OLDNEW
« no previous file with comments | « no previous file | media/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698