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

Issue 2515283002: logging: Provide a specific MakeCheckOpValueString overload for functions (Closed)

Created:
4 years, 1 month ago by Raphael Kubo da Costa (rakuco)
Modified:
4 years ago
Reviewers:
danakj, Nico, jbroman
CC:
chromium-reviews, vmpstr+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

logging: Provide a specific MakeCheckOpValueString overload for functions So far, passing a function or function pointer to a check such as DCHECK_EQ would cause the values to be implicitly converted to bool, resulting in a confusing message like this Check failed: x == y (1 vs. 1) instead of Check failed: x == y (0x779410 vs. 0x778fe0) Add a specific overload for functions and function pointers that explicitly cast them to const void* to have them call the right operator<< overload. This fixes warnings on both new GCC versions (-Waddress complains that passing a function or function pointer to operator<< would always become '1') and clang on Windows (see https://bugs.chromium.org/p/chromium/issues/detail?id=550065#c12). BUG=550065 R=danakj@chromium.org,thakis@chromium.org,jbroman@chromium.org Committed: https://crrev.com/81f2120f583ad96cf496cc258f51a9c177437485 Cr-Commit-Position: refs/heads/master@{#434702}

Patch Set 1 #

Patch Set 2 : Overload MakeCheckOpValueString #

Patch Set 3 : Prevent the empty functions from being optimized #

Total comments: 3

Patch Set 4 : Update comment and reset log_sink_call_count #

Total comments: 4

Patch Set 5 : Use actual member functions #

Unified diffs Side-by-side diffs Delta from patch set Stats (+48 lines, -1 line) Patch
M base/logging.h View 1 2 3 1 chunk +15 lines, -1 line 0 comments Download
M base/logging_unittest.cc View 1 2 3 4 2 chunks +33 lines, -0 lines 0 comments Download

Messages

Total messages: 25 (7 generated)
Raphael Kubo da Costa (rakuco)
4 years, 1 month ago (2016-11-21 15:45:04 UTC) #1
jbroman
It seems odd to add an operator<< overload in base/logging.h, since that has other implications. ...
4 years, 1 month ago (2016-11-21 15:48:56 UTC) #2
Nico
lgtm Add https://bugs.chromium.org/p/chromium/issues/detail?id=550065#c12 to BUG line; I think that fixes a bunch of the warnings ...
4 years, 1 month ago (2016-11-21 15:51:10 UTC) #3
Raphael Kubo da Costa (rakuco)
On 2016/11/21 15:48:56, jbroman wrote: > It seems odd to add an operator<< overload in ...
4 years, 1 month ago (2016-11-21 16:10:35 UTC) #4
Raphael Kubo da Costa (rakuco)
Hmm, win_chromium_rel_ng's output isn't very helpful, but it does look like I'll have to check ...
4 years, 1 month ago (2016-11-21 16:11:55 UTC) #5
jbroman
On 2016/11/21 at 16:10:35, raphael.kubo.da.costa wrote: > That was my first idea, but I was ...
4 years, 1 month ago (2016-11-21 16:37:33 UTC) #6
Raphael Kubo da Costa (rakuco)
I've uploaded a new version of the patch overloading MakeCheckOpValueString as discussed. I've also triggered ...
4 years, 1 month ago (2016-11-21 17:31:28 UTC) #7
Raphael Kubo da Costa (rakuco)
Patch v3 passes on release and debug configurations; I've also checked GCC 6.2.1 on Linux ...
4 years, 1 month ago (2016-11-22 12:36:38 UTC) #10
jbroman
non-owner lgtm, but you should probably have a base/ owner (danakj or thakis would do) ...
4 years, 1 month ago (2016-11-22 14:40:52 UTC) #11
Nico
code looks still fine to me, but test needs minor tweaking: https://codereview.chromium.org/2515283002/diff/40001/base/logging.h File base/logging.h (right): ...
4 years ago (2016-11-23 18:09:26 UTC) #12
Raphael Kubo da Costa (rakuco)
Done!
4 years ago (2016-11-23 18:14:53 UTC) #13
Nico
https://codereview.chromium.org/2515283002/diff/60001/base/logging_unittest.cc File base/logging_unittest.cc (right): https://codereview.chromium.org/2515283002/diff/60001/base/logging_unittest.cc#newcode276 base/logging_unittest.cc:276: EXPECT_EQ(DCHECK_IS_ON() ? 0 : 0, log_sink_call_count); Err, replace `DCHECK_IS_ON() ...
4 years ago (2016-11-23 18:21:10 UTC) #14
Raphael Kubo da Costa (rakuco)
https://codereview.chromium.org/2515283002/diff/60001/base/logging_unittest.cc File base/logging_unittest.cc (right): https://codereview.chromium.org/2515283002/diff/60001/base/logging_unittest.cc#newcode276 base/logging_unittest.cc:276: EXPECT_EQ(DCHECK_IS_ON() ? 0 : 0, log_sink_call_count); On 2016/11/23 18:21:10, ...
4 years ago (2016-11-23 18:58:09 UTC) #15
Raphael Kubo da Costa (rakuco)
Patch updated again, please take another look.
4 years ago (2016-11-23 19:04:38 UTC) #16
Nico
lgtm
4 years ago (2016-11-28 15:08:32 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2515283002/80001
4 years ago (2016-11-28 15:11:29 UTC) #20
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years ago (2016-11-28 18:37:11 UTC) #23
commit-bot: I haz the power
4 years ago (2016-11-28 18:43:43 UTC) #25
Message was sent while issue was closed.
Patchset 5 (id:??) landed as
https://crrev.com/81f2120f583ad96cf496cc258f51a9c177437485
Cr-Commit-Position: refs/heads/master@{#434702}

Powered by Google App Engine
This is Rietveld 408576698