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

Issue 1858423002: Fix C4334 (32-bit shift converted to 64-bit) warnings (Closed)

Created:
4 years, 8 months ago by brucedawson
Modified:
4 years, 8 months ago
Reviewers:
asanka, haraken, DaleCurtis
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.

Description

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}

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' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -18 lines) Patch
M build/common.gypi View 1 2 1 chunk +5 lines, -4 lines 0 comments Download
M build/config/compiler/BUILD.gn View 1 2 1 chunk +4 lines, -4 lines 0 comments Download
M media/filters/vp8_parser.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M net/base/mime_sniffer_perftest.cc View 1 2 3 1 chunk +2 lines, -6 lines 0 comments Download
M net/spdy/hpack/hpack_huffman_table.cc View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/heap/HeapPage.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 22 (13 generated)
brucedawson
Simple change to let us enable a potentially useful warning and make the behavior of ...
4 years, 8 months ago (2016-04-06 00:28:14 UTC) #6
haraken
WebKit LGTM
4 years, 8 months ago (2016-04-06 00:36:26 UTC) #7
asanka
lgtm % nits https://codereview.chromium.org/1858423002/diff/40001/net/base/mime_sniffer_perftest.cc File net/base/mime_sniffer_perftest.cc (right): https://codereview.chromium.org/1858423002/diff/40001/net/base/mime_sniffer_perftest.cc#newcode89 net/base/mime_sniffer_perftest.cc:89: // complaining about an implicit promotion ...
4 years, 8 months ago (2016-04-06 02:05:57 UTC) #9
jam
On 2016/04/06 00:28:14, brucedawson wrote: > Simple change to let us enable a potentially useful ...
4 years, 8 months ago (2016-04-06 16:23:52 UTC) #10
brucedawson
asanka@ - thanks for the nits. Good catches. Dale, can you review media\filters\vp8_parser.cc? Just a ...
4 years, 8 months ago (2016-04-06 17:53:42 UTC) #14
DaleCurtis
media/ lgtm
4 years, 8 months ago (2016-04-06 20:28:53 UTC) #15
commit-bot: I haz the power
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
4 years, 8 months ago (2016-04-11 18:53:07 UTC) #18
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years, 8 months ago (2016-04-11 21:37:56 UTC) #20
commit-bot: I haz the power
4 years, 8 months ago (2016-04-11 21:39:43 UTC) #22
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/c8615da7ebb48668de21b3e23edec64c1685ffbb
Cr-Commit-Position: refs/heads/master@{#386480}

Powered by Google App Engine
This is Rietveld 408576698