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

Issue 1193873004: Make CHECK_EQ and friends work properly in an if/else structure without braces. (Closed)

Created:
5 years, 6 months ago by erikwright (departed)
Modified:
5 years, 5 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org, Sigurður Ásgeirsson, robertshield
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Make CHECK_EQ and friends work properly in an if/else structure without braces. BUG= Committed: https://crrev.com/6ad937bc698ce8958d6578609919fe9fd05429f6 Cr-Commit-Position: refs/heads/master@{#339943}

Patch Set 1 #

Patch Set 2 : Compile fix. #

Patch Set 3 : Ambiguous else handling. #

Patch Set 4 : Tidy/extend tests. #

Patch Set 5 : Add commentary. #

Total comments: 10

Patch Set 6 : Correct a comment and add some test coverage regarding ambiguous 'if'. #

Patch Set 7 : Proposed re-working of unit-tests. #

Total comments: 3

Patch Set 8 : Review feedback, test enhancements. #

Patch Set 9 : More WIP. #

Patch Set 10 : More WIP. #

Patch Set 11 : More WIP. #

Total comments: 1

Patch Set 12 : Deduplicate test cases. #

Patch Set 13 : Minimum complete coverage. #

Patch Set 14 : Cut back test coverage. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+65 lines, -14 lines) Patch
M base/logging.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +41 lines, -14 lines 0 comments Download
M base/logging_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +24 lines, -0 lines 0 comments Download

Messages

Total messages: 50 (11 generated)
erikwright (departed)
danakj: PTAL. This fixes the CHECK_EQ family of checks so that they can be used ...
5 years, 6 months ago (2015-06-24 15:35:54 UTC) #2
Sigurður Ásgeirsson
nice! These can do with some moar explanation on what's being tested, though. https://codereview.chromium.org/1193873004/diff/80001/base/logging_unittest.cc File ...
5 years, 6 months ago (2015-06-25 12:25:09 UTC) #4
danakj
https://codereview.chromium.org/1193873004/diff/80001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/1193873004/diff/80001/base/logging.h#newcode505 base/logging.h:505: // DCHECK_EQ(2, a); But else if works fine, what ...
5 years, 5 months ago (2015-07-06 22:38:27 UTC) #5
Nico
https://codereview.chromium.org/1193873004/diff/80001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/1193873004/diff/80001/base/logging.h#newcode496 base/logging.h:496: }; why is this needed? https://codereview.chromium.org/1193873004/diff/80001/base/logging.h#newcode506 base/logging.h:506: #define CHECK_OP(name, ...
5 years, 5 months ago (2015-07-06 22:41:52 UTC) #7
danakj
https://codereview.chromium.org/1193873004/diff/80001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/1193873004/diff/80001/base/logging.h#newcode506 base/logging.h:506: #define CHECK_OP(name, op, val1, val2) \ On 2015/07/06 22:41:52, ...
5 years, 5 months ago (2015-07-06 22:43:27 UTC) #8
erikwright (departed)
On 2015/07/06 22:43:27, danakj wrote: > https://codereview.chromium.org/1193873004/diff/80001/base/logging.h > File base/logging.h (right): > > https://codereview.chromium.org/1193873004/diff/80001/base/logging.h#newcode506 > ...
5 years, 5 months ago (2015-07-07 15:25:28 UTC) #9
Nico
I see. Personally, I'd prefer not supporting CHECK in an if without braces over making ...
5 years, 5 months ago (2015-07-07 16:59:44 UTC) #10
erikwright (departed)
https://codereview.chromium.org/1193873004/diff/80001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/1193873004/diff/80001/base/logging.h#newcode496 base/logging.h:496: }; On 2015/07/06 22:41:52, Nico wrote: > why is ...
5 years, 5 months ago (2015-07-07 17:25:09 UTC) #11
erikwright (departed)
https://codereview.chromium.org/1193873004/diff/80001/base/logging_unittest.cc File base/logging_unittest.cc (right): https://codereview.chromium.org/1193873004/diff/80001/base/logging_unittest.cc#newcode242 base/logging_unittest.cc:242: bool reached = false; On 2015/06/25 12:25:09, Sigurður Ásgeirsson ...
5 years, 5 months ago (2015-07-07 18:30:56 UTC) #12
danakj
FWIW if someone wrote if (a) CHECK(b); I'd ask them to rewrite it as CHECK_IMPLIES(a, ...
5 years, 5 months ago (2015-07-07 18:39:44 UTC) #13
erikwright (departed)
On 2015/07/07 18:39:44, danakj wrote: > FWIW if someone wrote > > if (a) > ...
5 years, 5 months ago (2015-07-08 19:22:57 UTC) #14
danakj
On 2015/07/08 19:22:57, erikwright wrote: > On 2015/07/07 18:39:44, danakj wrote: > > FWIW if ...
5 years, 5 months ago (2015-07-08 20:01:22 UTC) #15
erikwright (departed)
On 2015/07/08 20:01:22, danakj wrote: > On 2015/07/08 19:22:57, erikwright wrote: > > On 2015/07/07 ...
5 years, 5 months ago (2015-07-09 12:41:55 UTC) #16
erikwright (departed)
Here, incidentally, is the code snippet that caused me trouble. It occurs in a multiprocess ...
5 years, 5 months ago (2015-07-09 12:45:14 UTC) #17
erikwright (departed)
On 2015/07/09 12:45:14, erikwright wrote: > Here, incidentally, is the code snippet that caused me ...
5 years, 5 months ago (2015-07-13 13:16:09 UTC) #18
Sigurður Ásgeirsson
IMHO it's a gross violation of the principle of least surprise to have the macros ...
5 years, 5 months ago (2015-07-13 13:52:05 UTC) #19
Nico
On 2015/07/09 12:45:14, erikwright wrote: > Here, incidentally, is the code snippet that caused me ...
5 years, 5 months ago (2015-07-13 21:21:16 UTC) #20
Sigurður Ásgeirsson
The underlying macro is if (DCHECK_IS_ON()) \ if (std::string* _result = logging::Check##name##Impl( \ (val1), (val2), ...
5 years, 5 months ago (2015-07-14 09:57:07 UTC) #21
erikwright (departed)
On 2015/07/14 09:57:07, Sigurður Ásgeirsson wrote: > The underlying macro is > > if (DCHECK_IS_ON()) ...
5 years, 5 months ago (2015-07-14 19:42:43 UTC) #22
Nico
On 2015/07/14 09:57:07, Sigurður Ásgeirsson wrote: > The underlying macro is > > if (DCHECK_IS_ON()) ...
5 years, 5 months ago (2015-07-14 19:48:44 UTC) #23
erikwright (departed)
On 2015/07/14 19:48:44, Nico wrote: > On 2015/07/14 09:57:07, Sigurður Ásgeirsson wrote: > > The ...
5 years, 5 months ago (2015-07-14 20:08:14 UTC) #24
Nico
On 2015/07/14 20:08:14, erikwright wrote: > On 2015/07/14 19:48:44, Nico wrote: > > On 2015/07/14 ...
5 years, 5 months ago (2015-07-14 20:22:42 UTC) #25
erikwright (departed)
On 2015/07/14 20:22:42, Nico wrote: > On 2015/07/14 20:08:14, erikwright wrote: > > On 2015/07/14 ...
5 years, 5 months ago (2015-07-14 20:33:00 UTC) #26
erikwright (departed)
https://codereview.chromium.org/1193873004/diff/120001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/1193873004/diff/120001/base/logging.h#newcode511 base/logging.h:511: logging::LogMessage(__FILE__, __LINE__, _result.message()).stream() On 2015/07/14 20:22:41, Nico wrote: > ...
5 years, 5 months ago (2015-07-14 20:33:08 UTC) #27
Nico
> It is entirely possible that someone else spent hours debugging this, realized > it ...
5 years, 5 months ago (2015-07-14 20:38:57 UTC) #28
Nico
https://codereview.chromium.org/1193873004/diff/120001/base/logging.h File base/logging.h (right): https://codereview.chromium.org/1193873004/diff/120001/base/logging.h#newcode511 base/logging.h:511: logging::LogMessage(__FILE__, __LINE__, _result.message()).stream() On 2015/07/14 20:33:08, erikwright wrote: > ...
5 years, 5 months ago (2015-07-14 20:47:10 UTC) #29
erikwright (departed)
siggi: PTAL at the updated tests.
5 years, 5 months ago (2015-07-15 18:32:27 UTC) #30
Sigurður Ásgeirsson
lgtm - the repetition is a PITA, but I don't think there's any reasonable way ...
5 years, 5 months ago (2015-07-16 10:51:28 UTC) #31
erikwright (departed)
On 2015/07/16 10:51:28, Sigurður Ásgeirsson wrote: > lgtm - the repetition is a PITA, but ...
5 years, 5 months ago (2015-07-16 14:39:56 UTC) #32
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1193873004/220001
5 years, 5 months ago (2015-07-16 20:15:42 UTC) #34
Nico
I don't think this needs exhaustive testing. Add a test for one or two cases ...
5 years, 5 months ago (2015-07-16 20:25:22 UTC) #35
erikwright (departed)
On 2015/07/16 20:25:22, Nico wrote: > I don't think this needs exhaustive testing. Add a ...
5 years, 5 months ago (2015-07-16 20:41:18 UTC) #36
Nico
I don't care too much, but it shouldn't be more than around 25 lines. The ...
5 years, 5 months ago (2015-07-16 21:02:03 UTC) #37
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/79440) linux_chromium_rel_ng on ...
5 years, 5 months ago (2015-07-16 21:39:00 UTC) #39
erikwright (departed)
The test suite was originally 258 lines. In my personal opinion it is incomplete. Patchset ...
5 years, 5 months ago (2015-07-17 17:25:20 UTC) #44
Nico
lgtm
5 years, 5 months ago (2015-07-17 20:29:35 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1193873004/340001
5 years, 5 months ago (2015-07-22 18:25:03 UTC) #48
commit-bot: I haz the power
Committed patchset #14 (id:340001)
5 years, 5 months ago (2015-07-22 20:06:00 UTC) #49
commit-bot: I haz the power
5 years, 5 months ago (2015-07-22 20:07:37 UTC) #50
Message was sent while issue was closed.
Patchset 14 (id:??) landed as
https://crrev.com/6ad937bc698ce8958d6578609919fe9fd05429f6
Cr-Commit-Position: refs/heads/master@{#339943}

Powered by Google App Engine
This is Rietveld 408576698