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

Issue 3106032: base: Disallow mixing NDEBUG settings in logging.{h,cc}. (Closed)

Created:
10 years, 4 months ago by Daniel Erat
Modified:
9 years, 7 months ago
Reviewers:
brettw
CC:
chromium-reviews, Evan Martin, Mandeep Singh Baines, Chris Masone, brettw-cc_chromium.org
Base URL:
http://src.chromium.org/git/chromium.git
Visibility:
Public.

Description

base: Disallow mixing NDEBUG settings in logging.{h,cc}. I am concerned about the possibility that other users of the files in Chrome's base/ directory (e.g. Chrome OS) may build a library from these files with NDEBUG defined and then link it into a binary that includes the headers without defining NDEBUG, or vice versa. This change mangles InitLogging()'s name in logging.h based on whether NDEBUG is defined so that linking will fail if there's a mismatch (Evan provided useful advice here). BUG=chromium-os:1124 TEST=built Debug and Release Chrome, built all Chrome OS packages, and then changed a Chrome OS package that links against libbase.a to define NDEBUG and checked that it failed to link Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=57098

Patch Set 1 #

Patch Set 2 : make #defines more specific #

Patch Set 3 : ChromeInitLoggingImpl->BaseInitLoggingImpl and unify win/posix declarations #

Patch Set 4 : restore TODO #

Unified diffs Side-by-side diffs Delta from patch set Stats (+35 lines, -12 lines) Patch
M base/logging.h View 1 2 3 2 chunks +31 lines, -8 lines 0 comments Download
M base/logging.cc View 2 2 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
Daniel Erat
10 years, 4 months ago (2010-08-20 22:50:05 UTC) #1
brettw
I'm scared of this define. Is there a way we can do this for some ...
10 years, 4 months ago (2010-08-20 22:56:59 UTC) #2
Daniel Erat
Good point. I'll try to come up with something better. On Fri, Aug 20, 2010 ...
10 years, 4 months ago (2010-08-20 23:11:38 UTC) #3
Daniel Erat
I've added a more-specifically-named intermediate function and changed the #defines to rename it instead. I'm ...
10 years, 4 months ago (2010-08-21 00:39:04 UTC) #4
brettw
This should at least be "BaseInitLogging" since base doesn't necessarily mean Chrome. I can't think ...
10 years, 4 months ago (2010-08-21 02:05:44 UTC) #5
Daniel Erat
Thanks, another look? I also moved a typedef from the .cc file to the header ...
10 years, 4 months ago (2010-08-23 16:46:29 UTC) #6
brettw
10 years, 4 months ago (2010-08-23 16:49:08 UTC) #7
LGTM

Powered by Google App Engine
This is Rietveld 408576698