17 #ifndef KUDU_CLIENT_STUBS_H
18 #define KUDU_CLIENT_STUBS_H
32 #define PREDICT_FALSE(x) (__builtin_expect(x, 0))
34 #define PREDICT_FALSE(x) x
39 #define PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
41 #define PREDICT_TRUE(x) x
49 #ifndef WARN_UNUSED_RESULT
51 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
53 #define WARN_UNUSED_RESULT
57 #if (defined(__GNUC__) || defined(__APPLE__)) && !defined(SWIG)
58 #undef ATTRIBUTE_UNUSED
59 #define ATTRIBUTE_UNUSED __attribute__ ((unused))
61 #ifndef ATTRIBUTE_UNUSED
62 #define ATTRIBUTE_UNUSED
69 #ifndef ATTRIBUTE_DEPRECATED
70 #if defined(__clang__) || \
71 (defined(COMPILER_GCC) && \
72 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 30200)
73 #define ATTRIBUTE_DEPRECATED(msg) __attribute__ ((deprecated (msg) ))
75 #define ATTRIBUTE_DEPRECATED(msg)
77 #endif // #ifndef ATTRIBUTE_DEPRECATED
79 #ifndef COMPILE_ASSERT
97 struct StubsCompileAssert {
101 #define COMPILE_ASSERT(expr, msg) \
102 typedef StubsCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] ATTRIBUTE_UNUSED // NOLINT(*)
110 #if defined(COMPILER_MSVC)
111 #define OVERRIDE override
112 #elif defined(__clang__)
113 #define OVERRIDE override
114 #elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \
115 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700
117 #define OVERRIDE override
123 #ifndef DISALLOW_COPY_AND_ASSIGN
124 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
125 TypeName(const TypeName&); \
126 void operator=(const TypeName&)
130 #define FRIEND_TEST(test_case_name, test_name) \
131 friend class test_case_name##_##test_name##_Test
139 #define KUDU_DCHECK(condition) while (false) kudu::internal_logging::NullLog()
140 #define KUDU_DCHECK_EQ(val1, val2) while (false) kudu::internal_logging::NullLog()
141 #define KUDU_DCHECK_NE(val1, val2) while (false) kudu::internal_logging::NullLog()
142 #define KUDU_DCHECK_LE(val1, val2) while (false) kudu::internal_logging::NullLog()
143 #define KUDU_DCHECK_LT(val1, val2) while (false) kudu::internal_logging::NullLog()
144 #define KUDU_DCHECK_GE(val1, val2) while (false) kudu::internal_logging::NullLog()
145 #define KUDU_DCHECK_GT(val1, val2) while (false) kudu::internal_logging::NullLog()
146 #define KUDU_DCHECK_NOTNULL(val) (val)
147 #define KUDU_DCHECK_STREQ(str1, str2) while (false) kudu::internal_logging::NullLog()
148 #define KUDU_DCHECK_STRCASEEQ(str1, str2) while (false) kudu::internal_logging::NullLog()
149 #define KUDU_DCHECK_STRNE(str1, str2) while (false) kudu::internal_logging::NullLog()
150 #define KUDU_DCHECK_STRCASENE(str1, str2) while (false) kudu::internal_logging::NullLog()
155 #define KUDU_WARNING 1
160 #define KUDU_DFATAL KUDU_WARNING
162 #define KUDU_DFATAL KUDU_FATAL
165 #define KUDU_LOG_INTERNAL(level) kudu::internal_logging::CerrLog(level)
166 #define KUDU_LOG(level) KUDU_LOG_INTERNAL(KUDU_##level)
168 #define KUDU_CHECK(condition) \
169 (condition) ? 0 : KUDU_LOG(FATAL) << "Check failed: " #condition " "
173 namespace internal_logging {
200 : severity_(severity),
206 std::cerr << std::endl;
208 if (severity_ == KUDU_FATAL) {
A helper for the nil log sink.
Definition: stubs.h:179
CerrLog(int severity)
Definition: stubs.h:199
A helper for stderr log sink.
Definition: stubs.h:193
CerrLog & operator<<(const T &t)
Definition: stubs.h:219
NullLog & operator<<(const T &t)
Definition: stubs.h:187