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

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

Issue 1658903002: Enable /analyze in gn builds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn format, and manual tweaks Created 4 years, 10 months 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
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/compiler/compiler.gni") 5 import("//build/config/compiler/compiler.gni")
6 import("//build/config/sanitizers/sanitizers.gni") 6 import("//build/config/sanitizers/sanitizers.gni")
7 import("//build/config/win/visual_studio_version.gni") 7 import("//build/config/win/visual_studio_version.gni")
8 8
9 assert(is_win) 9 assert(is_win)
10 10
11 # This is included by reference in the //build/config/compiler config that 11 # This is included by reference in the //build/config/compiler config that
12 # is applied to all targets. It is here to separate out the logic that is 12 # is applied to all targets. It is here to separate out the logic that is
13 # Windows-only. 13 # Windows-only.
14 config("compiler") { 14 config("compiler") {
brettw 2016/02/03 18:48:00 Probably the cleanest way to hook up your analyze
brucedawson 2016/02/06 01:07:30 I think I had it there initially but then I couldn
15 if (current_cpu == "x86") { 15 if (current_cpu == "x86") {
16 asmflags = [ 16 asmflags = [
17 # When /safeseh is specified, the linker will only produce an image if it 17 # When /safeseh is specified, the linker will only produce an image if it
18 # can also produce a table of the image's safe exception handlers. This 18 # can also produce a table of the image's safe exception handlers. This
19 # table specifies for the operating system which exception handlers are 19 # table specifies for the operating system which exception handlers are
20 # valid for the image. Note that /SAFESEH isn't accepted on the command 20 # valid for the image. Note that /SAFESEH isn't accepted on the command
21 # line, only /safeseh. This is only accepted by ml.exe, not ml64.exe. 21 # line, only /safeseh. This is only accepted by ml.exe, not ml64.exe.
22 "/safeseh", 22 "/safeseh",
23 ] 23 ]
24 } 24 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 } 74 }
75 75
76 if (is_syzyasan) { 76 if (is_syzyasan) {
77 # SyzyAsan needs /PROFILE turned on to produce appropriate pdbs. 77 # SyzyAsan needs /PROFILE turned on to produce appropriate pdbs.
78 assert(!is_win_fastlink, "/PROFILE and /DEBUG:FASTLINK are incompatible") 78 assert(!is_win_fastlink, "/PROFILE and /DEBUG:FASTLINK are incompatible")
79 ldflags = [ "/PROFILE" ] 79 ldflags = [ "/PROFILE" ]
80 } 80 }
81 } 81 }
82 82
83 config("win_analyze") {
brettw 2016/02/03 18:48:00 I'd call this just "analyze" since you're already
brucedawson 2016/02/06 01:07:30 I just tried that and immediately hit the disadvan
84 if (is_win_analyze) {
85 # When is_win_analyze is specified add the /analyze switch to enable static
86 # analysis. Specifying /analyze:WX- says that /analyze warnings should not
87 # be treated as errors.
88 cflags = [ "/analyze:WX-" ]
89
90 # Also, disable various noisy warnings that have low value.
91 cflags += [
92 "/wd6011", # Dereferencing NULL pointer
93
94 # C6285 is ~16% of raw warnings and has low value
95 "/wd6285", # non-zero constant || non-zero constant
96 "/wd6308", # realloc might return null pointer
97
98 # Possible infinite loop: use of the constant
99 # EXCEPTION_CONTINUE_EXECUTION in the exception-filter
100 "/wd6312",
101
102 "/wd6322", # Empty _except block
103 "/wd6330", # 'char' used instead of 'unsigned char' for istype() call
104
105 # C6334 is ~80% of raw warnings and has low value
106 "/wd6334", # sizeof applied to an expression with an operator
107 "/wd6326", # Potential comparison of constant with constant
108 "/wd6340", # Sign mismatch in function parameter
109 "/wd28159", # Consider using 'GetTickCount64'
110 "/wd28196", # The precondition is not satisfied
111 "/wd28204", # Inconsistent SAL annotations
112 "/wd28251", # Inconsistent SAL annotations
113 "/wd28252", # Inconsistent SAL annotations
114 "/wd28253", # Inconsistent SAL annotations
115 "/wd28278", # Function appears with no prototype in scope
116 "/wd28285", # syntax error in SAL annotation (in algorithm)
117 "/wd28301", # Inconsistent SAL annotations
118 "/wd28182", # Dereferencing NULL pointer
119 ]
120 }
121 }
122
83 # This is included by reference in the //build/config/compiler:runtime_library 123 # This is included by reference in the //build/config/compiler:runtime_library
84 # config that is applied to all targets. It is here to separate out the logic 124 # config that is applied to all targets. It is here to separate out the logic
85 # that is Windows-only. Please see that target for advice on what should go in 125 # that is Windows-only. Please see that target for advice on what should go in
86 # :runtime_library vs. :compiler. 126 # :runtime_library vs. :compiler.
87 config("runtime_library") { 127 config("runtime_library") {
88 cflags = [] 128 cflags = []
89 129
90 # Defines that set up the CRT. 130 # Defines that set up the CRT.
91 defines = [ 131 defines = [
92 "__STD_C", 132 "__STD_C",
93 "_CRT_RAND_S", 133 "_CRT_RAND_S",
94 "_CRT_SECURE_NO_DEPRECATE", 134 "_CRT_SECURE_NO_DEPRECATE",
95 "_HAS_EXCEPTIONS=0", 135 "_HAS_EXCEPTIONS=0",
96 "_SCL_SECURE_NO_DEPRECATE", 136 "_SCL_SECURE_NO_DEPRECATE",
97 ] 137 ]
98 138
99 # Defines that set up the Windows SDK. 139 # Defines that set up the Windows SDK.
100 defines += [ 140 defines += [
101 "_ATL_NO_OPENGL", 141 "_ATL_NO_OPENGL",
102 "_WINDOWS", 142 "_WINDOWS",
103 "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS", 143 "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
104 "NTDDI_VERSION=0x0A000000", 144 "NTDDI_VERSION=0x0A000000",
105 "PSAPI_VERSION=1", 145 "PSAPI_VERSION=1",
106 "WIN32", 146 "WIN32",
107 "_SECURE_ATL", 147 "_SECURE_ATL",
148 ]
108 149
150 if (!is_win_analyze) {
109 # This is required for ATL to use XP-safe versions of its functions. 151 # This is required for ATL to use XP-safe versions of its functions.
110 "_USING_V110_SDK71_", 152 # However it is prohibited when using /analyze
111 ] 153 defines += [ "_USING_V110_SDK71_" ]
154 }
112 155
113 if (is_component_build) { 156 if (is_component_build) {
114 # Component mode: dynamic CRT. Since the library is shared, it requires 157 # Component mode: dynamic CRT. Since the library is shared, it requires
115 # exceptions or will give errors about things not matching, so keep 158 # exceptions or will give errors about things not matching, so keep
116 # exceptions on. 159 # exceptions on.
117 if (is_debug) { 160 if (is_debug) {
118 cflags += [ "/MDd" ] 161 cflags += [ "/MDd" ]
119 } else { 162 } else {
120 cflags += [ "/MD" ] 163 cflags += [ "/MD" ]
121 } 164 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 355
313 # Internal stuff -------------------------------------------------------------- 356 # Internal stuff --------------------------------------------------------------
314 357
315 # Config used by the MIDL template to disable warnings. 358 # Config used by the MIDL template to disable warnings.
316 config("midl_warnings") { 359 config("midl_warnings") {
317 if (is_clang) { 360 if (is_clang) {
318 # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_". 361 # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_".
319 cflags = [ "-Wno-extra-tokens" ] 362 cflags = [ "-Wno-extra-tokens" ]
320 } 363 }
321 } 364 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698