17#ifndef KUDU_CLIENT_STUBS_H
18#define KUDU_CLIENT_STUBS_H
31#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
33#define PREDICT_FALSE(x) x
38#define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
40#define PREDICT_TRUE(x) x
48#ifndef WARN_UNUSED_RESULT
50#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
52#define WARN_UNUSED_RESULT
56#if (defined(__GNUC__) || defined(__APPLE__)) && !defined(SWIG)
57#undef ATTRIBUTE_UNUSED
58#define ATTRIBUTE_UNUSED __attribute__ ((unused))
60#ifndef ATTRIBUTE_UNUSED
61#define ATTRIBUTE_UNUSED
68#ifndef ATTRIBUTE_DEPRECATED
69#if defined(__clang__) || \
70 (defined(COMPILER_GCC) && \
71 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 30200)
72#define ATTRIBUTE_DEPRECATED(msg) __attribute__ ((deprecated (msg) ))
74#define ATTRIBUTE_DEPRECATED(msg)
96struct StubsCompileAssert {
100#define COMPILE_ASSERT(expr, msg) \
101 typedef StubsCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] ATTRIBUTE_UNUSED
109# if defined(COMPILER_MSVC)
110# define OVERRIDE override
111# elif defined(__clang__) && __cplusplus >= 201103
115# define OVERRIDE override
116# elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \
117 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700
119# define OVERRIDE override
125#ifndef DISALLOW_COPY_AND_ASSIGN
126#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
127 TypeName(const TypeName&); \
128 void operator=(const TypeName&)
132#define FRIEND_TEST(test_case_name, test_name) \
133 friend class test_case_name##_##test_name##_Test
141#define KUDU_DCHECK(condition) while (false) kudu::internal_logging::NullLog()
142#define KUDU_DCHECK_EQ(val1, val2) while (false) kudu::internal_logging::NullLog()
143#define KUDU_DCHECK_NE(val1, val2) while (false) kudu::internal_logging::NullLog()
144#define KUDU_DCHECK_LE(val1, val2) while (false) kudu::internal_logging::NullLog()
145#define KUDU_DCHECK_LT(val1, val2) while (false) kudu::internal_logging::NullLog()
146#define KUDU_DCHECK_GE(val1, val2) while (false) kudu::internal_logging::NullLog()
147#define KUDU_DCHECK_GT(val1, val2) while (false) kudu::internal_logging::NullLog()
148#define KUDU_DCHECK_NOTNULL(val) (val)
149#define KUDU_DCHECK_STREQ(str1, str2) while (false) kudu::internal_logging::NullLog()
150#define KUDU_DCHECK_STRCASEEQ(str1, str2) while (false) kudu::internal_logging::NullLog()
151#define KUDU_DCHECK_STRNE(str1, str2) while (false) kudu::internal_logging::NullLog()
152#define KUDU_DCHECK_STRCASENE(str1, str2) while (false) kudu::internal_logging::NullLog()
157#define KUDU_WARNING 1
162#define KUDU_DFATAL KUDU_WARNING
164#define KUDU_DFATAL KUDU_FATAL
167#define KUDU_LOG_INTERNAL(level) kudu::internal_logging::CerrLog(level)
168#define KUDU_LOG(level) KUDU_LOG_INTERNAL(KUDU_##level)
170#define KUDU_CHECK(condition) \
171 (condition) ? 0 : KUDU_LOG(FATAL) << "Check failed: " #condition " "
175namespace internal_logging {
202 : severity_(severity),
208 std::cerr << std::endl;
210 if (severity_ == KUDU_FATAL) {
A helper for stderr log sink.
Definition stubs.h:195
CerrLog & operator<<(const T &t)
Definition stubs.h:221
CerrLog(int severity)
Definition stubs.h:201
A helper for the nil log sink.
Definition stubs.h:181
NullLog & operator<<(const T &t)
Definition stubs.h:189