mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
base: Change DCHECK_IS_ON to a macro DCHECK_IS_ON() to match Chromium
changes (see http://crrev.com/e649f573) and fix unit test runtime errors when building with GYP_DEFINES=dcheck_always_on=1.
This commit is contained in:
@ -419,9 +419,9 @@ DEFINE_CHECK_OP_IMPL(GT, > )
|
||||
#endif
|
||||
|
||||
#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
|
||||
#define DCHECK_IS_ON 0
|
||||
#define DCHECK_IS_ON() 0
|
||||
#else
|
||||
#define DCHECK_IS_ON 1
|
||||
#define DCHECK_IS_ON() 1
|
||||
#endif
|
||||
|
||||
// Definitions for DLOG et al.
|
||||
@ -475,14 +475,14 @@ enum { DEBUG_MODE = ENABLE_DLOG };
|
||||
|
||||
// Definitions for DCHECK et al.
|
||||
|
||||
#if DCHECK_IS_ON
|
||||
#if DCHECK_IS_ON()
|
||||
|
||||
#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \
|
||||
COMPACT_GOOGLE_LOG_EX_FATAL(ClassName , ##__VA_ARGS__)
|
||||
#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_FATAL
|
||||
const LogSeverity LOG_DCHECK = LOG_FATAL;
|
||||
|
||||
#else // DCHECK_IS_ON
|
||||
#else // DCHECK_IS_ON()
|
||||
|
||||
// These are just dummy values.
|
||||
#define COMPACT_GOOGLE_LOG_EX_DCHECK(ClassName, ...) \
|
||||
@ -490,31 +490,29 @@ const LogSeverity LOG_DCHECK = LOG_FATAL;
|
||||
#define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_INFO
|
||||
const LogSeverity LOG_DCHECK = LOG_INFO;
|
||||
|
||||
#endif // DCHECK_IS_ON
|
||||
#endif // DCHECK_IS_ON()
|
||||
|
||||
// DCHECK et al. make sure to reference |condition| regardless of
|
||||
// whether DCHECKs are enabled; this is so that we don't get unused
|
||||
// variable warnings if the only use of a variable is in a DCHECK.
|
||||
// This behavior is different from DLOG_IF et al.
|
||||
|
||||
#define DCHECK(condition) \
|
||||
LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON && !(condition)) \
|
||||
<< "Check failed: " #condition ". "
|
||||
#define DCHECK(condition) \
|
||||
LAZY_STREAM(LOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \
|
||||
<< "Check failed: " #condition ". "
|
||||
|
||||
#define DPCHECK(condition) \
|
||||
LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON && !(condition)) \
|
||||
<< "Check failed: " #condition ". "
|
||||
#define DPCHECK(condition) \
|
||||
LAZY_STREAM(PLOG_STREAM(DCHECK), DCHECK_IS_ON() && !(condition)) \
|
||||
<< "Check failed: " #condition ". "
|
||||
|
||||
// Helper macro for binary operators.
|
||||
// Don't use this macro directly in your code, use DCHECK_EQ et al below.
|
||||
#define DCHECK_OP(name, op, val1, val2) \
|
||||
if (DCHECK_IS_ON) \
|
||||
if (std::string* _result = \
|
||||
cef::logging::Check##name##Impl((val1), (val2), \
|
||||
#val1 " " #op " " #val2)) \
|
||||
cef::logging::LogMessage( \
|
||||
__FILE__, __LINE__, ::cef::logging::LOG_DCHECK, \
|
||||
_result).stream()
|
||||
#define DCHECK_OP(name, op, val1, val2) \
|
||||
if (DCHECK_IS_ON()) \
|
||||
if (std::string* _result = cef::logging::Check##name##Impl( \
|
||||
(val1), (val2), #val1 " " #op " " #val2)) \
|
||||
cef::logging::LogMessage(__FILE__, __LINE__, \
|
||||
::cef::logging::LOG_DCHECK, _result).stream()
|
||||
|
||||
// Equality/Inequality checks - compare two values, and log a
|
||||
// LOG_DCHECK message including the two values when the result is not
|
||||
|
Reference in New Issue
Block a user