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__) && __cplusplus >= 201103
116 # define OVERRIDE override
117 # elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \
118 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700
120 # define OVERRIDE override
124 #endif // #ifndef OVERRIDE
126 #ifndef DISALLOW_COPY_AND_ASSIGN
127 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
128 TypeName(const TypeName&); \
129 void operator=(const TypeName&)
133 #define FRIEND_TEST(test_case_name, test_name) \
134 friend class test_case_name##_##test_name##_Test
142 #define KUDU_DCHECK(condition) while (false) kudu::internal_logging::NullLog()
143 #define KUDU_DCHECK_EQ(val1, val2) while (false) kudu::internal_logging::NullLog()
144 #define KUDU_DCHECK_NE(val1, val2) while (false) kudu::internal_logging::NullLog()
145 #define KUDU_DCHECK_LE(val1, val2) while (false) kudu::internal_logging::NullLog()
146 #define KUDU_DCHECK_LT(val1, val2) while (false) kudu::internal_logging::NullLog()
147 #define KUDU_DCHECK_GE(val1, val2) while (false) kudu::internal_logging::NullLog()
148 #define KUDU_DCHECK_GT(val1, val2) while (false) kudu::internal_logging::NullLog()
149 #define KUDU_DCHECK_NOTNULL(val) (val)
150 #define KUDU_DCHECK_STREQ(str1, str2) while (false) kudu::internal_logging::NullLog()
151 #define KUDU_DCHECK_STRCASEEQ(str1, str2) while (false) kudu::internal_logging::NullLog()
152 #define KUDU_DCHECK_STRNE(str1, str2) while (false) kudu::internal_logging::NullLog()
153 #define KUDU_DCHECK_STRCASENE(str1, str2) while (false) kudu::internal_logging::NullLog()
158 #define KUDU_WARNING 1
163 #define KUDU_DFATAL KUDU_WARNING
165 #define KUDU_DFATAL KUDU_FATAL
168 #define KUDU_LOG_INTERNAL(level) kudu::internal_logging::CerrLog(level)
169 #define KUDU_LOG(level) KUDU_LOG_INTERNAL(KUDU_##level)
171 #define KUDU_CHECK(condition) \
172 (condition) ? 0 : KUDU_LOG(FATAL) << "Check failed: " #condition " "
176 namespace internal_logging {
203 : severity_(severity),
209 std::cerr << std::endl;
211 if (severity_ == KUDU_FATAL) {
A helper for the nil log sink.
Definition: stubs.h:182
CerrLog(int severity)
Definition: stubs.h:202
A helper for stderr log sink.
Definition: stubs.h:196
CerrLog & operator<<(const T &t)
Definition: stubs.h:222
NullLog & operator<<(const T &t)
Definition: stubs.h:190