|
|
Chromium Code Reviews|
Created:
4 years, 8 months ago by brucedawson Modified:
4 years, 8 months ago CC:
Mads Ager (chromium), blink-reviews, cbentzel+watch_chromium.org, chromium-reviews, feature-media-reviews_chromium.org, kinuko+watch, kouhei+heap_chromium.org, oilpan-reviews Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
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)
Description was changed from ========== Fix C4334 (32-bit shift converted to 64-bit) warnings VS 2015 has a new or louder warning about 32-bit shifts that are then assigned to a 64-bit target. 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. There were seven 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. The 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 ========== to ========== Fix C4334 (32-bit shift converted to 64-bit) warnings VS 2015 has a new or louder warning about 32-bit shifts that are then assigned to a 64-bit target. 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. 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. The Chromium 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 ==========
Description was changed from ========== Fix C4334 (32-bit shift converted to 64-bit) warnings VS 2015 has a new or louder warning about 32-bit shifts that are then assigned to a 64-bit target. 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. 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. The Chromium 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 ========== to ========== Fix C4334 (32-bit shift converted to 64-bit) warnings VS 2015 has a new or louder warning about 32-bit shifts that are then assigned to a 64-bit target. 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. 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. 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 ==========
brucedawson@chromium.org changed reviewers: + asanka@chromium.org, jam@chromium.org
Description was changed from ========== Fix C4334 (32-bit shift converted to 64-bit) warnings VS 2015 has a new or louder warning about 32-bit shifts that are then assigned to a 64-bit target. 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. 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. 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 ========== to ========== Fix C4334 (32-bit shift converted to 64-bit) warnings VS 2015's 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. 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 ==========
Description was changed from ========== Fix C4334 (32-bit shift converted to 64-bit) warnings VS 2015's 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. 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 ========== to ========== Fix 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. 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 ==========
Simple change to let us enable a potentially useful warning and make the behavior of code more transparent: asanka - can you review: net\base\mime_sniffer_perftest.cc net\spdy\hpack\hpack_huffman_table.cc jam - can you review: media\filters\vp8_parser.cc third_party\WebKit\Source\platform\heap\HeapPage.cpp build\config\compiler\BUILD.gn This is part of the VS 2015 post-switch cleanup.
WebKit LGTM
asanka@chromium.org changed reviewers: + haraken@chromium.org
lgtm % nits https://codereview.chromium.org/1858423002/diff/40001/net/base/mime_sniffer_p... File net/base/mime_sniffer_perftest.cc (right): https://codereview.chromium.org/1858423002/diff/40001/net/base/mime_sniffer_p... net/base/mime_sniffer_perftest.cc:89: // complaining about an implicit promotion to 64 bits when compiling 64-bit. Nit: obsolete? https://codereview.chromium.org/1858423002/diff/40001/net/base/mime_sniffer_p... net/base/mime_sniffer_perftest.cc:91: plaintext.size() * static_cast<size_t>(1) Nit: Can we get rid of the "* static_cast<size_t>(1)" altogether?
On 2016/04/06 00:28:14, brucedawson wrote: > Simple change to let us enable a potentially useful warning and make the > behavior of code more transparent: > > asanka - can you review: > net\base\mime_sniffer_perftest.cc > net\spdy\hpack\hpack_huffman_table.cc > > jam - can you review: > media\filters\vp8_parser.cc > third_party\WebKit\Source\platform\heap\HeapPage.cpp > build\config\compiler\BUILD.gn these should be reviewed by owners close to these files (i.e. i'm not qualified). > > This is part of the VS 2015 post-switch cleanup.
Description was changed from ========== Fix 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. 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 ========== to ========== Fix 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 ==========
brucedawson@chromium.org changed reviewers: - jam@chromium.org
brucedawson@chromium.org changed reviewers: + dalecurtis@chromium.org
asanka@ - thanks for the nits. Good catches. Dale, can you review media\filters\vp8_parser.cc? Just a parentheses change to fix the scope of the cast. And maybe look at the build file changes also. https://codereview.chromium.org/1858423002/diff/40001/net/base/mime_sniffer_p... File net/base/mime_sniffer_perftest.cc (right): https://codereview.chromium.org/1858423002/diff/40001/net/base/mime_sniffer_p... net/base/mime_sniffer_perftest.cc:89: // complaining about an implicit promotion to 64 bits when compiling 64-bit. On 2016/04/06 02:05:56, asanka wrote: > Nit: obsolete? Good catch. Done. https://codereview.chromium.org/1858423002/diff/40001/net/base/mime_sniffer_p... net/base/mime_sniffer_perftest.cc:91: plaintext.size() * static_cast<size_t>(1) On 2016/04/06 02:05:57, asanka wrote: > Nit: Can we get rid of the "* static_cast<size_t>(1)" altogether? Hey, good point. That's quite weird, and unnecessary. Removed.
media/ lgtm
The CQ bit was checked by brucedawson@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from asanka@chromium.org, haraken@chromium.org Link to the patchset: https://codereview.chromium.org/1858423002/#ps60001 (title: "Removing obsolete comment and pointless '1'")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1858423002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1858423002/60001
Message was sent while issue was closed.
Description was changed from ========== Fix 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 ========== to ========== Fix 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 ==========
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== Fix 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 ========== to ========== Fix 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} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/c8615da7ebb48668de21b3e23edec64c1685ffbb Cr-Commit-Position: refs/heads/master@{#386480} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
