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

Issue 1428003002: More const int definitions for VC++ (Closed)

Created:
5 years, 1 month ago by brucedawson
Modified:
5 years, 1 month ago
CC:
chromium-reviews, piman+watch_chromium.org, vmpstr+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Avoid const int definition problems VC++ up to VS 2015 RTM does not require explicit storage allocation for static const integers declared in classes. VS 2015 Update 1 requires these storage definitions in some cases. In order to avoid #ifs around the storage definitions this change switches the problematic consts to enums, for maximum portability. Where needed the enums have types specified. Many previous versions of VC++ have theoretically *allowed* a definition to supply storage, but tests on VC++ 2013 show that this doesn't actually work correctly - it leads to duplicate definition errors. So, enums are the only #if option. With this change all targets build with the latest VS 2015. See also 1422453005. R=danakj@chromium.org,zmo@chromium.org BUG=440500 Committed: https://crrev.com/599857c9a6a07024a6047080f91f71f801deb4f8 Cr-Commit-Position: refs/heads/master@{#357688}

Patch Set 1 #

Patch Set 2 : Adding required #ifdef #

Patch Set 3 : Comment update #

Total comments: 3

Patch Set 4 : Add periods. #

Total comments: 2

Patch Set 5 : Use enums for the constants and avoid #if #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5 lines, -10 lines) Patch
M base/time/time.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M gpu/command_buffer/client/fenced_allocator.h View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M gpu/command_buffer/client/fenced_allocator.cc View 1 2 3 4 1 chunk +0 lines, -5 lines 0 comments Download
M ui/gfx/icon_util.h View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 27 (6 generated)
brucedawson
danakj@ - can you review time_win.cc and icon_util.cc? zmo@ - can you review fenced_allocator.cc?
5 years, 1 month ago (2015-10-30 20:19:20 UTC) #3
danakj
Same comment applies to all cases https://codereview.chromium.org/1428003002/diff/40001/base/time/time_win.cc File base/time/time_win.cc (right): https://codereview.chromium.org/1428003002/diff/40001/base/time/time_win.cc#newcode134 base/time/time_win.cc:134: // VS 2015 ...
5 years, 1 month ago (2015-10-30 20:23:30 UTC) #4
brucedawson
Thanks for the pointer to that discussion. I would *love* to unconditionally declare storage, but ...
5 years, 1 month ago (2015-10-30 20:34:09 UTC) #5
brucedawson
https://codereview.chromium.org/1428003002/diff/40001/base/time/time_win.cc File base/time/time_win.cc (right): https://codereview.chromium.org/1428003002/diff/40001/base/time/time_win.cc#newcode134 base/time/time_win.cc:134: // VS 2015 and above allow these definitions and ...
5 years, 1 month ago (2015-10-30 20:36:59 UTC) #6
danakj
Hm, I see what you mean about the protobuf code. Though in my POV we ...
5 years, 1 month ago (2015-10-30 20:40:37 UTC) #7
brucedawson
I can try the enum fix. I wasn't sure if that was preferred or not. ...
5 years, 1 month ago (2015-10-30 20:51:37 UTC) #8
Peter Kasting
On 2015/10/30 20:51:37, brucedawson wrote: > I can try the enum fix. I wasn't sure ...
5 years, 1 month ago (2015-10-30 20:55:41 UTC) #9
brucedawson
I've got the enum version working (it required typed enums in some places but was ...
5 years, 1 month ago (2015-10-30 22:50:07 UTC) #10
danakj
On Fri, Oct 30, 2015 at 3:50 PM, <brucedawson@chromium.org> wrote: > I've got the enum ...
5 years, 1 month ago (2015-10-30 22:54:04 UTC) #11
brucedawson
> From that thread, enums that are a single member that is a constant can ...
5 years, 1 month ago (2015-10-30 23:33:36 UTC) #13
danakj
LGTM
5 years, 1 month ago (2015-10-31 00:01:52 UTC) #15
Peter Kasting
On 2015/10/30 22:54:04, danakj wrote: > On Fri, Oct 30, 2015 at 3:50 PM, <mailto:brucedawson@chromium.org> ...
5 years, 1 month ago (2015-10-31 00:04:37 UTC) #16
danakj
On Fri, Oct 30, 2015 at 5:04 PM, <pkasting@chromium.org> wrote: > On 2015/10/30 22:54:04, danakj ...
5 years, 1 month ago (2015-10-31 00:16:00 UTC) #17
Peter Kasting
On Fri, Oct 30, 2015 at 5:15 PM, Dana Jansens <danakj@chromium.org> wrote: > It's a ...
5 years, 1 month ago (2015-10-31 00:18:52 UTC) #18
danakj
On Fri, Oct 30, 2015 at 5:18 PM, Peter Kasting <pkasting@chromium.org> wrote: > On Fri, ...
5 years, 1 month ago (2015-10-31 00:24:23 UTC) #19
brucedawson
> >> It's a common practice already in chromium: > >> > https://code.google.com/p/chromium/codesearch#search/&q=enum.*?%7B%5C%20k%5BA-Z%5D%5Ba-zA-Z%5D%2B(%5C%20=%5C%20%5B%5E,%20%5D%2B) > >> ...
5 years, 1 month ago (2015-11-02 18:47:28 UTC) #20
danakj
On Mon, Nov 2, 2015 at 10:47 AM, <brucedawson@chromium.org> wrote: > >> It's a common ...
5 years, 1 month ago (2015-11-02 18:50:03 UTC) #21
jbauman
lgtm
5 years, 1 month ago (2015-11-03 22:29:11 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1428003002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1428003002/80001
5 years, 1 month ago (2015-11-03 22:46:14 UTC) #25
commit-bot: I haz the power
Committed patchset #5 (id:80001)
5 years, 1 month ago (2015-11-04 00:49:07 UTC) #26
commit-bot: I haz the power
5 years, 1 month ago (2015-11-04 00:49:48 UTC) #27
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/599857c9a6a07024a6047080f91f71f801deb4f8
Cr-Commit-Position: refs/heads/master@{#357688}

Powered by Google App Engine
This is Rietveld 408576698