Commit 9e15c473 authored by 's avatar

Add DCHECK_NOTNULL macro to logging.h (points to CHECK_NOTNULL in debug mode)

http://code.google.com/p/google-glog/issues/detail?id=25


git-svn-id: https://google-glog.googlecode.com/svn/trunk@83 eb4d4688-79bd-11dd-afb4-1d65580434c0
parent b2704e9f
......@@ -889,6 +889,7 @@ enum PRIVATE_Counter {COUNTER};
#define DCHECK_LT(val1, val2) CHECK_LT(val1, val2)
#define DCHECK_GE(val1, val2) CHECK_GE(val1, val2)
#define DCHECK_GT(val1, val2) CHECK_GT(val1, val2)
#define DCHECK_NOTNULL(val) CHECK_NOTNULL(val)
#define DCHECK_STREQ(str1, str2) CHECK_STREQ(str1, str2)
#define DCHECK_STRCASEEQ(str1, str2) CHECK_STRCASEEQ(str1, str2)
#define DCHECK_STRNE(str1, str2) CHECK_STRNE(str1, str2)
......@@ -943,6 +944,8 @@ enum PRIVATE_Counter {COUNTER};
while (false) \
CHECK_GT(val1, val2)
#define DCHECK_NOTNULL(val) (val)
#define DCHECK_STREQ(str1, str2) \
while (false) \
CHECK_STREQ(str1, str2)
......
......@@ -43,6 +43,7 @@
#include <iomanip>
#include <iostream>
#include <memory>
#include <queue>
#include <sstream>
#include <string>
......@@ -555,6 +556,10 @@ void TestDCHECK() {
DCHECK_LE(1, 2);
DCHECK_GT(2, 1);
DCHECK_LT(1, 2);
auto_ptr<int64> sptr(new int64);
int64* ptr = DCHECK_NOTNULL(sptr.get());
ASSERT_EQ(ptr, sptr.get());
}
void TestSTREQ() {
......
......@@ -893,6 +893,7 @@ enum PRIVATE_Counter {COUNTER};
#define DCHECK_LT(val1, val2) CHECK_LT(val1, val2)
#define DCHECK_GE(val1, val2) CHECK_GE(val1, val2)
#define DCHECK_GT(val1, val2) CHECK_GT(val1, val2)
#define DCHECK_NOTNULL(val) CHECK_NOTNULL(val)
#define DCHECK_STREQ(str1, str2) CHECK_STREQ(str1, str2)
#define DCHECK_STRCASEEQ(str1, str2) CHECK_STRCASEEQ(str1, str2)
#define DCHECK_STRNE(str1, str2) CHECK_STRNE(str1, str2)
......@@ -947,6 +948,8 @@ enum PRIVATE_Counter {COUNTER};
while (false) \
CHECK_GT(val1, val2)
#define DCHECK_NOTNULL(val) (val)
#define DCHECK_STREQ(str1, str2) \
while (false) \
CHECK_STREQ(str1, str2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment