@@ -116,6 +116,16 @@ void DumpBacktrace(FILE* fp);
116
116
117
117
#define ABORT () node::Abort()
118
118
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
+
119
129
#ifdef __GNUC__
120
130
#define LIKELY (expr ) __builtin_expect(!!(expr), 1 )
121
131
#define UNLIKELY (expr ) __builtin_expect(!!(expr), 0 )
@@ -132,12 +142,7 @@ void DumpBacktrace(FILE* fp);
132
142
#define CHECK (expr ) \
133
143
do { \
134
144
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); \
141
146
} \
142
147
} while (0 )
143
148
@@ -176,7 +181,8 @@ void DumpBacktrace(FILE* fp);
176
181
#endif
177
182
178
183
179
- #define UNREACHABLE () ABORT()
184
+ #define UNREACHABLE (expr ) \
185
+ ERROR_AND_ABORT (" Unreachable code reached: " expr)
180
186
181
187
// TAILQ-style intrusive list node.
182
188
template <typename T>
0 commit comments