Chromium Code Reviews| Index: build/config/win/BUILD.gn |
| diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn |
| index bdbf7eabe809583af7fb0d7ef470bea2cadf1b2d..7284c92277aff41881c99fb059a49c70ca921828 100644 |
| --- a/build/config/win/BUILD.gn |
| +++ b/build/config/win/BUILD.gn |
| @@ -80,6 +80,46 @@ config("compiler") { |
| } |
| } |
| +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
|
| + if (is_win_analyze) { |
| + # When is_win_analyze 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 |
| @@ -105,10 +145,13 @@ config("runtime_library") { |
| "PSAPI_VERSION=1", |
| "WIN32", |
| "_SECURE_ATL", |
| + ] |
| + if (!is_win_analyze) { |
| # This is required for ATL to use XP-safe versions of its functions. |
| - "_USING_V110_SDK71_", |
| - ] |
| + # However it is prohibited when using /analyze |
| + defines += [ "_USING_V110_SDK71_" ] |
| + } |
| if (is_component_build) { |
| # Component mode: dynamic CRT. Since the library is shared, it requires |