f73cfb97ebd5592a4506d287607ba014e9feebd4
[babeltrace.git] / src / lib / assert-cond.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (c) 2018 EfficiOS Inc. and Linux Foundation
5 * Copyright (c) 2018-2020 Philippe Proulx <pproulx@efficios.com>
6 */
7
8 #ifndef BABELTRACE_LIB_ASSERT_COND_H
9 #define BABELTRACE_LIB_ASSERT_COND_H
10
11 #include "assert-cond-base.h"
12 #include "trace-ir/trace-class.h" /* IWYU pragma: keep */
13
14 #include <inttypes.h>
15
16 /*
17 * Asserts that a given variable `_obj` named `_obj_name` (capitalized)
18 * and having the ID `_obj_id` (within the function's context) is not
19 * `NULL`.
20 */
21 #define BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _obj_id, _obj, _obj_name) \
22 BT_ASSERT_PRE_FROM_FUNC(_func, "not-null:" _obj_id, (_obj), \
23 "%s is NULL.", _obj_name)
24
25 #define BT_ASSERT_PRE_NON_NULL(_obj_id, _obj, _obj_name) \
26 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(__func__, _obj_id, (_obj), _obj_name)
27
28 /*
29 * Asserts that a given index `_index` is less than a given length
30 * `_length`.
31 */
32 #define BT_ASSERT_PRE_VALID_INDEX_FROM_FUNC(_func, _index, _length) \
33 BT_ASSERT_PRE_FROM_FUNC(_func, "valid-index", (_index) < (_length), \
34 "Index is out of bounds: index=%" PRIu64 ", " \
35 "count=%" PRIu64, (uint64_t) (_index), (uint64_t) (_length))
36
37 #define BT_ASSERT_PRE_VALID_INDEX(_index, _length) \
38 BT_ASSERT_PRE_VALID_INDEX_FROM_FUNC(__func__, (_index), (_length))
39
40 /*
41 * Asserts that the current thread has no error set.
42 */
43 #define BT_ASSERT_PRE_NO_ERROR_FROM_FUNC(_func) \
44 do { \
45 const struct bt_error *err = bt_current_thread_take_error(); \
46 if (err) { \
47 bt_current_thread_move_error(err); \
48 } \
49 BT_ASSERT_PRE_FROM_FUNC(_func, "no-error", !err, \
50 "API function called while current thread has an " \
51 "error: function=%s", _func); \
52 } while (0)
53
54 #define BT_ASSERT_PRE_NO_ERROR() \
55 BT_ASSERT_PRE_NO_ERROR_FROM_FUNC(__func__)
56
57 /*
58 * Asserts that, if the current thread has an error, `_status` is an
59 * error status code.
60 *
61 * See _BT_ASSERT_COND() for details about the `_func` parameter.
62 *
63 * Puts back the error in place (if there is one) such that if this
64 * macro aborts, it will be possible to inspect it with a debugger.
65 */
66 #define BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(_func, _status) \
67 do { \
68 const struct bt_error *_err = bt_current_thread_take_error(); \
69 if (_err) { \
70 bt_current_thread_move_error(_err); \
71 } \
72 BT_ASSERT_POST(_func, "no-error-if-no-error-status", \
73 (_status) < 0 || !_err, \
74 "Current thread has an error, but user function " \
75 "returned a non-error status: status=%s", \
76 bt_common_func_status_string(_status)); \
77 } while (0)
78
79 /*
80 * Asserts that the current thread has no error.
81 *
82 * See _BT_ASSERT_COND() for details about the `_func` parameter.
83 */
84 #define BT_ASSERT_POST_NO_ERROR(_func) \
85 do { \
86 const struct bt_error *_err = bt_current_thread_take_error(); \
87 if (_err) { \
88 bt_current_thread_move_error(_err); \
89 } \
90 BT_ASSERT_POST(_func, "no-error", !_err, \
91 "Current thread has an error"); \
92 } while (0)
93
94 #ifdef BT_DEV_MODE
95 /* Developer mode version of BT_ASSERT_PRE_NON_NULL_FROM_FUNC() */
96 # define BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, _obj_id, _obj, _obj_name) \
97 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _obj_id, (_obj), (_obj_name))
98
99 /* Developer mode version of BT_ASSERT_PRE_NON_NULL() */
100 # define BT_ASSERT_PRE_DEV_NON_NULL(_obj_id, _obj, _obj_name) \
101 BT_ASSERT_PRE_NON_NULL(_obj_id, (_obj), (_obj_name))
102
103 /*
104 * Developer mode: asserts that a given object `_obj` named `_obj_name`
105 * (capitalized) and having the ID `_obj_id` (within the function's
106 * context) is NOT frozen.
107 *
108 * This macro checks the `frozen` field of `_obj`.
109 *
110 * This currently only exists in developer mode because some freezing
111 * functions can be called on the fast path, so they too are only
112 * enabled in developer mode.
113 */
114 # define BT_ASSERT_PRE_DEV_HOT_FROM_FUNC(_func, _obj_id, _obj, _obj_name, _fmt, ...) \
115 BT_ASSERT_PRE_FROM_FUNC(_func, "not-frozen:" _obj_id, \
116 !(_obj)->frozen, "%s is frozen" _fmt, _obj_name, ##__VA_ARGS__)
117
118 # define BT_ASSERT_PRE_DEV_HOT(_obj_id, _obj, _obj_name, _fmt, ...) \
119 BT_ASSERT_PRE_DEV_HOT_FROM_FUNC(__func__, _obj_id, (_obj), \
120 _obj_name, _fmt, ##__VA_ARGS__)
121
122 /* Developer mode version of BT_ASSERT_PRE_VALID_INDEX_FROM_FUNC() */
123 # define BT_ASSERT_PRE_DEV_VALID_INDEX_FROM_FUNC(_func, _index, _length) \
124 BT_ASSERT_PRE_VALID_INDEX_FROM_FUNC(_func, (_index), (_length))
125
126 /* Developer mode version of BT_ASSERT_PRE_VALID_INDEX() */
127 # define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length) \
128 BT_ASSERT_PRE_VALID_INDEX((_index), (_length))
129
130 /* Developer mode version of BT_ASSERT_PRE_NO_ERROR_FROM_FUNC(). */
131 # define BT_ASSERT_PRE_DEV_NO_ERROR_FROM_FUNC(_func) \
132 BT_ASSERT_PRE_NO_ERROR_FROM_FUNC(_func)
133
134 /* Developer mode version of BT_ASSERT_PRE_NO_ERROR(). */
135 # define BT_ASSERT_PRE_DEV_NO_ERROR() BT_ASSERT_PRE_NO_ERROR()
136
137 /*
138 * Developer mode version of
139 * BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS().
140 */
141 # define BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS(_func, _status) \
142 BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(_func, (_status))
143
144 /* Developer mode version of BT_ASSERT_POST_NO_ERROR(). */
145 # define BT_ASSERT_POST_DEV_NO_ERROR(_func) \
146 BT_ASSERT_POST_NO_ERROR(_func)
147
148 /*
149 * Marks a function as being only used within a BT_ASSERT_PRE_DEV() or
150 * BT_ASSERT_POST_DEV() context.
151 */
152 # define BT_ASSERT_COND_DEV_FUNC
153 #else
154 # define BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, _obj_id, _obj, _obj_name) \
155 BT_USE_EXPR4(_func, _obj_id, (_obj), _obj_name)
156
157 # define BT_ASSERT_PRE_DEV_NON_NULL(_obj_id, _obj, _obj_name) \
158 BT_USE_EXPR3(_obj_id, (_obj), _obj_name)
159
160 # define BT_ASSERT_PRE_DEV_HOT_FROM_FUNC(_func, _obj_id, _obj, _obj_name, _fmt, ...) \
161 BT_USE_EXPR5(_func, _obj_id, (_obj), _obj_name, _fmt)
162
163 # define BT_ASSERT_PRE_DEV_HOT(_obj_id, _obj, _obj_name, _fmt, ...) \
164 BT_USE_EXPR4(_obj_id, (_obj), _obj_name, _fmt)
165
166 # define BT_ASSERT_PRE_DEV_VALID_INDEX_FROM_FUNC(_func, _index, _length) \
167 BT_USE_EXPR3(_func, (_index), (_length))
168
169 # define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length) \
170 BT_USE_EXPR2((_index), (_length))
171
172 # define BT_ASSERT_PRE_DEV_NO_ERROR_FROM_FUNC(_func) \
173 BT_USE_EXPR(_func)
174
175 # define BT_ASSERT_PRE_DEV_NO_ERROR()
176
177 # define BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS(_func, _status) \
178 BT_USE_EXPR2(_func, _status)
179
180 # define BT_ASSERT_POST_DEV_NO_ERROR(_func) \
181 BT_USE_EXPR(_func)
182 #endif /* BT_DEV_MODE */
183
184 #define _BT_ASSERT_PRE_CLK_CLS_NAME "Clock class"
185 #define _BT_ASSERT_PRE_CLK_CLS_ID "clock-class"
186
187 #define BT_ASSERT_PRE_CLK_CLS_NON_NULL(_cc) \
188 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_CLK_CLS_ID, (_cc), \
189 _BT_ASSERT_PRE_CLK_CLS_NAME)
190
191 #define BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(_cc) \
192 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_CLK_CLS_ID, (_cc), \
193 _BT_ASSERT_PRE_CLK_CLS_NAME)
194
195 #define _BT_ASSERT_PRE_DEF_CLK_CLS_NAME "Default clock class"
196 #define _BT_ASSERT_PRE_DEF_CLK_CLS_ID "default-clock-class"
197
198 #define BT_ASSERT_PRE_DEF_CLK_CLS_NON_NULL(_cc) \
199 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_DEF_CLK_CLS_ID, (_cc), \
200 _BT_ASSERT_PRE_DEF_CLK_CLS_NAME)
201
202 #define BT_ASSERT_PRE_DEV_DEF_CLK_CLS_NON_NULL(_cc) \
203 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_DEF_CLK_CLS_ID, \
204 (_cc), _BT_ASSERT_PRE_DEF_CLK_CLS_NAME)
205
206 #define _BT_ASSERT_PRE_CS_NAME "Clock snapshot"
207 #define _BT_ASSERT_PRE_CS_ID "clock-snapshot"
208
209 #define BT_ASSERT_PRE_CS_NON_NULL(_cs) \
210 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_CS_ID, (_cs), \
211 _BT_ASSERT_PRE_CS_NAME)
212
213 #define BT_ASSERT_PRE_DEV_CS_NON_NULL(_cs) \
214 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_CS_ID, (_cs), \
215 _BT_ASSERT_PRE_CS_NAME)
216
217 #define _BT_ASSERT_PRE_EVENT_NAME "Event"
218 #define _BT_ASSERT_PRE_EVENT_ID "event"
219
220 #define BT_ASSERT_PRE_EVENT_NON_NULL(_event) \
221 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_EVENT_ID, (_event), \
222 _BT_ASSERT_PRE_EVENT_NAME)
223
224 #define BT_ASSERT_PRE_DEV_EVENT_NON_NULL(_event) \
225 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_EVENT_ID, (_event), \
226 _BT_ASSERT_PRE_EVENT_NAME)
227
228 #define _BT_ASSERT_PRE_EC_NAME "Event class"
229 #define _BT_ASSERT_PRE_EC_ID "event-class"
230
231 #define BT_ASSERT_PRE_EC_NON_NULL_FROM_FUNC(_func, _ec) \
232 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _BT_ASSERT_PRE_EC_ID, \
233 (_ec), _BT_ASSERT_PRE_EC_NAME)
234
235 #define BT_ASSERT_PRE_EC_NON_NULL(_ec) \
236 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_EC_ID, (_ec), \
237 _BT_ASSERT_PRE_EC_NAME)
238
239 #define BT_ASSERT_PRE_DEV_EC_NON_NULL_FROM_FUNC(_func, _ec) \
240 BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \
241 _BT_ASSERT_PRE_EC_ID, (_ec), _BT_ASSERT_PRE_EC_NAME)
242
243 #define BT_ASSERT_PRE_DEV_EC_NON_NULL(_ec) \
244 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_EC_ID, (_ec), \
245 _BT_ASSERT_PRE_EC_NAME)
246
247 #define _BT_ASSERT_PRE_FC_IS_INT_COND(_fc) \
248 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
249 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || \
250 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION || \
251 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION)
252
253 #define _BT_ASSERT_PRE_FC_IS_INT_FMT(_name) \
254 _name " is not an integer field class: %![fc-]+F"
255
256 #define _BT_ASSERT_PRE_FC_IS_INT_ID(_fc_id) "is-int-field-class:" _fc_id
257
258 #define _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_COND(_fc) \
259 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
260 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION)
261
262 #define _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_FMT(_name) \
263 _name " is not an unsigned integer field class: %![fc-]+F"
264
265 #define _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_ID(_fc_id) \
266 "is-unsigned-integer-field-class:" _fc_id
267
268 #define _BT_ASSERT_PRE_FC_IS_SIGNED_INT_COND(_fc) \
269 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || \
270 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION)
271
272 #define _BT_ASSERT_PRE_FC_IS_SIGNED_INT_FMT(_name) \
273 _name " is not a signed integer field class: %![fc-]+F"
274
275 #define _BT_ASSERT_PRE_FC_IS_SIGNED_INT_ID(_fc_id) \
276 "is-signed-integer-field-class:" _fc_id
277
278 #define _BT_ASSERT_PRE_FC_IS_ENUM_COND(_fc) \
279 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION || \
280 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION)
281
282 #define _BT_ASSERT_PRE_FC_IS_ENUM_FMT(_name) \
283 _name " is not an enumeration field class: %![fc-]+F"
284
285 #define _BT_ASSERT_PRE_FC_IS_ENUM_ID(_fc_id) \
286 "is-enumeration-field-class:" _fc_id
287
288 #define _BT_ASSERT_PRE_FC_IS_ARRAY_COND(_fc) \
289 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY || \
290 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD || \
291 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD)
292
293 #define _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name) \
294 _name " is not an array field class: %![fc-]+F"
295
296 #define _BT_ASSERT_PRE_FC_IS_ARRAY_ID(_fc_id) \
297 "is-array-field-class:" _fc_id
298
299 #define _BT_ASSERT_PRE_FC_IS_OPTION_COND(_fc) \
300 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD || \
301 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD || \
302 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD || \
303 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD)
304
305 #define _BT_ASSERT_PRE_FC_IS_OPTION_FMT(_name) \
306 _name " is not an option field class: %![fc-]+F"
307
308 #define _BT_ASSERT_PRE_FC_IS_OPTION_ID(_fc_id) \
309 "is-option-field-class:" _fc_id
310
311 #define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_COND(_fc) \
312 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD || \
313 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD || \
314 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD)
315
316 #define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_FMT(_name) \
317 _name " is not an option field class with a selector: %![fc-]+F"
318
319 #define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_ID(_fc_id) \
320 "is-option-field-class-with-selector:" _fc_id
321
322 #define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_COND(_fc) \
323 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD || \
324 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD)
325
326 #define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_FMT(_name) \
327 _name " is not an option field class with an integer selector: %![fc-]+F"
328
329 #define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_ID(_fc_id) \
330 "is-option-field-class-with-integer-selector:" _fc_id
331
332 #define _BT_ASSERT_PRE_FC_IS_STRUCT_FMT(_name) \
333 _name " is not a structure field class: %![fc-]+F"
334
335 #define _BT_ASSERT_PRE_FC_IS_STRUCT_COND(_fc) \
336 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_STRUCTURE)
337
338 #define _BT_ASSERT_PRE_FC_IS_STRUCT_ID(_fc_id) \
339 "is-structure-field-class:" _fc_id
340
341 #define _BT_ASSERT_PRE_FC_IS_VARIANT_COND(_fc) \
342 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD || \
343 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD || \
344 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD)
345
346 #define _BT_ASSERT_PRE_FC_IS_VARIANT_FMT(_name) \
347 _name " is not a variant field class: %![fc-]+F"
348
349 #define _BT_ASSERT_PRE_FC_IS_VARIANT_ID(_fc_id) \
350 "is-variant-field-class:" _fc_id
351
352 #define _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_COND(_fc) \
353 (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD || \
354 ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD)
355
356 #define _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_FMT(_name) \
357 _name " is not a variant field class with a selector: %![fc-]+F"
358
359 #define _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_ID(_fc_id) \
360 "is-variant-field-class-with-selector:" _fc_id
361
362 #define _BT_ASSERT_PRE_FC_IS_BLOB_ID(_fc_id) \
363 "is-blob-field-class:" _fc_id
364
365 #define _BT_ASSERT_PRE_FC_IS_BLOB_COND(_fc) \
366 bt_field_class_type_is((_fc)->type, BT_FIELD_CLASS_TYPE_BLOB)
367
368 #define _BT_ASSERT_PRE_FC_IS_BLOB_FMT(_name) \
369 _name " is not a BLOB field class: %![fc-]+F"
370
371 #define _BT_ASSERT_PRE_FC_HAS_TYPE_COND(_fc, _type) \
372 (((const struct bt_field_class *) (_fc))->type == (_type))
373
374 #define _BT_ASSERT_PRE_FC_HAS_TYPE_FMT(_name) \
375 _name " has the wrong type: expected-type=%s, %![fc-]+F"
376
377 #define _BT_ASSERT_PRE_FC_HAS_TYPE_ID(_fc_id, _type_id) \
378 "is-" _type_id ":" _fc_id
379
380 #define BT_ASSERT_PRE_FC_IS_INT_FROM_FUNC(_func, _fc_id, _fc, _name) \
381 BT_ASSERT_PRE_FROM_FUNC(_func, \
382 _BT_ASSERT_PRE_FC_IS_INT_ID(_fc_id), \
383 _BT_ASSERT_PRE_FC_IS_INT_COND(_fc), \
384 _BT_ASSERT_PRE_FC_IS_INT_FMT(_name), (_fc))
385
386 #define BT_ASSERT_PRE_FC_IS_INT(_fc_id, _fc, _name) \
387 BT_ASSERT_PRE_FC_IS_INT_FROM_FUNC(__func__, _fc_id, (_fc), _name)
388
389 #define BT_ASSERT_PRE_FC_IS_UNSIGNED_INT(_fc_id, _fc, _name) \
390 BT_ASSERT_PRE( \
391 _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_ID(_fc_id), \
392 _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_COND(_fc), \
393 _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_FMT(_name), (_fc))
394
395 #define BT_ASSERT_PRE_FC_IS_SIGNED_INT(_fc_id, _fc, _name) \
396 BT_ASSERT_PRE( \
397 _BT_ASSERT_PRE_FC_IS_SIGNED_INT_ID(_fc_id), \
398 _BT_ASSERT_PRE_FC_IS_SIGNED_INT_COND(_fc), \
399 _BT_ASSERT_PRE_FC_IS_SIGNED_INT_FMT(_name), (_fc))
400
401 #define BT_ASSERT_PRE_FC_IS_ENUM(_fc_id, _fc, _name) \
402 BT_ASSERT_PRE( \
403 _BT_ASSERT_PRE_FC_IS_ENUM_ID(_fc_id), \
404 _BT_ASSERT_PRE_FC_IS_ENUM_COND(_fc), \
405 _BT_ASSERT_PRE_FC_IS_ENUM_FMT(_name), (_fc))
406
407 #define BT_ASSERT_PRE_FC_IS_ARRAY(_fc_id, _fc, _name) \
408 BT_ASSERT_PRE( \
409 _BT_ASSERT_PRE_FC_IS_ARRAY_ID(_fc_id), \
410 _BT_ASSERT_PRE_FC_IS_ARRAY_COND(_fc), \
411 _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name), (_fc))
412
413 #define BT_ASSERT_PRE_FC_IS_STRUCT(_fc_id, _fc, _name) \
414 BT_ASSERT_PRE( \
415 _BT_ASSERT_PRE_FC_IS_STRUCT_ID(_fc_id), \
416 _BT_ASSERT_PRE_FC_IS_STRUCT_COND(_fc), \
417 _BT_ASSERT_PRE_FC_IS_STRUCT_FMT(_name), (_fc))
418
419 #define BT_ASSERT_PRE_FC_IS_OPTION(_fc_id, _fc, _name) \
420 BT_ASSERT_PRE( \
421 _BT_ASSERT_PRE_FC_IS_OPTION_ID(_fc_id), \
422 _BT_ASSERT_PRE_FC_IS_OPTION_COND(_fc), \
423 _BT_ASSERT_PRE_FC_IS_OPTION_FMT(_name), (_fc))
424
425 #define BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL(_fc_id, _fc, _name) \
426 BT_ASSERT_PRE( \
427 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_ID(_fc_id), \
428 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_COND(_fc), \
429 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_FMT(_name), (_fc))
430
431 #define BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL(_fc_id, _fc, _name) \
432 BT_ASSERT_PRE( \
433 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_ID(_fc_id), \
434 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_COND(_fc), \
435 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_FMT(_name), (_fc))
436
437 #define BT_ASSERT_PRE_FC_IS_VARIANT(_fc_id, _fc, _name) \
438 BT_ASSERT_PRE( \
439 _BT_ASSERT_PRE_FC_IS_VARIANT_ID(_fc_id), \
440 _BT_ASSERT_PRE_FC_IS_VARIANT_COND(_fc), \
441 _BT_ASSERT_PRE_FC_IS_VARIANT_FMT(_name), (_fc))
442
443 #define BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL(_fc_id, _fc, _name) \
444 BT_ASSERT_PRE( \
445 _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_ID(_fc_id), \
446 _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_COND(_fc), \
447 _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_FMT(_name), (_fc))
448
449 #define BT_ASSERT_PRE_FC_IS_BLOB(_fc_id, _fc, _name) \
450 BT_ASSERT_PRE( \
451 _BT_ASSERT_PRE_FC_IS_BLOB_ID(_fc_id), \
452 _BT_ASSERT_PRE_FC_IS_BLOB_COND(_fc), \
453 _BT_ASSERT_PRE_FC_IS_BLOB_FMT(_name), (_fc))
454
455 #define BT_ASSERT_PRE_FC_HAS_TYPE_FROM_FUNC(_func, _fc_id, _fc, _type_id, _type, _name) \
456 BT_ASSERT_PRE_FROM_FUNC(_func, \
457 _BT_ASSERT_PRE_FC_HAS_TYPE_ID(_fc_id, _type_id), \
458 _BT_ASSERT_PRE_FC_HAS_TYPE_COND((_fc), (_type)), \
459 _BT_ASSERT_PRE_FC_HAS_TYPE_FMT(_name), \
460 bt_common_field_class_type_string(_type), (_fc))
461
462 #define BT_ASSERT_PRE_FC_HAS_TYPE(_fc_id, _fc, _type_id, _type, _name) \
463 BT_ASSERT_PRE_FC_HAS_TYPE_FROM_FUNC(__func__, _fc_id, (_fc), \
464 _type_id, (_type), _name)
465
466 #define BT_ASSERT_PRE_DEV_FC_IS_INT(_fc_id, _fc, _name) \
467 BT_ASSERT_PRE_DEV( \
468 _BT_ASSERT_PRE_FC_IS_INT_ID(_fc_id), \
469 _BT_ASSERT_PRE_FC_IS_INT_COND(_fc), \
470 _BT_ASSERT_PRE_FC_IS_INT_FMT(_name), (_fc))
471
472 #define BT_ASSERT_PRE_DEV_FC_IS_UNSIGNED_INT(_fc_id, _fc, _name) \
473 BT_ASSERT_PRE_DEV( \
474 _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_ID(_fc_id), \
475 _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_COND(_fc), \
476 _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_FMT(_name), (_fc))
477
478 #define BT_ASSERT_PRE_DEV_FC_IS_SIGNED_INT(_fc_id, _fc, _name) \
479 BT_ASSERT_PRE_DEV( \
480 _BT_ASSERT_PRE_FC_IS_SIGNED_INT_ID(_fc_id), \
481 _BT_ASSERT_PRE_FC_IS_SIGNED_INT_COND(_fc), \
482 _BT_ASSERT_PRE_FC_IS_SIGNED_INT_FMT(_name), (_fc))
483
484 #define BT_ASSERT_PRE_DEV_FC_IS_ENUM(_fc_id, _fc, _name) \
485 BT_ASSERT_PRE_DEV( \
486 _BT_ASSERT_PRE_FC_IS_ENUM_ID(_fc_id), \
487 _BT_ASSERT_PRE_FC_IS_ENUM_COND(_fc), \
488 _BT_ASSERT_PRE_FC_IS_ENUM_FMT(_name), (_fc))
489
490 #define BT_ASSERT_PRE_DEV_FC_IS_ARRAY(_fc_id, _fc, _name) \
491 BT_ASSERT_PRE_DEV( \
492 _BT_ASSERT_PRE_FC_IS_ARRAY_ID(_fc_id), \
493 _BT_ASSERT_PRE_FC_IS_ARRAY_COND(_fc), \
494 _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name), (_fc))
495
496 #define BT_ASSERT_PRE_DEV_FC_IS_STRUCT(_fc_id, _fc, _name) \
497 BT_ASSERT_PRE_DEV( \
498 _BT_ASSERT_PRE_FC_IS_STRUCT_ID(_fc_id), \
499 _BT_ASSERT_PRE_FC_IS_STRUCT_COND(_fc), \
500 _BT_ASSERT_PRE_FC_IS_STRUCT_FMT(_name), (_fc))
501
502 #define BT_ASSERT_PRE_DEV_FC_IS_OPTION(_fc_id, _fc, _name) \
503 BT_ASSERT_PRE_DEV( \
504 _BT_ASSERT_PRE_FC_IS_OPTION_ID(_fc_id), \
505 _BT_ASSERT_PRE_FC_IS_OPTION_COND(_fc), \
506 _BT_ASSERT_PRE_FC_IS_OPTION_FMT(_name), (_fc))
507
508 #define BT_ASSERT_PRE_DEV_FC_IS_OPTION_WITH_SEL(_fc_id, _fc, _name) \
509 BT_ASSERT_PRE_DEV( \
510 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_COND(_fc), \
511 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_FMT(_name), (_fc))
512
513 #define BT_ASSERT_PRE_DEV_FC_IS_OPTION_WITH_INT_SEL(_fc_id, _fc, _name) \
514 BT_ASSERT_PRE_DEV( \
515 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_ID(_fc_id), \
516 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_COND(_fc), \
517 _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_FMT(_name), (_fc))
518
519 #define BT_ASSERT_PRE_DEV_FC_IS_VARIANT(_fc_id, _fc, _name) \
520 BT_ASSERT_PRE_DEV( \
521 _BT_ASSERT_PRE_FC_IS_VARIANT_ID(_fc_id), \
522 _BT_ASSERT_PRE_FC_IS_VARIANT_COND(_fc), \
523 _BT_ASSERT_PRE_FC_IS_VARIANT_FMT(_name), (_fc))
524
525 #define BT_ASSERT_PRE_DEV_FC_IS_VARIANT_WITH_SEL(_fc_id, _fc, _name) \
526 BT_ASSERT_PRE_DEV( \
527 _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_ID(_fc_id), \
528 _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_COND(_fc), \
529 _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_FMT(_name), (_fc))
530
531 #define BT_ASSERT_PRE_DEV_FC_HAS_TYPE(_fc_id, _fc, _type_id, _type, _name) \
532 BT_ASSERT_PRE_DEV( \
533 _BT_ASSERT_PRE_FC_HAS_TYPE_ID(_fc_id, _type_id), \
534 _BT_ASSERT_PRE_FC_HAS_TYPE_COND((_fc), (_type)), \
535 _BT_ASSERT_PRE_FC_HAS_TYPE_FMT(_name), \
536 bt_common_field_class_type_string(_type), (_fc))
537
538 #define BT_ASSERT_PRE_DEV_FC_HOT_FROM_FUNC(_func, _fc) \
539 BT_ASSERT_PRE_DEV_HOT_FROM_FUNC(_func, "field-class", \
540 (const struct bt_field_class *) (_fc), \
541 "Field class", ": %!+F", (_fc))
542
543 #define BT_ASSERT_PRE_DEV_FC_HOT(_fc) \
544 BT_ASSERT_PRE_DEV_FC_HOT_FROM_FUNC(__func__, (_fc))
545
546 #define _BT_ASSERT_PRE_FC_NAME "Field class"
547 #define _BT_ASSERT_PRE_FC_ID "field-class"
548
549 #define BT_ASSERT_PRE_FC_NON_NULL(_fc) \
550 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_FC_ID, (_fc), \
551 _BT_ASSERT_PRE_FC_NAME)
552
553 #define _BT_ASSERT_PRE_SELECTOR_FC_NAME "Selector field class"
554 #define _BT_ASSERT_PRE_SELECTOR_FC_ID "selector-field-class"
555
556 #define BT_ASSERT_PRE_SELECTOR_FC_NON_NULL(_fc) \
557 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_SELECTOR_FC_ID, (_fc), \
558 _BT_ASSERT_PRE_SELECTOR_FC_NAME)
559
560 #define BT_ASSERT_PRE_DEV_FC_NON_NULL(_fc) \
561 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_FC_ID, (_fc), \
562 _BT_ASSERT_PRE_FC_NAME)
563
564 #define _BT_ASSERT_PRE_STRUCT_FC_MEMBER_NAME "Structure field class member"
565 #define _BT_ASSERT_PRE_STRUCT_FC_MEMBER_ID "structure-field-class-member"
566
567 #define BT_ASSERT_PRE_STRUCT_FC_MEMBER_NON_NULL(_fc) \
568 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_STRUCT_FC_MEMBER_ID, \
569 (_fc), _BT_ASSERT_PRE_STRUCT_FC_MEMBER_NAME)
570
571 #define BT_ASSERT_PRE_DEV_STRUCT_FC_MEMBER_NON_NULL(_fc) \
572 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_STRUCT_FC_MEMBER_ID, \
573 (_fc), _BT_ASSERT_PRE_STRUCT_FC_MEMBER_NAME)
574
575 #define _BT_ASSERT_PRE_VAR_FC_OPT_NAME "Variant field class option"
576 #define _BT_ASSERT_PRE_VAR_FC_OPT_ID "variant-field-class-option-id"
577
578 #define BT_ASSERT_PRE_VAR_FC_OPT_NON_NULL(_fc) \
579 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_VAR_FC_OPT_ID, (_fc), \
580 _BT_ASSERT_PRE_VAR_FC_OPT_NAME)
581
582 #define BT_ASSERT_PRE_DEV_VAR_FC_OPT_NON_NULL(_fc) \
583 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_VAR_FC_OPT_ID, (_fc), \
584 _BT_ASSERT_PRE_VAR_FC_OPT_NAME)
585
586 /* Field location */
587 #define _BT_ASSERT_PRE_FL_NAME "Field location"
588 #define _BT_ASSERT_PRE_FL_ID "field-location"
589
590 /* Asserts that `_fl` is non-NULL */
591 #define BT_ASSERT_PRE_FL_NON_NULL(_fl) \
592 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_FL_ID, (_fl), \
593 _BT_ASSERT_PRE_FL_NAME)
594
595 #define _BT_ASSERT_PRE_SELECTOR_FL_NAME "Selector field location"
596 #define _BT_ASSERT_PRE_SELECTOR_FL_ID "selector-field-location"
597
598 /* Asserts that `_fl` is non-NULL */
599 #define BT_ASSERT_PRE_SELECTOR_FL_NON_NULL(_fl) \
600 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_SELECTOR_FL_ID, (_fl), \
601 _BT_ASSERT_PRE_SELECTOR_FL_NAME)
602
603 #define _BT_ASSERT_PRE_LENGTH_FL_NAME "Length field location"
604 #define _BT_ASSERT_PRE_LENGTH_FL_ID "length-field-location"
605
606 /* Asserts that `_fl` is non-NULL */
607 #define BT_ASSERT_PRE_LENGTH_FL_NON_NULL(_fl) \
608 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_LENGTH_FL_ID, (_fl), \
609 _BT_ASSERT_PRE_LENGTH_FL_NAME)
610
611 #define _BT_ASSERT_PRE_FP_NAME "Field path"
612 #define _BT_ASSERT_PRE_FP_ID "field-path"
613
614 #define BT_ASSERT_PRE_FP_NON_NULL(_fp) \
615 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_FP_ID, (_fp), \
616 _BT_ASSERT_PRE_FP_NAME)
617
618 #define BT_ASSERT_PRE_DEV_FP_NON_NULL(_fp) \
619 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_FP_ID, (_fp), \
620 _BT_ASSERT_PRE_FP_NAME)
621
622 #define BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE_FROM_FUNC(_func, _field_id, _field, _cls_type_id, _cls_type, _name) \
623 BT_ASSERT_PRE_DEV_FROM_FUNC(_func, "is-" _cls_type_id ":" _field_id, \
624 ((const struct bt_field *) (_field))->class->type == (_cls_type), \
625 _name " has the wrong class type: expected-class-type=%s, " \
626 "%![field-]+f", \
627 bt_common_field_class_type_string(_cls_type), (_field))
628
629 #define BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(_field_id, _field, _cls_type_id, _cls_type, _name) \
630 BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE_FROM_FUNC(__func__, \
631 _field_id, (_field), _cls_type_id, _cls_type, _name)
632
633 #define BT_ASSERT_PRE_DEV_FIELD_IS_UNSIGNED_INT(_field_id, _field, _name) \
634 BT_ASSERT_PRE_DEV( \
635 "is-unsigned-integer-field:" _field_id, \
636 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
637 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, \
638 _name " is not an unsigned integer field: %![field-]+f", \
639 (_field))
640
641 #define BT_ASSERT_PRE_DEV_FIELD_IS_SIGNED_INT(_field_id, _field, _name) \
642 BT_ASSERT_PRE_DEV( \
643 "is-signed-integer-field:" _field_id, \
644 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || \
645 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, \
646 _name " is not a signed integer field: %![field-]+f", \
647 (_field))
648
649 #define BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY_FROM_FUNC(_func, _field_id, _field, _name) \
650 BT_ASSERT_PRE_DEV_FROM_FUNC(_func, \
651 "is-array-field:" _field_id, \
652 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY || \
653 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD || \
654 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD, \
655 _name " is not an array field: %![field-]+f", (_field))
656
657 #define BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY(_field_id, _field, _name) \
658 BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY_FROM_FUNC(__func__, _field_id, \
659 (_field), _name)
660
661 #define BT_ASSERT_PRE_DEV_FIELD_IS_DYNAMIC_ARRAY(_field_id, _field, _name) \
662 BT_ASSERT_PRE_DEV( \
663 "is-dynamic-array-field:" _field_id, \
664 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD || \
665 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD, \
666 _name " is not a dynamic array field: %![field-]+f", (_field))
667
668 #define BT_ASSERT_PRE_DEV_FIELD_IS_OPTION(_field_id, _field, _name) \
669 BT_ASSERT_PRE_DEV( \
670 "is-option-field:" _field_id, \
671 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD || \
672 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD || \
673 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD || \
674 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD, \
675 _name " is not an option field: %![field-]+f", (_field))
676
677 #define BT_ASSERT_PRE_DEV_FIELD_IS_VARIANT(_field_id, _field, _name) \
678 BT_ASSERT_PRE_DEV( \
679 "is-variant-field:" _field_id, \
680 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD || \
681 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD || \
682 ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD, \
683 _name " is not a variant field: %![field-]+f", (_field))
684
685 #define BT_ASSERT_PRE_DEV_FIELD_IS_BLOB(_field_id, _field, _name) \
686 BT_ASSERT_PRE_DEV( \
687 "is-blob-field:" _field_id, \
688 bt_field_class_type_is(_field->class->type, BT_FIELD_CLASS_TYPE_BLOB), \
689 _name "is not a BLOB field: %![field-]+f", (_field))
690
691 #define BT_ASSERT_PRE_DEV_FIELD_IS_DYNAMIC_BLOB(_field_id, _field, _name) \
692 BT_ASSERT_PRE_DEV( \
693 "is-dynamic-blob-field:" _field_id, \
694 bt_field_class_type_is(_field->class->type, BT_FIELD_CLASS_TYPE_DYNAMIC_BLOB), \
695 _name "is not a dynamic BLOB field: %![field-]+f", (_field))
696
697 #define BT_ASSERT_PRE_DEV_FIELD_IS_SET(_field_id, _field) \
698 BT_ASSERT_PRE_DEV("is-field-set:" _field_id, \
699 bt_field_is_set(_field), \
700 "Field is not set: %!+f", (_field))
701
702 #define _BT_ASSERT_PRE_FIELD_NAME "Field"
703 #define _BT_ASSERT_PRE_FIELD_ID "field"
704
705 #define BT_ASSERT_PRE_FIELD_NON_NULL(_field) \
706 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_FIELD_ID, (_field), \
707 _BT_ASSERT_PRE_FIELD_NAME)
708
709 #define BT_ASSERT_PRE_DEV_FIELD_NON_NULL_FROM_FUNC(_func, _field) \
710 BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \
711 _BT_ASSERT_PRE_FIELD_ID, (_field), \
712 _BT_ASSERT_PRE_FIELD_NAME)
713
714 #define BT_ASSERT_PRE_DEV_FIELD_NON_NULL(_field) \
715 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_FIELD_ID, (_field), \
716 _BT_ASSERT_PRE_FIELD_NAME)
717
718 #define _BT_ASSERT_PRE_PACKET_NAME "Packet"
719 #define _BT_ASSERT_PRE_PACKET_ID "packet"
720
721 #define BT_ASSERT_PRE_PACKET_NON_NULL_FROM_FUNC(_func, _packet) \
722 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \
723 _BT_ASSERT_PRE_PACKET_ID, (_packet), _BT_ASSERT_PRE_PACKET_NAME)
724
725 #define BT_ASSERT_PRE_PACKET_NON_NULL(_packet) \
726 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PACKET_ID, (_packet), \
727 _BT_ASSERT_PRE_PACKET_NAME)
728
729 #define BT_ASSERT_PRE_DEV_PACKET_NON_NULL_FROM_FUNC(_func, _packet) \
730 BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \
731 _BT_ASSERT_PRE_PACKET_ID, (_packet), _BT_ASSERT_PRE_PACKET_NAME)
732
733 #define BT_ASSERT_PRE_DEV_PACKET_NON_NULL(_packet) \
734 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PACKET_ID, (_packet), \
735 _BT_ASSERT_PRE_PACKET_NAME)
736
737 #define _BT_ASSERT_PRE_SC_NAME "Stream class"
738 #define _BT_ASSERT_PRE_SC_ID "stream-class"
739
740 #define BT_ASSERT_PRE_SC_NON_NULL(_sc) \
741 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_SC_ID, (_sc), \
742 _BT_ASSERT_PRE_SC_NAME)
743
744 #define BT_ASSERT_PRE_DEV_SC_NON_NULL(_sc) \
745 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_SC_ID, (_sc), \
746 _BT_ASSERT_PRE_SC_NAME)
747
748 #define _BT_ASSERT_PRE_STREAM_NAME "Stream"
749 #define _BT_ASSERT_PRE_STREAM_ID "stream"
750
751 #define BT_ASSERT_PRE_STREAM_NON_NULL_FROM_FUNC(_func, _stream) \
752 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \
753 _BT_ASSERT_PRE_STREAM_ID, (_stream), \
754 _BT_ASSERT_PRE_STREAM_NAME)
755
756 #define BT_ASSERT_PRE_STREAM_NON_NULL(_stream) \
757 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_STREAM_ID, (_stream), \
758 _BT_ASSERT_PRE_STREAM_NAME)
759
760 #define BT_ASSERT_PRE_DEV_STREAM_NON_NULL_FROM_FUNC(_func, _stream) \
761 BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \
762 _BT_ASSERT_PRE_STREAM_ID, (_stream), \
763 _BT_ASSERT_PRE_STREAM_NAME)
764
765 #define BT_ASSERT_PRE_DEV_STREAM_NON_NULL(_stream) \
766 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_STREAM_ID, (_stream), \
767 _BT_ASSERT_PRE_STREAM_NAME)
768
769 #define _BT_ASSERT_PRE_TC_NAME "Trace class"
770 #define _BT_ASSERT_PRE_TC_ID "trace-class"
771
772 #define BT_ASSERT_PRE_TC_NON_NULL_FROM_FUNC(_func, _tc) \
773 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _BT_ASSERT_PRE_TC_ID, \
774 (_tc), _BT_ASSERT_PRE_TC_NAME)
775
776 #define BT_ASSERT_PRE_TC_NON_NULL(_tc) \
777 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_TC_ID, (_tc), \
778 _BT_ASSERT_PRE_TC_NAME)
779
780 #define BT_ASSERT_PRE_DEV_TC_NON_NULL(_tc) \
781 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_TC_ID, (_tc), \
782 _BT_ASSERT_PRE_TC_NAME)
783
784 #define _BT_ASSERT_PRE_TRACE_NAME "Trace"
785 #define _BT_ASSERT_PRE_TRACE_ID "trace"
786
787 #define BT_ASSERT_PRE_TRACE_NON_NULL(_trace) \
788 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_TRACE_ID, (_trace), \
789 _BT_ASSERT_PRE_TRACE_NAME)
790
791 #define BT_ASSERT_PRE_DEV_TRACE_NON_NULL(_trace) \
792 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_TRACE_ID, (_trace), \
793 _BT_ASSERT_PRE_TRACE_NAME)
794
795 #define _BT_ASSERT_PRE_USER_ATTRS_NAME "User attributes value object"
796 #define _BT_ASSERT_PRE_USER_ATTRS_ID "user-attributes-value-object"
797
798 #define BT_ASSERT_PRE_USER_ATTRS_NON_NULL_FROM_FUNC(_func, _ua) \
799 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \
800 _BT_ASSERT_PRE_USER_ATTRS_ID, (_ua), \
801 _BT_ASSERT_PRE_USER_ATTRS_NAME)
802
803 #define BT_ASSERT_PRE_USER_ATTRS_NON_NULL(_ua) \
804 BT_ASSERT_PRE_USER_ATTRS_NON_NULL_FROM_FUNC(__func__, (_ua))
805
806 #define BT_ASSERT_PRE_DEV_USER_ATTRS_NON_NULL(_ua) \
807 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_USER_ATTRS_ID, (_ua), \
808 _BT_ASSERT_PRE_USER_ATTRS_NAME)
809
810 #define BT_ASSERT_PRE_USER_ATTRS_IS_MAP_FROM_FUNC(_func, _ua) \
811 BT_ASSERT_PRE_FROM_FUNC(_func, "is-map-value:user-attributes", \
812 (_ua)->type == BT_VALUE_TYPE_MAP, \
813 _BT_ASSERT_PRE_USER_ATTRS_NAME \
814 " object is not a map value object.")
815
816 #define BT_ASSERT_PRE_USER_ATTRS_IS_MAP(_ua) \
817 BT_ASSERT_PRE_USER_ATTRS_IS_MAP_FROM_FUNC(__func__, (_ua))
818
819 #define BT_ASSERT_COND_LISTENER_FUNC_NAME "Listener function"
820 #define BT_ASSERT_COND_LISTENER_FUNC_ID "listener-function"
821
822 #define BT_ASSERT_PRE_LISTENER_FUNC_NON_NULL(_listener_func) \
823 BT_ASSERT_PRE_NON_NULL(BT_ASSERT_COND_LISTENER_FUNC_ID, \
824 (_listener_func), BT_ASSERT_COND_LISTENER_FUNC_NAME)
825
826 #define BT_ASSERT_PRE_DEV_LISTENER_FUNC_NON_NULL(_listener_func) \
827 BT_ASSERT_PRE_DEV_NON_NULL(BT_ASSERT_COND_LISTENER_FUNC_ID, \
828 (_listener_func), BT_ASSERT_COND_LISTENER_FUNC_NAME)
829
830 #define _BT_ASSERT_PRE_MSG_ITER_NAME "Message iterator"
831 #define _BT_ASSERT_PRE_MSG_ITER_ID "message-iterator"
832
833 #define BT_ASSERT_PRE_MSG_ITER_NON_NULL_FROM_FUNC(_func, _msg_iter) \
834 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \
835 _BT_ASSERT_PRE_MSG_ITER_ID, (_msg_iter), \
836 _BT_ASSERT_PRE_MSG_ITER_NAME)
837
838 #define BT_ASSERT_PRE_MSG_ITER_NON_NULL(_msg_iter) \
839 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_MSG_ITER_ID, (_msg_iter), \
840 _BT_ASSERT_PRE_MSG_ITER_NAME)
841
842 #define BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL_FROM_FUNC(_func, _msg_iter) \
843 BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \
844 _BT_ASSERT_PRE_MSG_ITER_ID, \
845 (_msg_iter), _BT_ASSERT_PRE_MSG_ITER_NAME)
846
847 #define BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(_msg_iter) \
848 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_MSG_ITER_ID, \
849 (_msg_iter), _BT_ASSERT_PRE_MSG_ITER_NAME)
850
851 #define _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_COND(_sc) \
852 ((_sc)->default_clock_class)
853
854 #define _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_FMT \
855 "Message's stream's class has no default clock class: " \
856 "%![msg-]+n, %![sc-]+S"
857
858 #define _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_ID \
859 "message-stream-class-has-default-clock-class"
860
861 #define BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_FROM_FUNC(_func, _msg, _sc) \
862 BT_ASSERT_PRE_FROM_FUNC(_func, \
863 _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_ID, \
864 _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_COND(_sc), \
865 _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_FMT, \
866 (_msg), (_sc));
867
868 #define BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS(_msg, _sc) \
869 BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_FROM_FUNC(__func__, (_msg), (_sc))
870
871 #define BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS_FROM_FUNC(_func, _msg, _sc) \
872 BT_ASSERT_PRE_DEV_FROM_FUNC(_func, \
873 _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_ID, \
874 _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_COND(_sc), \
875 _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_FMT, \
876 (_msg), (_sc));
877
878 #define BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS(_msg, _sc) \
879 BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS_FROM_FUNC(__func__, (_msg), (_sc))
880
881 #define _BT_ASSERT_PRE_MSG_HAS_TYPE_COND(_msg, _type) \
882 (((struct bt_message *) (_msg))->type == (_type))
883
884 #define _BT_ASSERT_PRE_MSG_HAS_TYPE_FMT \
885 "Message has the wrong type: expected-type=%s, %![msg-]+n"
886
887 #define _BT_ASSERT_PRE_MSG_HAS_TYPE_ID(_msg_id, _type_id) \
888 "is-" _type_id "-message:" _msg_id
889
890 #define BT_ASSERT_PRE_MSG_HAS_TYPE(_msg_id, _msg, _type_id, _type) \
891 BT_ASSERT_PRE( \
892 _BT_ASSERT_PRE_MSG_HAS_TYPE_ID(_msg_id, _type_id), \
893 _BT_ASSERT_PRE_MSG_HAS_TYPE_COND((_msg), (_type)), \
894 _BT_ASSERT_PRE_MSG_HAS_TYPE_FMT, \
895 bt_common_message_type_string(_type), (_msg))
896
897 #define BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(_msg_id, _msg, _type_id, _type) \
898 BT_ASSERT_PRE_DEV( \
899 _BT_ASSERT_PRE_MSG_HAS_TYPE_ID(_msg_id, _type_id), \
900 _BT_ASSERT_PRE_MSG_HAS_TYPE_COND((_msg), (_type)), \
901 _BT_ASSERT_PRE_MSG_HAS_TYPE_FMT, \
902 bt_common_message_type_string(_type), (_msg))
903
904 #define _BT_ASSERT_PRE_MSG_NAME "Message"
905 #define _BT_ASSERT_PRE_MSG_ID "message"
906
907 #define BT_ASSERT_PRE_MSG_NON_NULL(_msg_iter) \
908 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_MSG_ID, (_msg_iter), \
909 _BT_ASSERT_PRE_MSG_NAME)
910
911 #define BT_ASSERT_PRE_DEV_MSG_NON_NULL(_msg_iter) \
912 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_MSG_ID, (_msg_iter), \
913 _BT_ASSERT_PRE_MSG_NAME)
914
915 #define BT_ASSERT_PRE_MSG_CS_BEGIN_LE_END(_msg_iter, _begin, _end) \
916 BT_ASSERT_PRE("beginning-default-clock-snapshot-lteq-end", \
917 (_begin) <= (_end), \
918 "Beginning default clock snapshot value is greater " \
919 "than end default clock snapshot value: " \
920 "cs-begin-val=%" PRIu64 ", cs-end-val=%" PRIu64 ", " \
921 "%![msg-iter-]+i", (_begin), (_end), _msg_iter);
922
923 #define BT_ASSERT_PRE_DEV_MSG_HOT(_msg) \
924 BT_ASSERT_PRE_DEV_HOT("message", (_msg), "Message", ": %!+n", (_msg));
925
926 #define _BT_ASSERT_PRE_MSG_ITER_CLS_NAME "Message iterator class"
927 #define _BT_ASSERT_PRE_MSG_ITER_CLS_ID "message-iterator-class"
928
929 #define BT_ASSERT_PRE_MSG_ITER_CLS_NON_NULL(_msg_iter_cls) \
930 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_MSG_ITER_CLS_ID, \
931 (_msg_iter_cls), _BT_ASSERT_PRE_MSG_ITER_CLS_NAME)
932
933 #define BT_ASSERT_PRE_DEV_MSG_ITER_CLS_NON_NULL(_msg_iter_cls) \
934 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_MSG_ITER_CLS_ID, \
935 (_msg_iter_cls), _BT_ASSERT_PRE_MSG_ITER_CLS_NAME)
936
937 #define _BT_ASSERT_PRE_COMP_CLS_NAME "Component class"
938 #define _BT_ASSERT_PRE_COMP_CLS_ID "component-class"
939
940 #define BT_ASSERT_PRE_COMP_CLS_NON_NULL_FROM_FUNC(_func, _comp_cls) \
941 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \
942 _BT_ASSERT_PRE_COMP_CLS_ID, (_comp_cls), \
943 _BT_ASSERT_PRE_COMP_CLS_NAME)
944
945 #define BT_ASSERT_PRE_COMP_CLS_NON_NULL(_comp_cls) \
946 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_COMP_CLS_ID, (_comp_cls), \
947 _BT_ASSERT_PRE_COMP_CLS_NAME)
948
949 #define BT_ASSERT_PRE_DEV_COMP_CLS_NON_NULL(_comp_cls) \
950 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_COMP_CLS_ID, \
951 (_comp_cls), _BT_ASSERT_PRE_COMP_CLS_NAME)
952
953 #define _BT_ASSERT_PRE_COMP_DESCR_SET_NAME "Component descriptor set"
954 #define _BT_ASSERT_PRE_COMP_DESCR_SET_ID "component-descriptor-set"
955
956 #define BT_ASSERT_PRE_COMP_DESCR_SET_NON_NULL(_comp_descr_set) \
957 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_COMP_DESCR_SET_ID, \
958 (_comp_descr_set), _BT_ASSERT_PRE_COMP_DESCR_SET_NAME)
959
960 #define BT_ASSERT_PRE_DEV_COMP_DESCR_SET_NON_NULL(_comp_descr_set) \
961 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_COMP_DESCR_SET_ID, \
962 (_comp_descr_set), _BT_ASSERT_PRE_COMP_DESCR_SET_NAME)
963
964 #define _BT_ASSERT_PRE_COMP_NAME "Component"
965 #define _BT_ASSERT_PRE_COMP_ID "component"
966
967 #define BT_ASSERT_PRE_COMP_NON_NULL_FROM_FUNC(_func, _comp) \
968 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _BT_ASSERT_PRE_COMP_ID, \
969 (_comp), _BT_ASSERT_PRE_COMP_NAME)
970
971 #define BT_ASSERT_PRE_COMP_NON_NULL(_comp) \
972 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_COMP_ID, (_comp), \
973 _BT_ASSERT_PRE_COMP_NAME)
974
975 #define BT_ASSERT_PRE_DEV_COMP_NON_NULL_FROM_FUNC(_func, _comp) \
976 BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \
977 _BT_ASSERT_PRE_COMP_ID, (_comp), _BT_ASSERT_PRE_COMP_NAME)
978
979 #define BT_ASSERT_PRE_DEV_COMP_NON_NULL(_comp) \
980 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_COMP_ID, (_comp), \
981 _BT_ASSERT_PRE_COMP_NAME)
982
983 #define _BT_ASSERT_PRE_CONN_NAME "Connection"
984 #define _BT_ASSERT_PRE_CONN_ID "connection"
985
986 #define BT_ASSERT_PRE_CONN_NON_NULL(_conn) \
987 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_CONN_ID, (_conn), \
988 _BT_ASSERT_PRE_CONN_NAME)
989
990 #define BT_ASSERT_PRE_DEV_CONN_NON_NULL(_conn) \
991 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_CONN_ID, (_conn), \
992 _BT_ASSERT_PRE_CONN_NAME)
993
994 #define _BT_ASSERT_PRE_GRAPH_NAME "Graph"
995 #define _BT_ASSERT_PRE_GRAPH_ID "graph"
996
997 #define BT_ASSERT_PRE_GRAPH_NON_NULL_FROM_FUNC(_func, _graph) \
998 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \
999 _BT_ASSERT_PRE_GRAPH_ID, (_graph), _BT_ASSERT_PRE_GRAPH_NAME)
1000
1001 #define BT_ASSERT_PRE_GRAPH_NON_NULL(_graph) \
1002 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_GRAPH_ID, (_graph), \
1003 _BT_ASSERT_PRE_GRAPH_NAME)
1004
1005 #define BT_ASSERT_PRE_DEV_GRAPH_NON_NULL(_graph) \
1006 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_GRAPH_ID, (_graph), \
1007 _BT_ASSERT_PRE_GRAPH_NAME)
1008
1009 #define _BT_ASSERT_PRE_MIP_VERSION_VALID_ID "mip-version-is-valid"
1010
1011 /* Asserts that the MIP version `_mip_version` is equal to `_val`. */
1012 #define BT_ASSERT_PRE_MIP_VERSION_EQ(_mip_version, _val) \
1013 BT_ASSERT_PRE(_BT_ASSERT_PRE_MIP_VERSION_VALID_ID, \
1014 _mip_version == _val, \
1015 "MIP version is not equal to %" PRIu64, _val)
1016
1017 /* Asserts that the MIP version `_mip_version` is equal to `_val`. */
1018 #define BT_ASSERT_PRE_DEV_MIP_VERSION_EQ(_mip_version, _val) \
1019 BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_MIP_VERSION_VALID_ID, \
1020 _mip_version == _val, \
1021 "MIP version is not equal to %" PRIu64, _val)
1022
1023 /*
1024 * Asserts that the given MIP version `_mip_version` is greater than or equal
1025 * to `_val`.
1026 */
1027 #define BT_ASSERT_PRE_MIP_VERSION_GE(_mip_version, _val) \
1028 BT_ASSERT_PRE(_BT_ASSERT_PRE_MIP_VERSION_VALID_ID, \
1029 _mip_version >= _val, \
1030 "MIP version is less than %" PRIu64, _val)
1031
1032 /*
1033 * Asserts that the given MIP version `_mip_version` is greater than or equal
1034 * to `_val`.
1035 */
1036 #define BT_ASSERT_PRE_DEV_MIP_VERSION_GE(_mip_version, _val) \
1037 BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_MIP_VERSION_VALID_ID, \
1038 _mip_version >= _val, \
1039 "MIP version is less than %" PRIu64, _val)
1040
1041 /*
1042 * Asserts that the effective MIP version for `_clock_class` is equal to `_val`.
1043 */
1044 #define BT_ASSERT_PRE_CC_MIP_VERSION_EQ(_clock_class, _val) \
1045 BT_ASSERT_PRE_MIP_VERSION_EQ((_clock_class)->mip_version, _val)
1046
1047 /*
1048 * Asserts that the effective MIP version for `_clock_class` is greater than or
1049 * equal to `_val`.
1050 */
1051 #define BT_ASSERT_PRE_CC_MIP_VERSION_GE(_clock_class, _val) \
1052 BT_ASSERT_PRE_MIP_VERSION_GE((_clock_class)->mip_version, _val)
1053
1054 /*
1055 * Asserts that the effective MIP version for `_trace_class` is equal to `_val`.
1056 */
1057 #define BT_ASSERT_PRE_TC_MIP_VERSION_EQ(_trace_class, _val) \
1058 BT_ASSERT_PRE_MIP_VERSION_EQ((_trace_class)->mip_version, _val)
1059
1060 /*
1061 * Asserts that the effective MIP version for `_trace_class` is greater than or
1062 * equal to `_val`.
1063 */
1064 #define BT_ASSERT_PRE_TC_MIP_VERSION_GE(_trace_class, _val) \
1065 BT_ASSERT_PRE_MIP_VERSION_GE((_trace_class)->mip_version, _val)
1066
1067 /*
1068 * Asserts that the effective MIP version for `_trace` is greater than or
1069 * equal to `_val`.
1070 */
1071 #define BT_ASSERT_PRE_TRACE_MIP_VERSION_GE(_trace, _val) \
1072 BT_ASSERT_PRE_MIP_VERSION_GE((_trace)->class->mip_version, _val)
1073
1074 /*
1075 * Asserts that the effective MIP version for `_stream_class` is greater than or
1076 * equal to `_val`.
1077 */
1078 #define BT_ASSERT_PRE_SC_MIP_VERSION_GE(_stream_class, _val) \
1079 BT_ASSERT_PRE_TC_MIP_VERSION_GE( \
1080 bt_stream_class_borrow_trace_class_inline(_stream_class), \
1081 _val)
1082
1083 /*
1084 * Asserts that the effective MIP version for `_event_class` is greater than or
1085 * equal to `_val`.
1086 */
1087 #define BT_ASSERT_PRE_EC_MIP_VERSION_GE(_event_class, _val) \
1088 BT_ASSERT_PRE_SC_MIP_VERSION_GE( \
1089 bt_event_class_borrow_stream_class_inline(_event_class), \
1090 _val)
1091
1092 /*
1093 * Asserts that the effective MIP version for `_field_class` is equal to `_val`.
1094 */
1095 #define BT_ASSERT_PRE_FC_MIP_VERSION_EQ(_field_class, _val) \
1096 BT_ASSERT_PRE_MIP_VERSION_EQ((_field_class)->mip_version, _val)
1097
1098 /*
1099 * Asserts that the effective MIP version for `_field_class` is equal to `_val`.
1100 */
1101 #define BT_ASSERT_PRE_DEV_FC_MIP_VERSION_EQ(_field_class, _val) \
1102 BT_ASSERT_PRE_DEV_MIP_VERSION_EQ((_field_class)->mip_version, _val)
1103
1104 /*
1105 * Asserts that the effective MIP version for `_field_class` is greator than or
1106 * equal to `_val`.
1107 */
1108 #define BT_ASSERT_PRE_FC_MIP_VERSION_GE(_field_class, _val) \
1109 BT_ASSERT_PRE_MIP_VERSION_GE((_field_class)->mip_version, _val)
1110
1111 /*
1112 * Asserts that the effective MIP version for `_field_class` is greator than or
1113 * equal to `_val`.
1114 */
1115 #define BT_ASSERT_PRE_DEV_FC_MIP_VERSION_GE(_field_class, _val) \
1116 BT_ASSERT_PRE_DEV_MIP_VERSION_GE((_field_class)->mip_version, _val)
1117
1118 #define _BT_ASSERT_PRE_INTR_NAME "Interrupter"
1119 #define _BT_ASSERT_PRE_INTR_ID "interrupter"
1120
1121 #define BT_ASSERT_PRE_INTR_NON_NULL(_intr) \
1122 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_INTR_ID, (_intr), \
1123 _BT_ASSERT_PRE_INTR_NAME)
1124
1125 #define BT_ASSERT_PRE_DEV_INTR_NON_NULL(_intr) \
1126 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_INTR_ID, (_intr), \
1127 _BT_ASSERT_PRE_INTR_NAME)
1128
1129 #define _BT_ASSERT_PRE_PORT_NAME "Port"
1130 #define _BT_ASSERT_PRE_PORT_ID "port"
1131
1132 #define BT_ASSERT_PRE_PORT_NON_NULL(_port) \
1133 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PORT_ID, (_port), \
1134 _BT_ASSERT_PRE_PORT_NAME)
1135
1136 #define BT_ASSERT_PRE_DEV_PORT_NON_NULL(_port) \
1137 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PORT_ID, (_port), \
1138 _BT_ASSERT_PRE_PORT_NAME)
1139
1140 #define _BT_ASSERT_PRE_QUERY_EXEC_NAME "Query executor"
1141 #define _BT_ASSERT_PRE_QUERY_EXEC_ID "query-executor"
1142
1143 #define BT_ASSERT_PRE_QUERY_EXEC_NON_NULL(_query_exec) \
1144 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_QUERY_EXEC_ID, \
1145 (_query_exec), _BT_ASSERT_PRE_QUERY_EXEC_NAME)
1146
1147 #define BT_ASSERT_PRE_DEV_QUERY_EXEC_NON_NULL(_query_exec) \
1148 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_QUERY_EXEC_ID, \
1149 (_query_exec), _BT_ASSERT_PRE_QUERY_EXEC_NAME)
1150
1151 #define _BT_ASSERT_PRE_PLUGIN_SET_NAME "Plugin set"
1152 #define _BT_ASSERT_PRE_PLUGIN_SET_ID "plugin-set"
1153
1154 #define BT_ASSERT_PRE_PLUGIN_SET_NON_NULL(_plugin_set) \
1155 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PLUGIN_SET_ID, \
1156 (_plugin_set), _BT_ASSERT_PRE_PLUGIN_SET_NAME)
1157
1158 #define BT_ASSERT_PRE_DEV_PLUGIN_SET_NON_NULL(_plugin_set) \
1159 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PLUGIN_SET_ID, \
1160 (_plugin_set), _BT_ASSERT_PRE_PLUGIN_SET_NAME)
1161
1162 #define _BT_ASSERT_PRE_PLUGIN_SET_OUT_NAME \
1163 _BT_ASSERT_PRE_PLUGIN_SET_NAME " (output)"
1164 #define _BT_ASSERT_PRE_PLUGIN_SET_OUT_ID \
1165 _BT_ASSERT_PRE_PLUGIN_SET_ID "-output"
1166
1167 #define BT_ASSERT_PRE_PLUGIN_SET_OUT_NON_NULL(_plugin_set) \
1168 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PLUGIN_SET_OUT_ID, \
1169 (_plugin_set), _BT_ASSERT_PRE_PLUGIN_SET_OUT_NAME)
1170
1171 #define BT_ASSERT_PRE_DEV_PLUGIN_SET_OUT_NON_NULL(_plugin_set) \
1172 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PLUGIN_SET_OUT_ID, \
1173 (_plugin_set), _BT_ASSERT_PRE_PLUGIN_SET_OUT_NAME)
1174
1175 #define _BT_ASSERT_PRE_PLUGIN_NAME "Plugin"
1176 #define _BT_ASSERT_PRE_PLUGIN_ID "plugin"
1177
1178 #define BT_ASSERT_PRE_PLUGIN_NON_NULL(_plugin) \
1179 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PLUGIN_ID, (_plugin), \
1180 _BT_ASSERT_PRE_PLUGIN_NAME)
1181
1182 #define BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(_plugin) \
1183 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PLUGIN_ID, (_plugin), \
1184 _BT_ASSERT_PRE_PLUGIN_NAME)
1185
1186 #define _BT_ASSERT_PRE_PLUGIN_OUT_NAME \
1187 _BT_ASSERT_PRE_PLUGIN_NAME " (output)"
1188 #define _BT_ASSERT_PRE_PLUGIN_OUT_ID \
1189 _BT_ASSERT_PRE_PLUGIN_ID "-output"
1190
1191 #define BT_ASSERT_PRE_PLUGIN_OUT_NON_NULL(_plugin) \
1192 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PLUGIN_OUT_ID, (_plugin), \
1193 _BT_ASSERT_PRE_PLUGIN_OUT_NAME)
1194
1195 #define BT_ASSERT_PRE_DEV_PLUGIN_OUT_NON_NULL(_plugin) \
1196 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PLUGIN_OUT_ID, \
1197 (_plugin), _BT_ASSERT_PRE_PLUGIN_OUT_NAME)
1198
1199 #define _BT_ASSERT_PRE_ERROR_NAME "Error"
1200 #define _BT_ASSERT_PRE_ERROR_ID "error"
1201
1202 #define BT_ASSERT_PRE_ERROR_NON_NULL(_error) \
1203 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_ERROR_ID, (_error), \
1204 _BT_ASSERT_PRE_ERROR_NAME)
1205
1206 #define BT_ASSERT_PRE_DEV_ERROR_NON_NULL(_error) \
1207 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_ERROR_ID, (_error), \
1208 _BT_ASSERT_PRE_ERROR_NAME)
1209
1210 #define _BT_ASSERT_PRE_ERROR_CAUSE_NAME "Error cause"
1211 #define _BT_ASSERT_PRE_ERROR_CAUSE_ID "error-cause"
1212
1213 #define BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(_error_cause) \
1214 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_ERROR_CAUSE_ID, \
1215 (_error_cause), _BT_ASSERT_PRE_ERROR_CAUSE_NAME)
1216
1217 #define BT_ASSERT_PRE_DEV_ERROR_CAUSE_NON_NULL(_error_cause) \
1218 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_ERROR_CAUSE_ID, \
1219 (_error_cause), _BT_ASSERT_PRE_ERROR_CAUSE_NAME)
1220
1221 #define _BT_ASSERT_PRE_INT_RANGE_NAME "Integer range"
1222 #define _BT_ASSERT_PRE_INT_RANGE_ID "integer-range"
1223
1224 #define BT_ASSERT_PRE_INT_RANGE_NON_NULL(_int_range) \
1225 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_INT_RANGE_ID, \
1226 (_int_range), _BT_ASSERT_PRE_INT_RANGE_NAME)
1227
1228 #define BT_ASSERT_PRE_DEV_INT_RANGE_NON_NULL(_int_range) \
1229 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_INT_RANGE_ID, \
1230 (_int_range), _BT_ASSERT_PRE_INT_RANGE_NAME)
1231
1232 #define BT_ASSERT_PRE_INT_RANGE_SET_NOT_EMPTY_FROM_FUNC(_func, _range_set) \
1233 BT_ASSERT_PRE_FROM_FUNC(_func, "integer-range-set-is-not-empty", \
1234 (_range_set)->ranges->len > 0, \
1235 "Integer range set is empty: %!+R", (_range_set))
1236
1237 #define BT_ASSERT_PRE_INT_RANGE_SET_NOT_EMPTY(_range_set) \
1238 BT_ASSERT_PRE_INT_RANGE_SET_NOT_EMPTY_FROM_FUNC(__func__, \
1239 (_range_set))
1240
1241 #define _BT_ASSERT_PRE_INT_RANGE_SET_NAME "Integer range set"
1242 #define _BT_ASSERT_PRE_INT_RANGE_SET_ID "integer-range-set"
1243
1244 #define BT_ASSERT_PRE_INT_RANGE_SET_NON_NULL_FROM_FUNC(_func, _range_set) \
1245 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \
1246 _BT_ASSERT_PRE_INT_RANGE_SET_ID, (_range_set), \
1247 _BT_ASSERT_PRE_INT_RANGE_SET_NAME)
1248
1249 #define BT_ASSERT_PRE_INT_RANGE_SET_NON_NULL(_range_set) \
1250 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_INT_RANGE_SET_ID, \
1251 (_range_set), _BT_ASSERT_PRE_INT_RANGE_SET_NAME)
1252
1253 #define BT_ASSERT_PRE_DEV_INT_RANGE_SET_NON_NULL(_range_set) \
1254 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_INT_RANGE_SET_ID, \
1255 (_range_set), _BT_ASSERT_PRE_INT_RANGE_SET_NAME)
1256
1257 #define _BT_ASSERT_PRE_VALUE_HAS_TYPE_COND(_value, _type) \
1258 (((struct bt_value *) (_value))->type == (_type))
1259
1260 #define _BT_ASSERT_PRE_VALUE_HAS_TYPE_FMT \
1261 "Value has the wrong type: expected-type=%s, %![value-]+v"
1262
1263 #define _BT_ASSERT_PRE_VALUE_HAS_TYPE_ID(_value_id, _type_id) \
1264 "is-" _type_id "-value:" _value_id
1265
1266 #define BT_ASSERT_PRE_VALUE_HAS_TYPE_FROM_FUNC(_func, _value_id, _value, _type_id, _type) \
1267 BT_ASSERT_PRE_FROM_FUNC(_func, \
1268 _BT_ASSERT_PRE_VALUE_HAS_TYPE_ID(_value_id, _type_id), \
1269 _BT_ASSERT_PRE_VALUE_HAS_TYPE_COND((_value), (_type)), \
1270 _BT_ASSERT_PRE_VALUE_HAS_TYPE_FMT, \
1271 bt_common_value_type_string(_type), (_value))
1272
1273 #define BT_ASSERT_PRE_VALUE_HAS_TYPE(_value_id, _value, _type_id, _type) \
1274 BT_ASSERT_PRE_VALUE_HAS_TYPE_FROM_FUNC(__func__, _value_id, \
1275 (_value), _type_id, (_type));
1276
1277 #define BT_ASSERT_PRE_VALUE_IS_BOOL(_value) \
1278 BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \
1279 "boolean", BT_VALUE_TYPE_BOOL);
1280
1281 #define BT_ASSERT_PRE_VALUE_IS_UNSIGNED_INT(_value) \
1282 BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \
1283 "unsigned-int", BT_VALUE_TYPE_UNSIGNED_INTEGER);
1284
1285 #define BT_ASSERT_PRE_VALUE_IS_SIGNED_INT(_value) \
1286 BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \
1287 "signed-int", BT_VALUE_TYPE_SIGNED_INTEGER);
1288
1289 #define BT_ASSERT_PRE_VALUE_IS_REAL(_value) \
1290 BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \
1291 "real", BT_VALUE_TYPE_REAL);
1292
1293 #define BT_ASSERT_PRE_VALUE_IS_STRING(_value) \
1294 BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \
1295 "string", BT_VALUE_TYPE_STRING);
1296
1297 #define BT_ASSERT_PRE_VALUE_IS_ARRAY(_value) \
1298 BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \
1299 "array", BT_VALUE_TYPE_ARRAY);
1300
1301 #define BT_ASSERT_PRE_VALUE_IS_MAP_FROM_FUNC(_func, _value) \
1302 BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \
1303 "map", BT_VALUE_TYPE_MAP);
1304
1305 #define BT_ASSERT_PRE_VALUE_IS_MAP(_value) \
1306 BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \
1307 "map", BT_VALUE_TYPE_MAP);
1308
1309 #define BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(_value_id, _value, _type_id, _type) \
1310 BT_ASSERT_PRE_DEV( \
1311 _BT_ASSERT_PRE_VALUE_HAS_TYPE_ID(_value_id, _type_id), \
1312 _BT_ASSERT_PRE_VALUE_HAS_TYPE_COND((_value), (_type)), \
1313 _BT_ASSERT_PRE_VALUE_HAS_TYPE_FMT, \
1314 bt_common_value_type_string(_type), (_value))
1315
1316 #define BT_ASSERT_PRE_DEV_VALUE_IS_BOOL(_value) \
1317 BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \
1318 "boolean", BT_VALUE_TYPE_BOOL);
1319
1320 #define BT_ASSERT_PRE_DEV_VALUE_IS_UNSIGNED_INT(_value) \
1321 BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \
1322 "unsigned-int", BT_VALUE_TYPE_UNSIGNED_INTEGER);
1323
1324 #define BT_ASSERT_PRE_DEV_VALUE_IS_SIGNED_INT(_value) \
1325 BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \
1326 "signed-int", BT_VALUE_TYPE_SIGNED_INTEGER);
1327
1328 #define BT_ASSERT_PRE_DEV_VALUE_IS_REAL(_value) \
1329 BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \
1330 "real", BT_VALUE_TYPE_REAL);
1331
1332 #define BT_ASSERT_PRE_DEV_VALUE_IS_STRING(_value) \
1333 BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \
1334 "string", BT_VALUE_TYPE_STRING);
1335
1336 #define BT_ASSERT_PRE_DEV_VALUE_IS_ARRAY(_value) \
1337 BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \
1338 "array", BT_VALUE_TYPE_ARRAY);
1339
1340 #define BT_ASSERT_PRE_DEV_VALUE_IS_MAP(_value) \
1341 BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \
1342 "map", BT_VALUE_TYPE_MAP);
1343
1344 #define _BT_ASSERT_PRE_VALUE_NAME "Value object"
1345 #define _BT_ASSERT_PRE_VALUE_ID "value-object"
1346
1347 #define BT_ASSERT_PRE_VALUE_NON_NULL_FROM_FUNC(_func, _value) \
1348 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \
1349 _BT_ASSERT_PRE_VALUE_ID, (_value), _BT_ASSERT_PRE_VALUE_NAME)
1350
1351 #define BT_ASSERT_PRE_VALUE_NON_NULL(_value) \
1352 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_VALUE_ID, (_value), \
1353 _BT_ASSERT_PRE_VALUE_NAME)
1354
1355 #define BT_ASSERT_PRE_DEV_VALUE_NON_NULL_FROM_FUNC(_func, _value) \
1356 BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \
1357 _BT_ASSERT_PRE_VALUE_ID, (_value), _BT_ASSERT_PRE_VALUE_NAME)
1358
1359 #define BT_ASSERT_PRE_DEV_VALUE_NON_NULL(_value) \
1360 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_VALUE_ID, (_value), \
1361 _BT_ASSERT_PRE_VALUE_NAME)
1362
1363 #define BT_ASSERT_PRE_PARAM_VALUE_IS_MAP_FROM_FUNC(_func, _value) \
1364 BT_ASSERT_PRE_FROM_FUNC(_func, \
1365 "is-map-value:parameters-value-object", \
1366 !(_value) || bt_value_is_map(_value), \
1367 "Parameters value object is not a map value: %!+v", (_value));
1368
1369 #define BT_ASSERT_PRE_PARAM_VALUE_IS_MAP(_value) \
1370 BT_ASSERT_PRE_PARAM_VALUE_IS_MAP_FROM_FUNC(__func__, (_value))
1371
1372 #define _BT_ASSERT_PRE_RES_OUT_NAME "Result (output)"
1373 #define _BT_ASSERT_PRE_RES_OUT_ID "result-output"
1374
1375 #define BT_ASSERT_PRE_RES_OUT_NON_NULL(_res) \
1376 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_RES_OUT_ID, (_res), \
1377 _BT_ASSERT_PRE_RES_OUT_NAME)
1378
1379 #define BT_ASSERT_PRE_DEV_RES_OUT_NON_NULL(_res) \
1380 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_RES_OUT_ID, (_res), \
1381 _BT_ASSERT_PRE_RES_OUT_NAME)
1382
1383 #define BT_ASSERT_PRE_METHOD_NON_NULL(_method) \
1384 BT_ASSERT_PRE_NON_NULL("method", (_method), "Method");
1385
1386 #define _BT_ASSERT_PRE_NAME_NAME "Name"
1387 #define _BT_ASSERT_PRE_NAME_ID "name"
1388
1389 #define BT_ASSERT_PRE_NAME_NON_NULL_FROM_FUNC(_func, _name) \
1390 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _BT_ASSERT_PRE_NAME_ID, \
1391 (_name), _BT_ASSERT_PRE_NAME_NAME)
1392
1393 #define BT_ASSERT_PRE_NAME_NON_NULL(_name) \
1394 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_NAME_ID, (_name), \
1395 _BT_ASSERT_PRE_NAME_NAME)
1396
1397 #define BT_ASSERT_PRE_DEV_NAME_NON_NULL_FROM_FUNC(_func, _name) \
1398 BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \
1399 _BT_ASSERT_PRE_NAME_ID, (_name), _BT_ASSERT_PRE_NAME_NAME)
1400
1401 #define BT_ASSERT_PRE_DEV_NAME_NON_NULL(_name) \
1402 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_NAME_ID, (_name), \
1403 _BT_ASSERT_PRE_NAME_NAME)
1404
1405 #define _BT_ASSERT_PRE_NAMESPACE_NAME "Namespace"
1406 #define _BT_ASSERT_PRE_NAMESPACE_ID "namespace"
1407
1408 #define BT_ASSERT_PRE_NAMESPACE_NON_NULL(_namespace) \
1409 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_NAMESPACE_ID, (_namespace), \
1410 _BT_ASSERT_PRE_NAMESPACE_NAME)
1411
1412 #define _BT_ASSERT_PRE_DESCR_NAME "Description"
1413 #define _BT_ASSERT_PRE_DESCR_ID "description"
1414
1415 #define BT_ASSERT_PRE_DESCR_NON_NULL(_descr) \
1416 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_DESCR_ID, (_descr), \
1417 _BT_ASSERT_PRE_DESCR_NAME)
1418
1419 #define BT_ASSERT_PRE_DEV_DESCR_NON_NULL(_descr) \
1420 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_DESCR_ID, (_descr), \
1421 _BT_ASSERT_PRE_DESCR_NAME)
1422
1423 #define _BT_ASSERT_PRE_UUID_NAME "UUID"
1424 #define _BT_ASSERT_PRE_UUID_ID "uuid"
1425
1426 #define BT_ASSERT_PRE_UUID_NON_NULL(_uuid) \
1427 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_UUID_ID, (_uuid), \
1428 _BT_ASSERT_PRE_UUID_NAME)
1429
1430 #define BT_ASSERT_PRE_DEV_UUID_NON_NULL(_uuid) \
1431 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_UUID_ID, (_uuid), \
1432 _BT_ASSERT_PRE_UUID_NAME)
1433
1434 #define _BT_ASSERT_PRE_UID_NAME "Unique identifier"
1435 #define _BT_ASSERT_PRE_UID_ID "uid"
1436
1437 #define BT_ASSERT_PRE_UID_NON_NULL(_uid) \
1438 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_UID_ID, (_uid), \
1439 _BT_ASSERT_PRE_UID_NAME)
1440
1441 #define _BT_ASSERT_PRE_KEY_NAME "Key"
1442 #define _BT_ASSERT_PRE_KEY_ID "key"
1443
1444 #define BT_ASSERT_PRE_KEY_NON_NULL_FROM_FUNC(_func, _key) \
1445 BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _BT_ASSERT_PRE_KEY_ID, \
1446 (_key), _BT_ASSERT_PRE_KEY_NAME)
1447
1448 #define BT_ASSERT_PRE_KEY_NON_NULL(_key) \
1449 BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_KEY_ID, (_key), \
1450 _BT_ASSERT_PRE_KEY_NAME)
1451
1452 #define BT_ASSERT_PRE_DEV_KEY_NON_NULL(_key) \
1453 BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_KEY_ID, (_key), \
1454 _BT_ASSERT_PRE_KEY_NAME)
1455
1456 #endif /* BABELTRACE_LIB_ASSERT_COND_H */
This page took 0.055437 seconds and 5 git commands to generate.