@@ -112,22 +112,21 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
112
112
} while (0)
113
113
114
114
#define VERIFY3B (LEFT , OP , RIGHT ) do { \
115
- const boolean_t _verify3_left = (boolean_t)(LEFT); \
116
- const boolean_t _verify3_right = (boolean_t)(RIGHT); \
115
+ const boolean_t _verify3_left = (boolean_t)!! (LEFT); \
116
+ const boolean_t _verify3_right = (boolean_t)!! (RIGHT); \
117
117
if (unlikely(!(_verify3_left OP _verify3_right))) \
118
118
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
119
- "VERIFY3 (" #LEFT " " #OP " " #RIGHT ") " \
119
+ "VERIFY3B (" #LEFT ", " #OP ", " #RIGHT ") " \
120
120
"failed (%d " #OP " %d)\n", \
121
- (boolean_t)_verify3_left, \
122
- (boolean_t)_verify3_right); \
121
+ _verify3_left, _verify3_right); \
123
122
} while (0)
124
123
125
124
#define VERIFY3S (LEFT , OP , RIGHT ) do { \
126
125
const int64_t _verify3_left = (int64_t)(LEFT); \
127
126
const int64_t _verify3_right = (int64_t)(RIGHT); \
128
127
if (unlikely(!(_verify3_left OP _verify3_right))) \
129
128
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
130
- "VERIFY3 (" #LEFT " " #OP " " #RIGHT ") " \
129
+ "VERIFY3S (" #LEFT ", " #OP ", " #RIGHT ") " \
131
130
"failed (%lld " #OP " %lld)\n", \
132
131
(long long)_verify3_left, \
133
132
(long long)_verify3_right); \
@@ -138,7 +137,7 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
138
137
const uint64_t _verify3_right = (uint64_t)(RIGHT); \
139
138
if (unlikely(!(_verify3_left OP _verify3_right))) \
140
139
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
141
- "VERIFY3 (" #LEFT " " #OP " " #RIGHT ") " \
140
+ "VERIFY3U (" #LEFT ", " #OP ", " #RIGHT ") " \
142
141
"failed (%llu " #OP " %llu)\n", \
143
142
(unsigned long long)_verify3_left, \
144
143
(unsigned long long)_verify3_right); \
@@ -149,8 +148,8 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
149
148
const uintptr_t _verify3_right = (uintptr_t)(RIGHT); \
150
149
if (unlikely(!(_verify3_left OP _verify3_right))) \
151
150
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
152
- "VERIFY3 (" #LEFT " " #OP " " #RIGHT ") " \
153
- "failed (%px " #OP " %px )\n", \
151
+ "VERIFY3P (" #LEFT ", " #OP ", " #RIGHT ") " \
152
+ "failed (%p " #OP " %p )\n", \
154
153
(void *)_verify3_left, \
155
154
(void *)_verify3_right); \
156
155
} while (0)
@@ -159,17 +158,15 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
159
158
const int64_t _verify0_right = (int64_t)(RIGHT); \
160
159
if (unlikely(!(0 == _verify0_right))) \
161
160
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
162
- "VERIFY0(" #RIGHT ") " \
163
- "failed (0 == %lld)\n", \
161
+ "VERIFY0(" #RIGHT ") failed (%lld)\n", \
164
162
(long long)_verify0_right); \
165
163
} while (0)
166
164
167
165
#define VERIFY0P (RIGHT ) do { \
168
166
const uintptr_t _verify0_right = (uintptr_t)(RIGHT); \
169
167
if (unlikely(!(0 == _verify0_right))) \
170
168
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
171
- "VERIFY0P(" #RIGHT ") " \
172
- "failed (NULL == %px)\n", \
169
+ "VERIFY0P(" #RIGHT ") failed (%p)\n", \
173
170
(void *)_verify0_right); \
174
171
} while (0)
175
172
@@ -182,14 +179,13 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
182
179
*/
183
180
184
181
#define VERIFY3BF (LEFT , OP , RIGHT , STR , ...) do { \
185
- const boolean_t _verify3_left = (boolean_t)(LEFT); \
186
- const boolean_t _verify3_right = (boolean_t)(RIGHT); \
182
+ const boolean_t _verify3_left = (boolean_t)!! (LEFT); \
183
+ const boolean_t _verify3_right = (boolean_t)!! (RIGHT); \
187
184
if (unlikely(!(_verify3_left OP _verify3_right))) \
188
185
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
189
- "VERIFY3 (" #LEFT " " #OP " " #RIGHT ") " \
186
+ "VERIFY3B (" #LEFT ", " #OP ", " #RIGHT ") " \
190
187
"failed (%d " #OP " %d) " STR "\n", \
191
- (boolean_t)(_verify3_left), \
192
- (boolean_t)(_verify3_right), \
188
+ _verify3_left, _verify3_right, \
193
189
__VA_ARGS__); \
194
190
} while (0)
195
191
@@ -198,10 +194,9 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
198
194
const int64_t _verify3_right = (int64_t)(RIGHT); \
199
195
if (unlikely(!(_verify3_left OP _verify3_right))) \
200
196
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
201
- "VERIFY3 (" #LEFT " " #OP " " #RIGHT ") " \
197
+ "VERIFY3S (" #LEFT ", " #OP ", " #RIGHT ") " \
202
198
"failed (%lld " #OP " %lld) " STR "\n", \
203
- (long long)(_verify3_left), \
204
- (long long)(_verify3_right), \
199
+ (long long)_verify3_left, (long long)_verify3_right,\
205
200
__VA_ARGS__); \
206
201
} while (0)
207
202
@@ -210,10 +205,10 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
210
205
const uint64_t _verify3_right = (uint64_t)(RIGHT); \
211
206
if (unlikely(!(_verify3_left OP _verify3_right))) \
212
207
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
213
- "VERIFY3 (" #LEFT " " #OP " " #RIGHT ") " \
208
+ "VERIFY3U (" #LEFT ", " #OP ", " #RIGHT ") " \
214
209
"failed (%llu " #OP " %llu) " STR "\n", \
215
- (unsigned long long)( _verify3_left), \
216
- (unsigned long long)( _verify3_right), \
210
+ (unsigned long long)_verify3_left, \
211
+ (unsigned long long)_verify3_right, \
217
212
__VA_ARGS__); \
218
213
} while (0)
219
214
@@ -222,32 +217,27 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
222
217
const uintptr_t _verify3_right = (uintptr_t)(RIGHT); \
223
218
if (unlikely(!(_verify3_left OP _verify3_right))) \
224
219
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
225
- "VERIFY3(" #LEFT " " #OP " " #RIGHT ") " \
226
- "failed (%px " #OP " %px) " STR "\n", \
227
- (void *) (_verify3_left), \
228
- (void *) (_verify3_right), \
220
+ "VERIFY3P(" #LEFT ", " #OP ", " #RIGHT ") " \
221
+ "failed (%p " #OP " %p) " STR "\n", \
222
+ (void *)_verify3_left, (void *)_verify3_right, \
229
223
__VA_ARGS__); \
230
224
} while (0)
231
225
232
226
#define VERIFY0PF (RIGHT , STR , ...) do { \
233
- const uintptr_t _verify3_left = (uintptr_t)(0); \
234
227
const uintptr_t _verify3_right = (uintptr_t)(RIGHT); \
235
- if (unlikely(!(_verify3_left == _verify3_right))) \
228
+ if (unlikely(!(0 == _verify3_right))) \
236
229
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
237
- "VERIFY0(0 == " #RIGHT ") " \
238
- "failed (0 == %px) " STR "\n", \
239
- (long long) (_verify3_right), \
230
+ "VERIFY0P(" #RIGHT ") failed (%p) " STR "\n", \
231
+ (void *)_verify3_right, \
240
232
__VA_ARGS__); \
241
233
} while (0)
242
234
243
235
#define VERIFY0F (RIGHT , STR , ...) do { \
244
- const int64_t _verify3_left = (int64_t)(0); \
245
236
const int64_t _verify3_right = (int64_t)(RIGHT); \
246
- if (unlikely(!(_verify3_left == _verify3_right))) \
237
+ if (unlikely(!(0 == _verify3_right))) \
247
238
spl_panic(__FILE__, __FUNCTION__, __LINE__, \
248
- "VERIFY0(0 == " #RIGHT ") " \
249
- "failed (0 == %lld) " STR "\n", \
250
- (long long) (_verify3_right), \
239
+ "VERIFY0(" #RIGHT ") failed (%lld) " STR "\n", \
240
+ (long long)_verify3_right, \
251
241
__VA_ARGS__); \
252
242
} while (0)
253
243
@@ -256,10 +246,7 @@ spl_assert(const char *buf, const char *file, const char *func, int line)
256
246
spl_assert("(" #A ") implies (" #B ")", \
257
247
__FILE__, __FUNCTION__, __LINE__)))
258
248
259
- #define VERIFY_EQUIV (A , B ) \
260
- ((void)(likely(!!(A) == !!(B)) || \
261
- spl_assert("(" #A ") is equivalent to (" #B ")", \
262
- __FILE__, __FUNCTION__, __LINE__)))
249
+ #define VERIFY_EQUIV (A , B ) VERIFY3B(A, ==, B)
263
250
264
251
/*
265
252
* Debugging disabled (--disable-debug)
0 commit comments