DescriptionFix C4334 (32-bit shift converted to 64-bit) warnings
VS 2015's warning about 32-bit shifts that are then assigned to a
64-bit target fires more frequently than in VS 2013. This type of
code triggers it:
int64_t size = 1 << shift_amount;
Because the '1' being shifted is a 32-bit int the result of the shift
will be a 32-bit result, so assigning it to a 64-bit variable is just
misleading and can lead to undefined behavior and lost bits.
During the port to VS 2015 this warning was globally suppressed. This
removes that global suppression.
There were ~nine C4334 warnings in Chromium with most of them being in
external repos such as pdfium, skia, webrtc, and angle. The external
repos have all been fixed. This fixes the Chromium repo warnings and
enables C4334 in gn builds.
In these cases the code that triggers it was assigning to a size_t
so it only showed up on 64-bit builds. In some cases there was already a
cast but it was after the shift, which is not as good as before the
shift. In one case the 32-bit constant was completely superfluous.
The Chromium specific warnings were:
net\base\mime_sniffer_perftest.cc(93)
third_party\webkit\source\platform\heap\heappage.cpp(738)
net\spdy\hpack\hpack_huffman_table.cc(172)
media\filters\vp8_parser.cc(157)
warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits
BUG=593448
Committed: https://crrev.com/c8615da7ebb48668de21b3e23edec64c1685ffbb
Cr-Commit-Position: refs/heads/master@{#386480}
Patch Set 1 #Patch Set 2 : Fixed comments #Patch Set 3 : Tweak comment, enable for gyp also #
Total comments: 4
Patch Set 4 : Removing obsolete comment and pointless '1' #
Messages
Total messages: 22 (13 generated)
|