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

Issue 2001783002: base: Support using (D)CHECK on scoped enums. (Closed)

Created:
4 years, 7 months ago by jbroman
Modified:
4 years, 7 months ago
Reviewers:
danakj, Nico, dcheng
CC:
chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

base: Support using (D)CHECK on scoped enums. BUG=555314 Committed: https://crrev.com/6bcfec42d8e7ce09ab8c20a487ce285d2a680b00 Cr-Commit-Position: refs/heads/master@{#396052}

Patch Set 1 #

Total comments: 10

Patch Set 2 : review comments (mostly moving/adding stuff to template_util) #

Patch Set 3 : ALLOW_UNUSED_TYPE to avoid compiler warnigs #

Patch Set 4 : define operator<< to make gcc happy #

Patch Set 5 : two typos (whoops) #

Patch Set 6 : #

Patch Set 7 : use CR_GLIBCXX_4_7_0 macro, since I bothered to define it #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+121 lines, -7 lines) Patch
M base/logging.h View 1 2 chunks +20 lines, -5 lines 1 comment Download
M base/logging.cc View 1 chunk +1 line, -2 lines 0 comments Download
M base/logging_unittest.cc View 1 chunk +7 lines, -0 lines 0 comments Download
M base/template_util.h View 1 2 3 4 5 6 3 chunks +30 lines, -0 lines 0 comments Download
M base/template_util_unittest.cc View 1 2 3 2 chunks +63 lines, -0 lines 0 comments Download

Messages

Total messages: 23 (10 generated)
jbroman
WDYT? Pending MSVC accepting it, of course. (/me crosses fingers) https://codereview.chromium.org/2001783002/diff/1/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2001783002/diff/1/base/logging.h#newcode529 ...
4 years, 7 months ago (2016-05-20 19:56:36 UTC) #3
dcheng
Of course, this would be a lot easier with std::underlying_type. Also, https://codereview.chromium.org/1436403003/ =P https://codereview.chromium.org/2001783002/diff/1/base/logging.h File ...
4 years, 7 months ago (2016-05-20 19:59:30 UTC) #4
jbroman
https://codereview.chromium.org/2001783002/diff/1/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2001783002/diff/1/base/logging.h#newcode554 base/logging.h:554: (*os) << static_cast<int64_t>(v); On 2016/05/20 at 19:59:30, dcheng wrote: ...
4 years, 7 months ago (2016-05-20 20:05:38 UTC) #5
danakj
https://codereview.chromium.org/2001783002/diff/1/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2001783002/diff/1/base/logging.h#newcode554 base/logging.h:554: (*os) << static_cast<int64_t>(v); On 2016/05/20 20:05:38, jbroman wrote: > ...
4 years, 7 months ago (2016-05-20 21:08:23 UTC) #7
danakj
https://codereview.chromium.org/2001783002/diff/1/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2001783002/diff/1/base/logging.h#newcode526 base/logging.h:526: struct SupportsOstreamOperator : std::false_type {}; Can you move this ...
4 years, 7 months ago (2016-05-20 21:54:16 UTC) #8
jbroman
https://codereview.chromium.org/2001783002/diff/1/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2001783002/diff/1/base/logging.h#newcode526 base/logging.h:526: struct SupportsOstreamOperator : std::false_type {}; On 2016/05/20 at 21:54:16, ...
4 years, 7 months ago (2016-05-25 19:08:04 UTC) #10
danakj
LGTM
4 years, 7 months ago (2016-05-25 19:53:00 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2001783002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2001783002/100001
4 years, 7 months ago (2016-05-25 19:57:44 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/2001783002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/2001783002/120001
4 years, 7 months ago (2016-05-25 20:12:18 UTC) #17
commit-bot: I haz the power
Committed patchset #7 (id:120001)
4 years, 7 months ago (2016-05-26 00:28:58 UTC) #18
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/6bcfec42d8e7ce09ab8c20a487ce285d2a680b00 Cr-Commit-Position: refs/heads/master@{#396052}
4 years, 7 months ago (2016-05-26 00:30:40 UTC) #20
Nico
https://codereview.chromium.org/2001783002/diff/120001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/2001783002/diff/120001/base/logging.h#newcode566 base/logging.h:566: // in logging.cc. Hm, this will never fire for ...
4 years, 7 months ago (2016-05-26 00:44:55 UTC) #22
jbroman
4 years, 7 months ago (2016-05-26 15:30:43 UTC) #23
Message was sent while issue was closed.
On 2016/05/26 at 00:44:55, thakis wrote:
> https://codereview.chromium.org/2001783002/diff/120001/base/logging.h
> File base/logging.h (right):
> 
>
https://codereview.chromium.org/2001783002/diff/120001/base/logging.h#newcode566
> base/logging.h:566: // in logging.cc.
> Hm, this will never fire for enum classes since they're distinct types. (I
guess for enums it didn't fire either since we don't have a bare int
specialization).

This CL shouldn't change anything about how those are instantiated, since it
only affects the functions that are called for cases where operator<< would
previously have failed to compile.

Besides, I believe even ordinary enums don't select the int specialization here,
because the conversion is only needed to invoke
std::basic_ostream::operator<<(int), later on.

> Still, this adds a bunch of includes and a bunch of code to a very heavily
included header. Have you checked if this impacts compile time?

I suspect nearly all files already include these headers (<iosfwd>,
<type_traits> and <utility>), because if you have base/logging.h and
base/memory/ref_counted.h (for instance), you get them already. An quick
(unscientific) test locally doesn't show any impact (clean but warm debug build
of base_unittests and its dependencies without goma on a Z620):

with this patch:
ninja -C out/A base_unittests  1207.64s user 70.56s system 2729% cpu 46.828
total

with this patch reverted:
ninja -C out/A base_unittests  1205.01s user 71.42s system 2713% cpu 47.044
total

Powered by Google App Engine
This is Rietveld 408576698