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