@@ -116,6 +116,16 @@ void DumpBacktrace(FILE* fp);
116116
117117#define ABORT () node::Abort()
118118
119+ #define ERROR_AND_ABORT (expr ) \
120+ do { \
121+ /* Make sure that this struct does not end up in inline code, but */ \
122+ /* rather in a read-only data section when modifying this code. */ \
123+ static const node::AssertionInfo args = { \
124+ __FILE__ " :" STRINGIFY (__LINE__), #expr, PRETTY_FUNCTION_NAME \
125+ }; \
126+ node::Assert (args); \
127+ } while (0 )
128+
119129#ifdef __GNUC__
120130#define LIKELY (expr ) __builtin_expect(!!(expr), 1 )
121131#define UNLIKELY (expr ) __builtin_expect(!!(expr), 0 )
@@ -132,12 +142,7 @@ void DumpBacktrace(FILE* fp);
132142#define CHECK (expr ) \
133143 do { \
134144 if (UNLIKELY (!(expr))) { \
135- /* Make sure that this struct does not end up in inline code, but */ \
136- /* rather in a read-only data section when modifying this code. */ \
137- static const node::AssertionInfo args = { \
138- __FILE__ " :" STRINGIFY (__LINE__), #expr, PRETTY_FUNCTION_NAME \
139- }; \
140- node::Assert (args); \
145+ ERROR_AND_ABORT (expr); \
141146 } \
142147 } while (0 )
143148
@@ -176,7 +181,8 @@ void DumpBacktrace(FILE* fp);
176181#endif
177182
178183
179- #define UNREACHABLE () ABORT()
184+ #define UNREACHABLE (expr ) \
185+ ERROR_AND_ABORT (" Unreachable code reached: " expr)
180186
181187// TAILQ-style intrusive list node.
182188template <typename T>
0 commit comments