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
Review URL: http://codereview.chromium.org/3106032
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57098 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: ff3d0c3a57b0be4f333bbbc5caeb95cd10f42f96
diff --git a/base/logging.cc b/base/logging.cc
index 2d61910..f90a369 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -82,10 +82,8 @@
// will be lazily initialized to the default value when it is
// first needed.
#if defined(OS_WIN)
-typedef wchar_t PathChar;
typedef std::wstring PathString;
#else
-typedef char PathChar;
typedef std::string PathString;
#endif
PathString* log_file_name = NULL;
@@ -248,8 +246,10 @@
#endif
}
-void InitLogging(const PathChar* new_log_file, LoggingDestination logging_dest,
- LogLockingState lock_log, OldFileDeletionState delete_old) {
+void BaseInitLoggingImpl(const PathChar* new_log_file,
+ LoggingDestination logging_dest,
+ LogLockingState lock_log,
+ OldFileDeletionState delete_old) {
g_enable_dcheck =
CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableDCHECK);