From b0dc3d720414003b271d2f992c34252dc736b74c Mon Sep 17 00:00:00 2001 From: "andrew@webrtc.org" Date: Thu, 28 Aug 2014 19:00:15 +0000 Subject: [PATCH] Precompile out our standalone CHECK macros in a Chromium build. As documented, the use of overrides/webrtc/base/logging.h in a Chromium build reuslts in redefined macro errors. Fortunately, Chromium's macros can be used as drop-in replacements for the standalone versions. TBR=henrike Review URL: https://webrtc-codereview.appspot.com/17239004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7004 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/base/checks.cc | 5 +++++ webrtc/base/checks.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/webrtc/base/checks.cc b/webrtc/base/checks.cc index 99d8877b1..5de1a8044 100644 --- a/webrtc/base/checks.cc +++ b/webrtc/base/checks.cc @@ -111,6 +111,9 @@ void FatalMessage::Init(const char* file, int line) { << file << ", line " << line << std::endl << "# "; } +// Refer to comments in checks.h. +#ifndef WEBRTC_CHROMIUM_BUILD + // MSVC doesn't like complex extern templates and DLLs. #if !defined(COMPILER_MSVC) // Explicit instantiations for commonly used comparisons. @@ -126,4 +129,6 @@ template std::string* MakeCheckOpString( const std::string&, const std::string&, const char* name); #endif +#endif // WEBRTC_CHROMIUM_BUILD + } // namespace rtc diff --git a/webrtc/base/checks.h b/webrtc/base/checks.h index 9f8122e16..b3917bb55 100644 --- a/webrtc/base/checks.h +++ b/webrtc/base/checks.h @@ -52,6 +52,11 @@ namespace rtc { +// The use of overrides/webrtc/base/logging.h in a Chromium build results in +// redefined macro errors. Fortunately, Chromium's macros can be used as drop-in +// replacements for the standalone versions. +#ifndef WEBRTC_CHROMIUM_BUILD + // Helper macro which avoids evaluating the arguments to a stream if // the condition doesn't hold. #define LAZY_STREAM(stream, condition) \ @@ -162,6 +167,8 @@ DEFINE_CHECK_OP_IMPL(GT, > ) #define DCHECK_LE(v1, v2) EAT_STREAM_PARAMETERS #endif +#endif // WEBRTC_CHROMIUM_BUILD + #define FATAL() rtc::FatalMessage(__FILE__, __LINE__).stream() // TODO(ajm): Consider adding NOTIMPLEMENTED and NOTREACHED macros when // base/logging.h and system_wrappers/logging.h are consolidated such that we