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
99 #define COMPILE_ASSERT(expr, msg) \
100 typedef StubsCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] ATTRIBUTE_UNUSED // NOLINT(*)
108 #if defined(COMPILER_MSVC)
109 #define OVERRIDE override
110 #elif defined(__clang__)
111 #define OVERRIDE override
112 #elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \
113 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700
115 #define OVERRIDE override
121 #ifndef DISALLOW_COPY_AND_ASSIGN
122 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
123 TypeName(const TypeName&); \
124 void operator=(const TypeName&)
128 #define FRIEND_TEST(test_case_name, test_name) \
129 friend class test_case_name##_##test_name##_Test
137 #define KUDU_DCHECK(condition) while (false) kudu::internal_logging::NullLog()
138 #define KUDU_DCHECK_EQ(val1, val2) while (false) kudu::internal_logging::NullLog()
139 #define KUDU_DCHECK_NE(val1, val2) while (false) kudu::internal_logging::NullLog()
140 #define KUDU_DCHECK_LE(val1, val2) while (false) kudu::internal_logging::NullLog()
141 #define KUDU_DCHECK_LT(val1, val2) while (false) kudu::internal_logging::NullLog()
142 #define KUDU_DCHECK_GE(val1, val2) while (false) kudu::internal_logging::NullLog()
143 #define KUDU_DCHECK_GT(val1, val2) while (false) kudu::internal_logging::NullLog()
144 #define KUDU_DCHECK_NOTNULL(val) (val)
145 #define KUDU_DCHECK_STREQ(str1, str2) while (false) kudu::internal_logging::NullLog()
146 #define KUDU_DCHECK_STRCASEEQ(str1, str2) while (false) kudu::internal_logging::NullLog()
147 #define KUDU_DCHECK_STRNE(str1, str2) while (false) kudu::internal_logging::NullLog()
148 #define KUDU_DCHECK_STRCASENE(str1, str2) while (false) kudu::internal_logging::NullLog()
153 #define KUDU_WARNING 1
158 #define KUDU_DFATAL KUDU_WARNING
160 #define KUDU_DFATAL KUDU_FATAL
163 #define KUDU_LOG_INTERNAL(level) kudu::internal_logging::CerrLog(level)
164 #define KUDU_LOG(level) KUDU_LOG_INTERNAL(KUDU_##level)
166 #define KUDU_CHECK(condition) \
167 (condition) ? 0 : KUDU_LOG(FATAL) << "Check failed: " #condition " "
171 namespace internal_logging {
198 : severity_(severity),
204 std::cerr << std::endl;
206 if (severity_ == KUDU_FATAL) {
A helper for the nil log sink.
Definition: stubs.h:177
CerrLog(int severity)
Definition: stubs.h:197
A helper for stderr log sink.
Definition: stubs.h:191
CerrLog & operator<<(const T &t)
Definition: stubs.h:217
NullLog & operator<<(const T &t)
Definition: stubs.h:185