Disable the noisiest /analyze warning in Chrome. ~3,700/12,000

Decades ago Intel decided that the bsr (Bit Scan Reverse) instruction
should have undefined results if its argument is zero. This probably
makes the instruction harder to implement and it definitely makes it
more difficult to use.

In SkCLZ_portable it requires a check for a zero argument, but despite
that check /analyze still warns that _BitScanReverse might fail
(because it doesn't know what can cause failures). Because this warning
occurs in a frequently included header file it ends up being very noisy,
accounting for ~30% of all warnings (before deduplication).

Suppressing this useless warning will make the raw results easier to
look through.

Review URL: https://codereview.chromium.org/872673007
This commit is contained in:
brucedawson 2015-01-30 12:57:50 -08:00 committed by Commit bot
parent 8a81003491
commit aea85dc3d3

View File

@ -79,6 +79,9 @@ int SkCLZ_portable(uint32_t);
if (mask) {
DWORD index;
_BitScanReverse(&index, mask);
// Suppress this bogus /analyze warning. The check for non-zero
// guarantees that _BitScanReverse will succeed.
#pragma warning(suppress : 6102) // Using 'index' from failed function call
return index ^ 0x1F;
} else {
return 32;