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

Issue 674643002: Add __analysis_assume support to CHECK macros to reduce warnings with /analyze. (Closed)

Created:
6 years, 2 months ago by brucedawson
Modified:
6 years, 2 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Add __analysis_assume support to CHECK macros to reduce warnings with /analyze. Due to bugs and quirks in the analysis engine this is a very delicate dance. The __analysis_assume invocation has to evaluate !!(condition) instead of just condition because otherwise it fails on overloaded operators such as with smart pointers. See this post for details: http://randomascii.wordpress.com/2011/09/13/analyze-for-visual-studio-the-ugly-part-5/ The evaluation of condition in the 'regular' part of the macro has to be removed during the /analyze phase in order to avoid confusing the analysis engine which thinks that branching on the condition implies uncertainty about the condition. None of this is documented -- thinking like a compiler is required. Wrapping this with #ifdef _PREFAST_ makes it easy to guarantee that this will not affect regular builds. To build add win_debug_extra_cflags="/analyze" to GYP_DEFINES, rebuild the project files and then build. Committed: https://crrev.com/9d1602515adc3e797d71c3a0e29cc175432eb8fe Cr-Commit-Position: refs/heads/master@{#300937}

Patch Set 1 #

Total comments: 3

Patch Set 2 : Fixed spacing of #else/#endif comments per style-guide/thestig@ #

Patch Set 3 : Change to #if defined and other small tweaks from code-review. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -1 line) Patch
M base/logging.h View 1 2 3 chunks +40 lines, -1 line 0 comments Download

Messages

Total messages: 15 (3 generated)
brucedawson
6 years, 2 months ago (2014-10-22 21:17:40 UTC) #1
brucedawson
Please take a look -- part one of making /analyze work better with Chrome.
6 years, 2 months ago (2014-10-22 23:42:19 UTC) #3
brucedawson
Adding thestig as reviewer since he is an owner in base. Review away.
6 years, 2 months ago (2014-10-22 23:55:27 UTC) #5
Lei Zhang
Looks ok to me, but I defer to cpu for the review. https://codereview.chromium.org/674643002/diff/1/base/logging.h File base/logging.h ...
6 years, 2 months ago (2014-10-23 00:03:17 UTC) #6
brucedawson
On 2014/10/23 00:03:17, Lei Zhang wrote: > Looks ok to me, but I defer to ...
6 years, 2 months ago (2014-10-23 00:20:07 UTC) #7
cpu_(ooo_6.6-7.5)
https://codereview.chromium.org/674643002/diff/1/base/logging.h File base/logging.h (right): https://codereview.chromium.org/674643002/diff/1/base/logging.h#newcode453 base/logging.h:453: #ifdef _PREFAST_ use #if defined(_PREFAST_) In case of doubt ...
6 years, 2 months ago (2014-10-23 00:20:53 UTC) #8
brucedawson
All comments addressed.
6 years, 2 months ago (2014-10-23 00:33:06 UTC) #9
cpu_(ooo_6.6-7.5)
lgtm
6 years, 2 months ago (2014-10-23 18:18:10 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/674643002/40001
6 years, 2 months ago (2014-10-23 18:19:46 UTC) #12
Lei Zhang
lgtm++
6 years, 2 months ago (2014-10-23 18:51:47 UTC) #13
commit-bot: I haz the power
Committed patchset #3 (id:40001)
6 years, 2 months ago (2014-10-23 20:14:23 UTC) #14
commit-bot: I haz the power
6 years, 2 months ago (2014-10-23 20:15:04 UTC) #15
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/9d1602515adc3e797d71c3a0e29cc175432eb8fe
Cr-Commit-Position: refs/heads/master@{#300937}

Powered by Google App Engine
This is Rietveld 408576698