| 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 | |
| 11 | #include "assert-cond-base.h" |
| 12 | |
| 13 | /* |
| 14 | * Asserts that a given variable `_obj` named `_obj_name` (capitalized) |
| 15 | * and having the ID `_obj_id` (within the function's context) is not |
| 16 | * `NULL`. |
| 17 | */ |
| 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), \ |
| 20 | "%s is NULL.", _obj_name) |
| 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) |
| 24 | |
| 25 | /* |
| 26 | * Asserts that a given index `_index` is less than a given length |
| 27 | * `_length`. |
| 28 | */ |
| 29 | #define BT_ASSERT_PRE_VALID_INDEX_FROM_FUNC(_func, _index, _length) \ |
| 30 | BT_ASSERT_PRE_FROM_FUNC(_func, "valid-index", (_index) < (_length), \ |
| 31 | "Index is out of bounds: index=%" PRIu64 ", " \ |
| 32 | "count=%" PRIu64, (uint64_t) (_index), (uint64_t) (_length)) |
| 33 | |
| 34 | #define BT_ASSERT_PRE_VALID_INDEX(_index, _length) \ |
| 35 | BT_ASSERT_PRE_VALID_INDEX_FROM_FUNC(__func__, (_index), (_length)) |
| 36 | |
| 37 | /* |
| 38 | * Asserts that the current thread has no error set. |
| 39 | */ |
| 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); \ |
| 49 | } while (0) |
| 50 | |
| 51 | #define BT_ASSERT_PRE_NO_ERROR() \ |
| 52 | BT_ASSERT_PRE_NO_ERROR_FROM_FUNC(__func__) |
| 53 | |
| 54 | /* |
| 55 | * Asserts that, if the current thread has an error, `_status` is an |
| 56 | * error status code. |
| 57 | * |
| 58 | * See _BT_ASSERT_COND() for details about the `_func` parameter. |
| 59 | * |
| 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 | */ |
| 63 | #define BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(_func, _status) \ |
| 64 | do { \ |
| 65 | const struct bt_error *_err = bt_current_thread_take_error(); \ |
| 66 | if (_err) { \ |
| 67 | bt_current_thread_move_error(_err); \ |
| 68 | } \ |
| 69 | BT_ASSERT_POST(_func, "no-error-if-no-error-status", \ |
| 70 | (_status) < 0 || !_err, \ |
| 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. |
| 78 | * |
| 79 | * See _BT_ASSERT_COND() for details about the `_func` parameter. |
| 80 | */ |
| 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) |
| 90 | |
| 91 | #ifdef BT_DEV_MODE |
| 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 | |
| 96 | /* Developer mode version of BT_ASSERT_PRE_NON_NULL() */ |
| 97 | # define BT_ASSERT_PRE_DEV_NON_NULL(_obj_id, _obj, _obj_name) \ |
| 98 | BT_ASSERT_PRE_NON_NULL(_obj_id, (_obj), (_obj_name)) |
| 99 | |
| 100 | /* |
| 101 | * Developer mode: asserts that a given object `_obj` named `_obj_name` |
| 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`. |
| 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 | */ |
| 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)) |
| 122 | |
| 123 | /* Developer mode version of BT_ASSERT_PRE_VALID_INDEX() */ |
| 124 | # define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length) \ |
| 125 | BT_ASSERT_PRE_VALID_INDEX((_index), (_length)) |
| 126 | |
| 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 | |
| 131 | /* Developer mode version of BT_ASSERT_PRE_NO_ERROR(). */ |
| 132 | # define BT_ASSERT_PRE_DEV_NO_ERROR() BT_ASSERT_PRE_NO_ERROR() |
| 133 | |
| 134 | /* |
| 135 | * Developer mode version of |
| 136 | * BT_ASSERT_POST_NO_ERROR_IF_NO_ERROR_STATUS(). |
| 137 | */ |
| 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)) |
| 140 | |
| 141 | /* Developer mode version of BT_ASSERT_POST_NO_ERROR(). */ |
| 142 | # define BT_ASSERT_POST_DEV_NO_ERROR(_func) \ |
| 143 | BT_ASSERT_POST_NO_ERROR(_func) |
| 144 | |
| 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 |
| 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) |
| 159 | |
| 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)) |
| 165 | |
| 166 | # define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length) \ |
| 167 | BT_USE_EXPR2((_index), (_length)) |
| 168 | |
| 169 | # define BT_ASSERT_PRE_DEV_NO_ERROR_FROM_FUNC(_func) \ |
| 170 | BT_USE_EXPR(_func) |
| 171 | |
| 172 | # define BT_ASSERT_PRE_DEV_NO_ERROR() |
| 173 | |
| 174 | # define BT_ASSERT_POST_DEV_NO_ERROR_IF_NO_ERROR_STATUS(_func, _status) \ |
| 175 | BT_USE_EXPR2(_func, _status) |
| 176 | |
| 177 | # define BT_ASSERT_POST_DEV_NO_ERROR(_func) \ |
| 178 | BT_USE_EXPR(_func) |
| 179 | #endif /* BT_DEV_MODE */ |
| 180 | |
| 181 | #define _BT_ASSERT_PRE_CLK_CLS_NAME "Clock class" |
| 182 | #define _BT_ASSERT_PRE_CLK_CLS_ID "clock-class" |
| 183 | |
| 184 | #define BT_ASSERT_PRE_CLK_CLS_NON_NULL(_cc) \ |
| 185 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_CLK_CLS_ID, (_cc), \ |
| 186 | _BT_ASSERT_PRE_CLK_CLS_NAME) |
| 187 | |
| 188 | #define BT_ASSERT_PRE_DEV_CLK_CLS_NON_NULL(_cc) \ |
| 189 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_CLK_CLS_ID, (_cc), \ |
| 190 | _BT_ASSERT_PRE_CLK_CLS_NAME) |
| 191 | |
| 192 | #define _BT_ASSERT_PRE_DEF_CLK_CLS_NAME "Default clock class" |
| 193 | #define _BT_ASSERT_PRE_DEF_CLK_CLS_ID "default-clock-class" |
| 194 | |
| 195 | #define BT_ASSERT_PRE_DEF_CLK_CLS_NON_NULL(_cc) \ |
| 196 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_DEF_CLK_CLS_ID, (_cc), \ |
| 197 | _BT_ASSERT_PRE_DEF_CLK_CLS_NAME) |
| 198 | |
| 199 | #define BT_ASSERT_PRE_DEV_DEF_CLK_CLS_NON_NULL(_cc) \ |
| 200 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_DEF_CLK_CLS_ID, \ |
| 201 | (_cc), _BT_ASSERT_PRE_DEF_CLK_CLS_NAME) |
| 202 | |
| 203 | #define _BT_ASSERT_PRE_CS_NAME "Clock snapshot" |
| 204 | #define _BT_ASSERT_PRE_CS_ID "clock-snapshot" |
| 205 | |
| 206 | #define BT_ASSERT_PRE_CS_NON_NULL(_cs) \ |
| 207 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_CS_ID, (_cs), \ |
| 208 | _BT_ASSERT_PRE_CS_NAME) |
| 209 | |
| 210 | #define BT_ASSERT_PRE_DEV_CS_NON_NULL(_cs) \ |
| 211 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_CS_ID, (_cs), \ |
| 212 | _BT_ASSERT_PRE_CS_NAME) |
| 213 | |
| 214 | #define _BT_ASSERT_PRE_EVENT_NAME "Event" |
| 215 | #define _BT_ASSERT_PRE_EVENT_ID "event" |
| 216 | |
| 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) |
| 220 | |
| 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) |
| 224 | |
| 225 | #define _BT_ASSERT_PRE_EC_NAME "Event class" |
| 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) |
| 231 | |
| 232 | #define BT_ASSERT_PRE_EC_NON_NULL(_ec) \ |
| 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) |
| 239 | |
| 240 | #define BT_ASSERT_PRE_DEV_EC_NON_NULL(_ec) \ |
| 241 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_EC_ID, (_ec), \ |
| 242 | _BT_ASSERT_PRE_EC_NAME) |
| 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 | |
| 253 | #define _BT_ASSERT_PRE_FC_IS_INT_ID(_fc_id) "is-int-field-class:" _fc_id |
| 254 | |
| 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 | |
| 262 | #define _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_ID(_fc_id) \ |
| 263 | "is-unsigned-integer-field-class:" _fc_id |
| 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 | |
| 272 | #define _BT_ASSERT_PRE_FC_IS_SIGNED_INT_ID(_fc_id) \ |
| 273 | "is-signed-integer-field-class:" _fc_id |
| 274 | |
| 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 | |
| 282 | #define _BT_ASSERT_PRE_FC_IS_ENUM_ID(_fc_id) \ |
| 283 | "is-enumeration-field-class:" _fc_id |
| 284 | |
| 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 | |
| 293 | #define _BT_ASSERT_PRE_FC_IS_ARRAY_ID(_fc_id) \ |
| 294 | "is-array-field-class:" _fc_id |
| 295 | |
| 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 | |
| 305 | #define _BT_ASSERT_PRE_FC_IS_OPTION_ID(_fc_id) \ |
| 306 | "is-option-field-class:" _fc_id |
| 307 | |
| 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 | |
| 316 | #define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_ID(_fc_id) \ |
| 317 | "is-option-field-class-with-selector:" _fc_id |
| 318 | |
| 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 | |
| 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 | |
| 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 | |
| 335 | #define _BT_ASSERT_PRE_FC_IS_STRUCT_ID(_fc_id) \ |
| 336 | "is-structure-field-class:" _fc_id |
| 337 | |
| 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 | |
| 346 | #define _BT_ASSERT_PRE_FC_IS_VARIANT_ID(_fc_id) \ |
| 347 | "is-variant-field-class:" _fc_id |
| 348 | |
| 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 | |
| 356 | #define _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_ID(_fc_id) \ |
| 357 | "is-variant-field-class-with-selector:" _fc_id |
| 358 | |
| 359 | #define _BT_ASSERT_PRE_FC_HAS_TYPE_COND(_fc, _type) \ |
| 360 | (((const struct bt_field_class *) (_fc))->type == (_type)) |
| 361 | |
| 362 | #define _BT_ASSERT_PRE_FC_HAS_TYPE_FMT(_name) \ |
| 363 | _name " has the wrong type: expected-type=%s, %![fc-]+F" |
| 364 | |
| 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), \ |
| 372 | _BT_ASSERT_PRE_FC_IS_INT_FMT(_name), (_fc)) |
| 373 | |
| 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), \ |
| 381 | _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_FMT(_name), (_fc)) |
| 382 | |
| 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), \ |
| 387 | _BT_ASSERT_PRE_FC_IS_SIGNED_INT_FMT(_name), (_fc)) |
| 388 | |
| 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), \ |
| 393 | _BT_ASSERT_PRE_FC_IS_ENUM_FMT(_name), (_fc)) |
| 394 | |
| 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), \ |
| 399 | _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name), (_fc)) |
| 400 | |
| 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), \ |
| 405 | _BT_ASSERT_PRE_FC_IS_STRUCT_FMT(_name), (_fc)) |
| 406 | |
| 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), \ |
| 411 | _BT_ASSERT_PRE_FC_IS_OPTION_FMT(_name), (_fc)) |
| 412 | |
| 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), \ |
| 417 | _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_FMT(_name), (_fc)) |
| 418 | |
| 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), \ |
| 423 | _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_FMT(_name), (_fc)) |
| 424 | |
| 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), \ |
| 429 | _BT_ASSERT_PRE_FC_IS_VARIANT_FMT(_name), (_fc)) |
| 430 | |
| 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), \ |
| 435 | _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_FMT(_name), (_fc)) |
| 436 | |
| 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)), \ |
| 441 | _BT_ASSERT_PRE_FC_HAS_TYPE_FMT(_name), \ |
| 442 | bt_common_field_class_type_string(_type), (_fc)) |
| 443 | |
| 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), \ |
| 452 | _BT_ASSERT_PRE_FC_IS_INT_FMT(_name), (_fc)) |
| 453 | |
| 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), \ |
| 458 | _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_FMT(_name), (_fc)) |
| 459 | |
| 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), \ |
| 464 | _BT_ASSERT_PRE_FC_IS_SIGNED_INT_FMT(_name), (_fc)) |
| 465 | |
| 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), \ |
| 470 | _BT_ASSERT_PRE_FC_IS_ENUM_FMT(_name), (_fc)) |
| 471 | |
| 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), \ |
| 476 | _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name), (_fc)) |
| 477 | |
| 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), \ |
| 482 | _BT_ASSERT_PRE_FC_IS_STRUCT_FMT(_name), (_fc)) |
| 483 | |
| 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), \ |
| 488 | _BT_ASSERT_PRE_FC_IS_OPTION_FMT(_name), (_fc)) |
| 489 | |
| 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), \ |
| 493 | _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_FMT(_name), (_fc)) |
| 494 | |
| 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), \ |
| 499 | _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_FMT(_name), (_fc)) |
| 500 | |
| 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), \ |
| 505 | _BT_ASSERT_PRE_FC_IS_VARIANT_FMT(_name), (_fc)) |
| 506 | |
| 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), \ |
| 511 | _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_FMT(_name), (_fc)) |
| 512 | |
| 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)), \ |
| 517 | _BT_ASSERT_PRE_FC_HAS_TYPE_FMT(_name), \ |
| 518 | bt_common_field_class_type_string(_type), (_fc)) |
| 519 | |
| 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)) |
| 527 | |
| 528 | #define _BT_ASSERT_PRE_FC_NAME "Field class" |
| 529 | #define _BT_ASSERT_PRE_FC_ID "field-class" |
| 530 | |
| 531 | #define BT_ASSERT_PRE_FC_NON_NULL(_fc) \ |
| 532 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_FC_ID, (_fc), \ |
| 533 | _BT_ASSERT_PRE_FC_NAME) |
| 534 | |
| 535 | #define BT_ASSERT_PRE_DEV_FC_NON_NULL(_fc) \ |
| 536 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_FC_ID, (_fc), \ |
| 537 | _BT_ASSERT_PRE_FC_NAME) |
| 538 | |
| 539 | #define _BT_ASSERT_PRE_STRUCT_FC_MEMBER_NAME "Structure field class member" |
| 540 | #define _BT_ASSERT_PRE_STRUCT_FC_MEMBER_ID "structure-field-class-member" |
| 541 | |
| 542 | #define BT_ASSERT_PRE_STRUCT_FC_MEMBER_NON_NULL(_fc) \ |
| 543 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_STRUCT_FC_MEMBER_ID, \ |
| 544 | (_fc), _BT_ASSERT_PRE_STRUCT_FC_MEMBER_NAME) |
| 545 | |
| 546 | #define BT_ASSERT_PRE_DEV_STRUCT_FC_MEMBER_NON_NULL(_fc) \ |
| 547 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_STRUCT_FC_MEMBER_ID, \ |
| 548 | (_fc), _BT_ASSERT_PRE_STRUCT_FC_MEMBER_NAME) |
| 549 | |
| 550 | #define _BT_ASSERT_PRE_VAR_FC_OPT_NAME "Variant field class option" |
| 551 | #define _BT_ASSERT_PRE_VAR_FC_OPT_ID "variant-field-class-option-id" |
| 552 | |
| 553 | #define BT_ASSERT_PRE_VAR_FC_OPT_NON_NULL(_fc) \ |
| 554 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_VAR_FC_OPT_ID, (_fc), \ |
| 555 | _BT_ASSERT_PRE_VAR_FC_OPT_NAME) |
| 556 | |
| 557 | #define BT_ASSERT_PRE_DEV_VAR_FC_OPT_NON_NULL(_fc) \ |
| 558 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_VAR_FC_OPT_ID, (_fc), \ |
| 559 | _BT_ASSERT_PRE_VAR_FC_OPT_NAME) |
| 560 | |
| 561 | #define _BT_ASSERT_PRE_FP_NAME "Field path" |
| 562 | #define _BT_ASSERT_PRE_FP_ID "field-path" |
| 563 | |
| 564 | #define BT_ASSERT_PRE_FP_NON_NULL(_fp) \ |
| 565 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_FP_ID, (_fp), \ |
| 566 | _BT_ASSERT_PRE_FP_NAME) |
| 567 | |
| 568 | #define BT_ASSERT_PRE_DEV_FP_NON_NULL(_fp) \ |
| 569 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_FP_ID, (_fp), \ |
| 570 | _BT_ASSERT_PRE_FP_NAME) |
| 571 | |
| 572 | #define BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(_field_id, _field, _cls_type_id, _cls_type, _name) \ |
| 573 | BT_ASSERT_PRE_DEV("is-" _cls_type_id ":" _field_id, \ |
| 574 | ((const struct bt_field *) (_field))->class->type == (_cls_type), \ |
| 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 | |
| 579 | #define BT_ASSERT_PRE_DEV_FIELD_IS_UNSIGNED_INT(_field_id, _field, _name) \ |
| 580 | BT_ASSERT_PRE_DEV( \ |
| 581 | "is-unsigned-integer-field:" _field_id, \ |
| 582 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \ |
| 583 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, \ |
| 584 | _name " is not an unsigned integer field: %![field-]+f", \ |
| 585 | (_field)) |
| 586 | |
| 587 | #define BT_ASSERT_PRE_DEV_FIELD_IS_SIGNED_INT(_field_id, _field, _name) \ |
| 588 | BT_ASSERT_PRE_DEV( \ |
| 589 | "is-signed-integer-field:" _field_id, \ |
| 590 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || \ |
| 591 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, \ |
| 592 | _name " is not a signed integer field: %![field-]+f", \ |
| 593 | (_field)) |
| 594 | |
| 595 | #define BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY(_field_id, _field, _name) \ |
| 596 | BT_ASSERT_PRE_DEV( \ |
| 597 | "is-array-field:" _field_id, \ |
| 598 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY || \ |
| 599 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD || \ |
| 600 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD, \ |
| 601 | _name " is not an array field: %![field-]+f", (_field)) |
| 602 | |
| 603 | #define BT_ASSERT_PRE_DEV_FIELD_IS_DYNAMIC_ARRAY(_field_id, _field, _name) \ |
| 604 | BT_ASSERT_PRE_DEV( \ |
| 605 | "is-dynamic-array-field:" _field_id, \ |
| 606 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD || \ |
| 607 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD, \ |
| 608 | _name " is not a dynamic array field: %![field-]+f", (_field)) |
| 609 | |
| 610 | #define BT_ASSERT_PRE_DEV_FIELD_IS_OPTION(_field_id, _field, _name) \ |
| 611 | BT_ASSERT_PRE_DEV( \ |
| 612 | "is-option-field:" _field_id, \ |
| 613 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD || \ |
| 614 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD || \ |
| 615 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD || \ |
| 616 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD, \ |
| 617 | _name " is not an option field: %![field-]+f", (_field)) |
| 618 | |
| 619 | #define BT_ASSERT_PRE_DEV_FIELD_IS_VARIANT(_field_id, _field, _name) \ |
| 620 | BT_ASSERT_PRE_DEV( \ |
| 621 | "is-variant-field:" _field_id, \ |
| 622 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD || \ |
| 623 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD || \ |
| 624 | ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD, \ |
| 625 | _name " is not a variant field: %![field-]+f", (_field)) |
| 626 | |
| 627 | #define BT_ASSERT_PRE_DEV_FIELD_IS_SET(_field_id, _field) \ |
| 628 | BT_ASSERT_PRE_DEV("is-field-set:" _field_id, \ |
| 629 | bt_field_is_set(_field), \ |
| 630 | "Field is not set: %!+f", (_field)) |
| 631 | |
| 632 | #define _BT_ASSERT_PRE_FIELD_NAME "Field" |
| 633 | #define _BT_ASSERT_PRE_FIELD_ID "field" |
| 634 | |
| 635 | #define BT_ASSERT_PRE_FIELD_NON_NULL(_field) \ |
| 636 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_FIELD_ID, (_field), \ |
| 637 | _BT_ASSERT_PRE_FIELD_NAME) |
| 638 | |
| 639 | #define BT_ASSERT_PRE_DEV_FIELD_NON_NULL(_field) \ |
| 640 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_FIELD_ID, (_field), \ |
| 641 | _BT_ASSERT_PRE_FIELD_NAME) |
| 642 | |
| 643 | #define _BT_ASSERT_PRE_PACKET_NAME "Packet" |
| 644 | #define _BT_ASSERT_PRE_PACKET_ID "packet" |
| 645 | |
| 646 | #define BT_ASSERT_PRE_PACKET_NON_NULL_FROM_FUNC(_func, _packet) \ |
| 647 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \ |
| 648 | _BT_ASSERT_PRE_PACKET_ID, (_packet), _BT_ASSERT_PRE_PACKET_NAME) |
| 649 | |
| 650 | #define BT_ASSERT_PRE_PACKET_NON_NULL(_packet) \ |
| 651 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PACKET_ID, (_packet), \ |
| 652 | _BT_ASSERT_PRE_PACKET_NAME) |
| 653 | |
| 654 | #define BT_ASSERT_PRE_DEV_PACKET_NON_NULL_FROM_FUNC(_func, _packet) \ |
| 655 | BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \ |
| 656 | _BT_ASSERT_PRE_PACKET_ID, (_packet), _BT_ASSERT_PRE_PACKET_NAME) |
| 657 | |
| 658 | #define BT_ASSERT_PRE_DEV_PACKET_NON_NULL(_packet) \ |
| 659 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PACKET_ID, (_packet), \ |
| 660 | _BT_ASSERT_PRE_PACKET_NAME) |
| 661 | |
| 662 | #define _BT_ASSERT_PRE_SC_NAME "Stream class" |
| 663 | #define _BT_ASSERT_PRE_SC_ID "stream-class" |
| 664 | |
| 665 | #define BT_ASSERT_PRE_SC_NON_NULL(_sc) \ |
| 666 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_SC_ID, (_sc), \ |
| 667 | _BT_ASSERT_PRE_SC_NAME) |
| 668 | |
| 669 | #define BT_ASSERT_PRE_DEV_SC_NON_NULL(_sc) \ |
| 670 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_SC_ID, (_sc), \ |
| 671 | _BT_ASSERT_PRE_SC_NAME) |
| 672 | |
| 673 | #define _BT_ASSERT_PRE_STREAM_NAME "Stream" |
| 674 | #define _BT_ASSERT_PRE_STREAM_ID "stream" |
| 675 | |
| 676 | #define BT_ASSERT_PRE_STREAM_NON_NULL_FROM_FUNC(_func, _stream) \ |
| 677 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \ |
| 678 | _BT_ASSERT_PRE_STREAM_ID, (_stream), \ |
| 679 | _BT_ASSERT_PRE_STREAM_NAME) |
| 680 | |
| 681 | #define BT_ASSERT_PRE_STREAM_NON_NULL(_stream) \ |
| 682 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_STREAM_ID, (_stream), \ |
| 683 | _BT_ASSERT_PRE_STREAM_NAME) |
| 684 | |
| 685 | #define BT_ASSERT_PRE_DEV_STREAM_NON_NULL_FROM_FUNC(_func, _stream) \ |
| 686 | BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \ |
| 687 | _BT_ASSERT_PRE_STREAM_ID, (_stream), \ |
| 688 | _BT_ASSERT_PRE_STREAM_NAME) |
| 689 | |
| 690 | #define BT_ASSERT_PRE_DEV_STREAM_NON_NULL(_stream) \ |
| 691 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_STREAM_ID, (_stream), \ |
| 692 | _BT_ASSERT_PRE_STREAM_NAME) |
| 693 | |
| 694 | #define _BT_ASSERT_PRE_TC_NAME "Trace class" |
| 695 | #define _BT_ASSERT_PRE_TC_ID "trace-class" |
| 696 | |
| 697 | #define BT_ASSERT_PRE_TC_NON_NULL_FROM_FUNC(_func, _tc) \ |
| 698 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _BT_ASSERT_PRE_TC_ID, \ |
| 699 | (_tc), _BT_ASSERT_PRE_TC_NAME) |
| 700 | |
| 701 | #define BT_ASSERT_PRE_TC_NON_NULL(_tc) \ |
| 702 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_TC_ID, (_tc), \ |
| 703 | _BT_ASSERT_PRE_TC_NAME) |
| 704 | |
| 705 | #define BT_ASSERT_PRE_DEV_TC_NON_NULL(_tc) \ |
| 706 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_TC_ID, (_tc), \ |
| 707 | _BT_ASSERT_PRE_TC_NAME) |
| 708 | |
| 709 | #define _BT_ASSERT_PRE_TRACE_NAME "Trace" |
| 710 | #define _BT_ASSERT_PRE_TRACE_ID "trace" |
| 711 | |
| 712 | #define BT_ASSERT_PRE_TRACE_NON_NULL(_trace) \ |
| 713 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_TRACE_ID, (_trace), \ |
| 714 | _BT_ASSERT_PRE_TRACE_NAME) |
| 715 | |
| 716 | #define BT_ASSERT_PRE_DEV_TRACE_NON_NULL(_trace) \ |
| 717 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_TRACE_ID, (_trace), \ |
| 718 | _BT_ASSERT_PRE_TRACE_NAME) |
| 719 | |
| 720 | #define _BT_ASSERT_PRE_USER_ATTRS_NAME "User attributes value object" |
| 721 | #define _BT_ASSERT_PRE_USER_ATTRS_ID "user-attributes-value-object" |
| 722 | |
| 723 | #define BT_ASSERT_PRE_USER_ATTRS_NON_NULL_FROM_FUNC(_func, _ua) \ |
| 724 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \ |
| 725 | _BT_ASSERT_PRE_USER_ATTRS_ID, (_ua), \ |
| 726 | _BT_ASSERT_PRE_USER_ATTRS_NAME) |
| 727 | |
| 728 | #define BT_ASSERT_PRE_USER_ATTRS_NON_NULL(_ua) \ |
| 729 | BT_ASSERT_PRE_USER_ATTRS_NON_NULL_FROM_FUNC(__func__, (_ua)) |
| 730 | |
| 731 | #define BT_ASSERT_PRE_DEV_USER_ATTRS_NON_NULL(_ua) \ |
| 732 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_USER_ATTRS_ID, (_ua), \ |
| 733 | _BT_ASSERT_PRE_USER_ATTRS_NAME) |
| 734 | |
| 735 | #define BT_ASSERT_PRE_USER_ATTRS_IS_MAP_FROM_FUNC(_func, _ua) \ |
| 736 | BT_ASSERT_PRE_FROM_FUNC(_func, "is-map-value:user-attributes", \ |
| 737 | (_ua)->type == BT_VALUE_TYPE_MAP, \ |
| 738 | _BT_ASSERT_PRE_USER_ATTRS_NAME \ |
| 739 | " object is not a map value object.") |
| 740 | |
| 741 | #define BT_ASSERT_PRE_USER_ATTRS_IS_MAP(_ua) \ |
| 742 | BT_ASSERT_PRE_USER_ATTRS_IS_MAP_FROM_FUNC(__func__, (_ua)) |
| 743 | |
| 744 | #define BT_ASSERT_COND_LISTENER_FUNC_NAME "Listener function" |
| 745 | #define BT_ASSERT_COND_LISTENER_FUNC_ID "listener-function" |
| 746 | |
| 747 | #define BT_ASSERT_PRE_LISTENER_FUNC_NON_NULL(_listener_func) \ |
| 748 | BT_ASSERT_PRE_NON_NULL(BT_ASSERT_COND_LISTENER_FUNC_ID, \ |
| 749 | (_listener_func), BT_ASSERT_COND_LISTENER_FUNC_NAME) |
| 750 | |
| 751 | #define BT_ASSERT_PRE_DEV_LISTENER_FUNC_NON_NULL(_listener_func) \ |
| 752 | BT_ASSERT_PRE_DEV_NON_NULL(BT_ASSERT_COND_LISTENER_FUNC_ID, \ |
| 753 | (_listener_func), BT_ASSERT_COND_LISTENER_FUNC_NAME) |
| 754 | |
| 755 | #define _BT_ASSERT_PRE_MSG_ITER_NAME "Message iterator" |
| 756 | #define _BT_ASSERT_PRE_MSG_ITER_ID "message-iterator" |
| 757 | |
| 758 | #define BT_ASSERT_PRE_MSG_ITER_NON_NULL_FROM_FUNC(_func, _msg_iter) \ |
| 759 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \ |
| 760 | _BT_ASSERT_PRE_MSG_ITER_ID, (_msg_iter), \ |
| 761 | _BT_ASSERT_PRE_MSG_ITER_NAME) |
| 762 | |
| 763 | #define BT_ASSERT_PRE_MSG_ITER_NON_NULL(_msg_iter) \ |
| 764 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_MSG_ITER_ID, (_msg_iter), \ |
| 765 | _BT_ASSERT_PRE_MSG_ITER_NAME) |
| 766 | |
| 767 | #define BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL_FROM_FUNC(_func, _msg_iter) \ |
| 768 | BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \ |
| 769 | _BT_ASSERT_PRE_MSG_ITER_ID, \ |
| 770 | (_msg_iter), _BT_ASSERT_PRE_MSG_ITER_NAME) |
| 771 | |
| 772 | #define BT_ASSERT_PRE_DEV_MSG_ITER_NON_NULL(_msg_iter) \ |
| 773 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_MSG_ITER_ID, \ |
| 774 | (_msg_iter), _BT_ASSERT_PRE_MSG_ITER_NAME) |
| 775 | |
| 776 | #define _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_COND(_sc) \ |
| 777 | ((_sc)->default_clock_class) |
| 778 | |
| 779 | #define _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_FMT \ |
| 780 | "Message's stream's class has no default clock class: " \ |
| 781 | "%![msg-]+n, %![sc-]+S" |
| 782 | |
| 783 | #define _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_ID \ |
| 784 | "message-stream-class-has-default-clock-class" |
| 785 | |
| 786 | #define BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_FROM_FUNC(_func, _msg, _sc) \ |
| 787 | BT_ASSERT_PRE_FROM_FUNC(_func, \ |
| 788 | _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_ID, \ |
| 789 | _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_COND(_sc), \ |
| 790 | _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_FMT, \ |
| 791 | (_msg), (_sc)); |
| 792 | |
| 793 | #define BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS(_msg, _sc) \ |
| 794 | BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_FROM_FUNC(__func__, (_msg), (_sc)) |
| 795 | |
| 796 | #define BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS_FROM_FUNC(_func, _msg, _sc) \ |
| 797 | BT_ASSERT_PRE_DEV_FROM_FUNC(_func, \ |
| 798 | _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_ID, \ |
| 799 | _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_COND(_sc), \ |
| 800 | _BT_ASSERT_PRE_MSG_SC_DEF_CLK_CLS_FMT, \ |
| 801 | (_msg), (_sc)); |
| 802 | |
| 803 | #define BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS(_msg, _sc) \ |
| 804 | BT_ASSERT_PRE_DEV_MSG_SC_DEF_CLK_CLS_FROM_FUNC(__func__, (_msg), (_sc)) |
| 805 | |
| 806 | #define _BT_ASSERT_PRE_MSG_HAS_TYPE_COND(_msg, _type) \ |
| 807 | (((struct bt_message *) (_msg))->type == (_type)) |
| 808 | |
| 809 | #define _BT_ASSERT_PRE_MSG_HAS_TYPE_FMT \ |
| 810 | "Message has the wrong type: expected-type=%s, %![msg-]+n" |
| 811 | |
| 812 | #define _BT_ASSERT_PRE_MSG_HAS_TYPE_ID(_msg_id, _type_id) \ |
| 813 | "is-" _type_id "-message:" _msg_id |
| 814 | |
| 815 | #define BT_ASSERT_PRE_MSG_HAS_TYPE(_msg_id, _msg, _type_id, _type) \ |
| 816 | BT_ASSERT_PRE( \ |
| 817 | _BT_ASSERT_PRE_MSG_HAS_TYPE_ID(_msg_id, _type_id), \ |
| 818 | _BT_ASSERT_PRE_MSG_HAS_TYPE_COND((_msg), (_type)), \ |
| 819 | _BT_ASSERT_PRE_MSG_HAS_TYPE_FMT, \ |
| 820 | bt_common_message_type_string(_type), (_msg)) |
| 821 | |
| 822 | #define BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(_msg_id, _msg, _type_id, _type) \ |
| 823 | BT_ASSERT_PRE_DEV( \ |
| 824 | _BT_ASSERT_PRE_MSG_HAS_TYPE_ID(_msg_id, _type_id), \ |
| 825 | _BT_ASSERT_PRE_MSG_HAS_TYPE_COND((_msg), (_type)), \ |
| 826 | _BT_ASSERT_PRE_MSG_HAS_TYPE_FMT, \ |
| 827 | bt_common_message_type_string(_type), (_msg)) |
| 828 | |
| 829 | #define _BT_ASSERT_PRE_MSG_NAME "Message" |
| 830 | #define _BT_ASSERT_PRE_MSG_ID "message" |
| 831 | |
| 832 | #define BT_ASSERT_PRE_MSG_NON_NULL(_msg_iter) \ |
| 833 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_MSG_ID, (_msg_iter), \ |
| 834 | _BT_ASSERT_PRE_MSG_NAME) |
| 835 | |
| 836 | #define BT_ASSERT_PRE_DEV_MSG_NON_NULL(_msg_iter) \ |
| 837 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_MSG_ID, (_msg_iter), \ |
| 838 | _BT_ASSERT_PRE_MSG_NAME) |
| 839 | |
| 840 | #define BT_ASSERT_PRE_MSG_CS_BEGIN_LE_END(_msg_iter, _begin, _end) \ |
| 841 | BT_ASSERT_PRE("beginning-default-clock-snapshot-lteq-end", \ |
| 842 | (_begin) <= (_end), \ |
| 843 | "Beginning default clock snapshot value is greater " \ |
| 844 | "than end default clock snapshot value: " \ |
| 845 | "cs-begin-val=%" PRIu64 ", cs-end-val=%" PRIu64 ", " \ |
| 846 | "%![msg-iter-]+i", (_begin), (_end), _msg_iter); |
| 847 | |
| 848 | #define BT_ASSERT_PRE_DEV_MSG_HOT(_msg) \ |
| 849 | BT_ASSERT_PRE_DEV_HOT("message", (_msg), "Message", ": %!+n", (_msg)); |
| 850 | |
| 851 | #define _BT_ASSERT_PRE_MSG_ITER_CLS_NAME "Message iterator class" |
| 852 | #define _BT_ASSERT_PRE_MSG_ITER_CLS_ID "message-iterator-class" |
| 853 | |
| 854 | #define BT_ASSERT_PRE_MSG_ITER_CLS_NON_NULL(_msg_iter_cls) \ |
| 855 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_MSG_ITER_CLS_ID, \ |
| 856 | (_msg_iter_cls), _BT_ASSERT_PRE_MSG_ITER_CLS_NAME) |
| 857 | |
| 858 | #define BT_ASSERT_PRE_DEV_MSG_ITER_CLS_NON_NULL(_msg_iter_cls) \ |
| 859 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_MSG_ITER_CLS_ID, \ |
| 860 | (_msg_iter_cls), _BT_ASSERT_PRE_MSG_ITER_CLS_NAME) |
| 861 | |
| 862 | #define _BT_ASSERT_PRE_COMP_CLS_NAME "Component class" |
| 863 | #define _BT_ASSERT_PRE_COMP_CLS_ID "component-class" |
| 864 | |
| 865 | #define BT_ASSERT_PRE_COMP_CLS_NON_NULL_FROM_FUNC(_func, _comp_cls) \ |
| 866 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \ |
| 867 | _BT_ASSERT_PRE_COMP_CLS_ID, (_comp_cls), \ |
| 868 | _BT_ASSERT_PRE_COMP_CLS_NAME) |
| 869 | |
| 870 | #define BT_ASSERT_PRE_COMP_CLS_NON_NULL(_comp_cls) \ |
| 871 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_COMP_CLS_ID, (_comp_cls), \ |
| 872 | _BT_ASSERT_PRE_COMP_CLS_NAME) |
| 873 | |
| 874 | #define BT_ASSERT_PRE_DEV_COMP_CLS_NON_NULL(_comp_cls) \ |
| 875 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_COMP_CLS_ID, \ |
| 876 | (_comp_cls), _BT_ASSERT_PRE_COMP_CLS_NAME) |
| 877 | |
| 878 | #define _BT_ASSERT_PRE_COMP_DESCR_SET_NAME "Component descriptor set" |
| 879 | #define _BT_ASSERT_PRE_COMP_DESCR_SET_ID "component-descriptor-set" |
| 880 | |
| 881 | #define BT_ASSERT_PRE_COMP_DESCR_SET_NON_NULL(_comp_descr_set) \ |
| 882 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_COMP_DESCR_SET_ID, \ |
| 883 | (_comp_descr_set), _BT_ASSERT_PRE_COMP_DESCR_SET_NAME) |
| 884 | |
| 885 | #define BT_ASSERT_PRE_DEV_COMP_DESCR_SET_NON_NULL(_comp_descr_set) \ |
| 886 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_COMP_DESCR_SET_ID, \ |
| 887 | (_comp_descr_set), _BT_ASSERT_PRE_COMP_DESCR_SET_NAME) |
| 888 | |
| 889 | #define _BT_ASSERT_PRE_COMP_NAME "Component" |
| 890 | #define _BT_ASSERT_PRE_COMP_ID "component" |
| 891 | |
| 892 | #define BT_ASSERT_PRE_COMP_NON_NULL_FROM_FUNC(_func, _comp) \ |
| 893 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _BT_ASSERT_PRE_COMP_ID, \ |
| 894 | (_comp), _BT_ASSERT_PRE_COMP_NAME) |
| 895 | |
| 896 | #define BT_ASSERT_PRE_COMP_NON_NULL(_comp) \ |
| 897 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_COMP_ID, (_comp), \ |
| 898 | _BT_ASSERT_PRE_COMP_NAME) |
| 899 | |
| 900 | #define BT_ASSERT_PRE_DEV_COMP_NON_NULL_FROM_FUNC(_func, _comp) \ |
| 901 | BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \ |
| 902 | _BT_ASSERT_PRE_COMP_ID, (_comp), _BT_ASSERT_PRE_COMP_NAME) |
| 903 | |
| 904 | #define BT_ASSERT_PRE_DEV_COMP_NON_NULL(_comp) \ |
| 905 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_COMP_ID, (_comp), \ |
| 906 | _BT_ASSERT_PRE_COMP_NAME) |
| 907 | |
| 908 | #define _BT_ASSERT_PRE_CONN_NAME "Connection" |
| 909 | #define _BT_ASSERT_PRE_CONN_ID "connection" |
| 910 | |
| 911 | #define BT_ASSERT_PRE_CONN_NON_NULL(_conn) \ |
| 912 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_CONN_ID, (_conn), \ |
| 913 | _BT_ASSERT_PRE_CONN_NAME) |
| 914 | |
| 915 | #define BT_ASSERT_PRE_DEV_CONN_NON_NULL(_conn) \ |
| 916 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_CONN_ID, (_conn), \ |
| 917 | _BT_ASSERT_PRE_CONN_NAME) |
| 918 | |
| 919 | #define _BT_ASSERT_PRE_GRAPH_NAME "Graph" |
| 920 | #define _BT_ASSERT_PRE_GRAPH_ID "graph" |
| 921 | |
| 922 | #define BT_ASSERT_PRE_GRAPH_NON_NULL_FROM_FUNC(_func, _graph) \ |
| 923 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \ |
| 924 | _BT_ASSERT_PRE_GRAPH_ID, (_graph), _BT_ASSERT_PRE_GRAPH_NAME) |
| 925 | |
| 926 | #define BT_ASSERT_PRE_GRAPH_NON_NULL(_graph) \ |
| 927 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_GRAPH_ID, (_graph), \ |
| 928 | _BT_ASSERT_PRE_GRAPH_NAME) |
| 929 | |
| 930 | #define BT_ASSERT_PRE_DEV_GRAPH_NON_NULL(_graph) \ |
| 931 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_GRAPH_ID, (_graph), \ |
| 932 | _BT_ASSERT_PRE_GRAPH_NAME) |
| 933 | |
| 934 | #define _BT_ASSERT_PRE_INTR_NAME "Interrupter" |
| 935 | #define _BT_ASSERT_PRE_INTR_ID "interrupter" |
| 936 | |
| 937 | #define BT_ASSERT_PRE_INTR_NON_NULL(_intr) \ |
| 938 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_INTR_ID, (_intr), \ |
| 939 | _BT_ASSERT_PRE_INTR_NAME) |
| 940 | |
| 941 | #define BT_ASSERT_PRE_DEV_INTR_NON_NULL(_intr) \ |
| 942 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_INTR_ID, (_intr), \ |
| 943 | _BT_ASSERT_PRE_INTR_NAME) |
| 944 | |
| 945 | #define _BT_ASSERT_PRE_PORT_NAME "Port" |
| 946 | #define _BT_ASSERT_PRE_PORT_ID "port" |
| 947 | |
| 948 | #define BT_ASSERT_PRE_PORT_NON_NULL(_port) \ |
| 949 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PORT_ID, (_port), \ |
| 950 | _BT_ASSERT_PRE_PORT_NAME) |
| 951 | |
| 952 | #define BT_ASSERT_PRE_DEV_PORT_NON_NULL(_port) \ |
| 953 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PORT_ID, (_port), \ |
| 954 | _BT_ASSERT_PRE_PORT_NAME) |
| 955 | |
| 956 | #define _BT_ASSERT_PRE_QUERY_EXEC_NAME "Query executor" |
| 957 | #define _BT_ASSERT_PRE_QUERY_EXEC_ID "query-executor" |
| 958 | |
| 959 | #define BT_ASSERT_PRE_QUERY_EXEC_NON_NULL(_query_exec) \ |
| 960 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_QUERY_EXEC_ID, \ |
| 961 | (_query_exec), _BT_ASSERT_PRE_QUERY_EXEC_NAME) |
| 962 | |
| 963 | #define BT_ASSERT_PRE_DEV_QUERY_EXEC_NON_NULL(_query_exec) \ |
| 964 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_QUERY_EXEC_ID, \ |
| 965 | (_query_exec), _BT_ASSERT_PRE_QUERY_EXEC_NAME) |
| 966 | |
| 967 | #define _BT_ASSERT_PRE_PLUGIN_SET_NAME "Plugin set" |
| 968 | #define _BT_ASSERT_PRE_PLUGIN_SET_ID "plugin-set" |
| 969 | |
| 970 | #define BT_ASSERT_PRE_PLUGIN_SET_NON_NULL(_plugin_set) \ |
| 971 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PLUGIN_SET_ID, \ |
| 972 | (_plugin_set), _BT_ASSERT_PRE_PLUGIN_SET_NAME) |
| 973 | |
| 974 | #define BT_ASSERT_PRE_DEV_PLUGIN_SET_NON_NULL(_plugin_set) \ |
| 975 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PLUGIN_SET_ID, \ |
| 976 | (_plugin_set), _BT_ASSERT_PRE_PLUGIN_SET_NAME) |
| 977 | |
| 978 | #define _BT_ASSERT_PRE_PLUGIN_SET_OUT_NAME \ |
| 979 | _BT_ASSERT_PRE_PLUGIN_SET_NAME " (output)" |
| 980 | #define _BT_ASSERT_PRE_PLUGIN_SET_OUT_ID \ |
| 981 | _BT_ASSERT_PRE_PLUGIN_SET_ID "-output" |
| 982 | |
| 983 | #define BT_ASSERT_PRE_PLUGIN_SET_OUT_NON_NULL(_plugin_set) \ |
| 984 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PLUGIN_SET_OUT_ID, \ |
| 985 | (_plugin_set), _BT_ASSERT_PRE_PLUGIN_SET_OUT_NAME) |
| 986 | |
| 987 | #define BT_ASSERT_PRE_DEV_PLUGIN_SET_OUT_NON_NULL(_plugin_set) \ |
| 988 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PLUGIN_SET_OUT_ID, \ |
| 989 | (_plugin_set), _BT_ASSERT_PRE_PLUGIN_SET_OUT_NAME) |
| 990 | |
| 991 | #define _BT_ASSERT_PRE_PLUGIN_NAME "Plugin" |
| 992 | #define _BT_ASSERT_PRE_PLUGIN_ID "plugin" |
| 993 | |
| 994 | #define BT_ASSERT_PRE_PLUGIN_NON_NULL(_plugin) \ |
| 995 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PLUGIN_ID, (_plugin), \ |
| 996 | _BT_ASSERT_PRE_PLUGIN_NAME) |
| 997 | |
| 998 | #define BT_ASSERT_PRE_DEV_PLUGIN_NON_NULL(_plugin) \ |
| 999 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PLUGIN_ID, (_plugin), \ |
| 1000 | _BT_ASSERT_PRE_PLUGIN_NAME) |
| 1001 | |
| 1002 | #define _BT_ASSERT_PRE_PLUGIN_OUT_NAME \ |
| 1003 | _BT_ASSERT_PRE_PLUGIN_NAME " (output)" |
| 1004 | #define _BT_ASSERT_PRE_PLUGIN_OUT_ID \ |
| 1005 | _BT_ASSERT_PRE_PLUGIN_ID "-output" |
| 1006 | |
| 1007 | #define BT_ASSERT_PRE_PLUGIN_OUT_NON_NULL(_plugin) \ |
| 1008 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_PLUGIN_OUT_ID, (_plugin), \ |
| 1009 | _BT_ASSERT_PRE_PLUGIN_OUT_NAME) |
| 1010 | |
| 1011 | #define BT_ASSERT_PRE_DEV_PLUGIN_OUT_NON_NULL(_plugin) \ |
| 1012 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_PLUGIN_OUT_ID, \ |
| 1013 | (_plugin), _BT_ASSERT_PRE_PLUGIN_OUT_NAME) |
| 1014 | |
| 1015 | #define _BT_ASSERT_PRE_ERROR_NAME "Error" |
| 1016 | #define _BT_ASSERT_PRE_ERROR_ID "error" |
| 1017 | |
| 1018 | #define BT_ASSERT_PRE_ERROR_NON_NULL(_error) \ |
| 1019 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_ERROR_ID, (_error), \ |
| 1020 | _BT_ASSERT_PRE_ERROR_NAME) |
| 1021 | |
| 1022 | #define BT_ASSERT_PRE_DEV_ERROR_NON_NULL(_error) \ |
| 1023 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_ERROR_ID, (_error), \ |
| 1024 | _BT_ASSERT_PRE_ERROR_NAME) |
| 1025 | |
| 1026 | #define _BT_ASSERT_PRE_ERROR_CAUSE_NAME "Error cause" |
| 1027 | #define _BT_ASSERT_PRE_ERROR_CAUSE_ID "error-cause" |
| 1028 | |
| 1029 | #define BT_ASSERT_PRE_ERROR_CAUSE_NON_NULL(_error_cause) \ |
| 1030 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_ERROR_CAUSE_ID, \ |
| 1031 | (_error_cause), _BT_ASSERT_PRE_ERROR_CAUSE_NAME) |
| 1032 | |
| 1033 | #define BT_ASSERT_PRE_DEV_ERROR_CAUSE_NON_NULL(_error_cause) \ |
| 1034 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_ERROR_CAUSE_ID, \ |
| 1035 | (_error_cause), _BT_ASSERT_PRE_ERROR_CAUSE_NAME) |
| 1036 | |
| 1037 | #define _BT_ASSERT_PRE_INT_RANGE_NAME "Integer range" |
| 1038 | #define _BT_ASSERT_PRE_INT_RANGE_ID "integer-range" |
| 1039 | |
| 1040 | #define BT_ASSERT_PRE_INT_RANGE_NON_NULL(_int_range) \ |
| 1041 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_INT_RANGE_ID, \ |
| 1042 | (_int_range), _BT_ASSERT_PRE_INT_RANGE_NAME) |
| 1043 | |
| 1044 | #define BT_ASSERT_PRE_DEV_INT_RANGE_NON_NULL(_int_range) \ |
| 1045 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_INT_RANGE_ID, \ |
| 1046 | (_int_range), _BT_ASSERT_PRE_INT_RANGE_NAME) |
| 1047 | |
| 1048 | #define BT_ASSERT_PRE_INT_RANGE_SET_NOT_EMPTY_FROM_FUNC(_func, _range_set) \ |
| 1049 | BT_ASSERT_PRE_FROM_FUNC(_func, "integer-range-set-is-not-empty", \ |
| 1050 | (_range_set)->ranges->len > 0, \ |
| 1051 | "Integer range set is empty: %!+R", (_range_set)) |
| 1052 | |
| 1053 | #define BT_ASSERT_PRE_INT_RANGE_SET_NOT_EMPTY(_range_set) \ |
| 1054 | BT_ASSERT_PRE_INT_RANGE_SET_NOT_EMPTY_FROM_FUNC(__func__, \ |
| 1055 | (_range_set)) |
| 1056 | |
| 1057 | #define _BT_ASSERT_PRE_INT_RANGE_SET_NAME "Integer range set" |
| 1058 | #define _BT_ASSERT_PRE_INT_RANGE_SET_ID "integer-range-set" |
| 1059 | |
| 1060 | #define BT_ASSERT_PRE_INT_RANGE_SET_NON_NULL_FROM_FUNC(_func, _range_set) \ |
| 1061 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \ |
| 1062 | _BT_ASSERT_PRE_INT_RANGE_SET_ID, (_range_set), \ |
| 1063 | _BT_ASSERT_PRE_INT_RANGE_SET_NAME) |
| 1064 | |
| 1065 | #define BT_ASSERT_PRE_INT_RANGE_SET_NON_NULL(_range_set) \ |
| 1066 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_INT_RANGE_SET_ID, \ |
| 1067 | (_range_set), _BT_ASSERT_PRE_INT_RANGE_SET_NAME) |
| 1068 | |
| 1069 | #define BT_ASSERT_PRE_DEV_INT_RANGE_SET_NON_NULL(_range_set) \ |
| 1070 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_INT_RANGE_SET_ID, \ |
| 1071 | (_range_set), _BT_ASSERT_PRE_INT_RANGE_SET_NAME) |
| 1072 | |
| 1073 | #define _BT_ASSERT_PRE_VALUE_HAS_TYPE_COND(_value, _type) \ |
| 1074 | (((struct bt_value *) (_value))->type == (_type)) |
| 1075 | |
| 1076 | #define _BT_ASSERT_PRE_VALUE_HAS_TYPE_FMT \ |
| 1077 | "Value has the wrong type: expected-type=%s, %![value-]+v" |
| 1078 | |
| 1079 | #define _BT_ASSERT_PRE_VALUE_HAS_TYPE_ID(_value_id, _type_id) \ |
| 1080 | "is-" _type_id "-value:" _value_id |
| 1081 | |
| 1082 | #define BT_ASSERT_PRE_VALUE_HAS_TYPE_FROM_FUNC(_func, _value_id, _value, _type_id, _type) \ |
| 1083 | BT_ASSERT_PRE_FROM_FUNC(_func, \ |
| 1084 | _BT_ASSERT_PRE_VALUE_HAS_TYPE_ID(_value_id, _type_id), \ |
| 1085 | _BT_ASSERT_PRE_VALUE_HAS_TYPE_COND((_value), (_type)), \ |
| 1086 | _BT_ASSERT_PRE_VALUE_HAS_TYPE_FMT, \ |
| 1087 | bt_common_value_type_string(_type), (_value)) |
| 1088 | |
| 1089 | #define BT_ASSERT_PRE_VALUE_HAS_TYPE(_value_id, _value, _type_id, _type) \ |
| 1090 | BT_ASSERT_PRE_VALUE_HAS_TYPE_FROM_FUNC(__func__, _value_id, \ |
| 1091 | (_value), _type_id, (_type)); |
| 1092 | |
| 1093 | #define BT_ASSERT_PRE_VALUE_IS_BOOL(_value) \ |
| 1094 | BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1095 | "boolean", BT_VALUE_TYPE_BOOL); |
| 1096 | |
| 1097 | #define BT_ASSERT_PRE_VALUE_IS_UNSIGNED_INT(_value) \ |
| 1098 | BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1099 | "unsigned-int", BT_VALUE_TYPE_UNSIGNED_INTEGER); |
| 1100 | |
| 1101 | #define BT_ASSERT_PRE_VALUE_IS_SIGNED_INT(_value) \ |
| 1102 | BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1103 | "signed-int", BT_VALUE_TYPE_SIGNED_INTEGER); |
| 1104 | |
| 1105 | #define BT_ASSERT_PRE_VALUE_IS_REAL(_value) \ |
| 1106 | BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1107 | "real", BT_VALUE_TYPE_REAL); |
| 1108 | |
| 1109 | #define BT_ASSERT_PRE_VALUE_IS_STRING(_value) \ |
| 1110 | BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1111 | "string", BT_VALUE_TYPE_STRING); |
| 1112 | |
| 1113 | #define BT_ASSERT_PRE_VALUE_IS_ARRAY(_value) \ |
| 1114 | BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1115 | "array", BT_VALUE_TYPE_ARRAY); |
| 1116 | |
| 1117 | #define BT_ASSERT_PRE_VALUE_IS_MAP_FROM_FUNC(_func, _value) \ |
| 1118 | BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1119 | "map", BT_VALUE_TYPE_MAP); |
| 1120 | |
| 1121 | #define BT_ASSERT_PRE_VALUE_IS_MAP(_value) \ |
| 1122 | BT_ASSERT_PRE_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1123 | "map", BT_VALUE_TYPE_MAP); |
| 1124 | |
| 1125 | #define BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE(_value_id, _value, _type_id, _type) \ |
| 1126 | BT_ASSERT_PRE_DEV( \ |
| 1127 | _BT_ASSERT_PRE_VALUE_HAS_TYPE_ID(_value_id, _type_id), \ |
| 1128 | _BT_ASSERT_PRE_VALUE_HAS_TYPE_COND((_value), (_type)), \ |
| 1129 | _BT_ASSERT_PRE_VALUE_HAS_TYPE_FMT, \ |
| 1130 | bt_common_value_type_string(_type), (_value)) |
| 1131 | |
| 1132 | #define BT_ASSERT_PRE_DEV_VALUE_IS_BOOL(_value) \ |
| 1133 | BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1134 | "boolean", BT_VALUE_TYPE_BOOL); |
| 1135 | |
| 1136 | #define BT_ASSERT_PRE_DEV_VALUE_IS_UNSIGNED_INT(_value) \ |
| 1137 | BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1138 | "unsigned-int", BT_VALUE_TYPE_UNSIGNED_INTEGER); |
| 1139 | |
| 1140 | #define BT_ASSERT_PRE_DEV_VALUE_IS_SIGNED_INT(_value) \ |
| 1141 | BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1142 | "signed-int", BT_VALUE_TYPE_SIGNED_INTEGER); |
| 1143 | |
| 1144 | #define BT_ASSERT_PRE_DEV_VALUE_IS_REAL(_value) \ |
| 1145 | BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1146 | "real", BT_VALUE_TYPE_REAL); |
| 1147 | |
| 1148 | #define BT_ASSERT_PRE_DEV_VALUE_IS_STRING(_value) \ |
| 1149 | BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1150 | "string", BT_VALUE_TYPE_STRING); |
| 1151 | |
| 1152 | #define BT_ASSERT_PRE_DEV_VALUE_IS_ARRAY(_value) \ |
| 1153 | BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1154 | "array", BT_VALUE_TYPE_ARRAY); |
| 1155 | |
| 1156 | #define BT_ASSERT_PRE_DEV_VALUE_IS_MAP(_value) \ |
| 1157 | BT_ASSERT_PRE_DEV_VALUE_HAS_TYPE("value-object", (_value), \ |
| 1158 | "map", BT_VALUE_TYPE_MAP); |
| 1159 | |
| 1160 | #define _BT_ASSERT_PRE_VALUE_NAME "Value object" |
| 1161 | #define _BT_ASSERT_PRE_VALUE_ID "value-object" |
| 1162 | |
| 1163 | #define BT_ASSERT_PRE_VALUE_NON_NULL_FROM_FUNC(_func, _value) \ |
| 1164 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, \ |
| 1165 | _BT_ASSERT_PRE_VALUE_ID, (_value), _BT_ASSERT_PRE_VALUE_NAME) |
| 1166 | |
| 1167 | #define BT_ASSERT_PRE_VALUE_NON_NULL(_value) \ |
| 1168 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_VALUE_ID, (_value), \ |
| 1169 | _BT_ASSERT_PRE_VALUE_NAME) |
| 1170 | |
| 1171 | #define BT_ASSERT_PRE_DEV_VALUE_NON_NULL_FROM_FUNC(_func, _value) \ |
| 1172 | BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \ |
| 1173 | _BT_ASSERT_PRE_VALUE_ID, (_value), _BT_ASSERT_PRE_VALUE_NAME) |
| 1174 | |
| 1175 | #define BT_ASSERT_PRE_DEV_VALUE_NON_NULL(_value) \ |
| 1176 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_VALUE_ID, (_value), \ |
| 1177 | _BT_ASSERT_PRE_VALUE_NAME) |
| 1178 | |
| 1179 | #define BT_ASSERT_PRE_PARAM_VALUE_IS_MAP_FROM_FUNC(_func, _value) \ |
| 1180 | BT_ASSERT_PRE_FROM_FUNC(_func, \ |
| 1181 | "is-map-value:parameters-value-object", \ |
| 1182 | !(_value) || bt_value_is_map(_value), \ |
| 1183 | "Parameters value object is not a map value: %!+v", (_value)); |
| 1184 | |
| 1185 | #define BT_ASSERT_PRE_PARAM_VALUE_IS_MAP(_value) \ |
| 1186 | BT_ASSERT_PRE_PARAM_VALUE_IS_MAP_FROM_FUNC(__func__, (_value)) |
| 1187 | |
| 1188 | #define _BT_ASSERT_PRE_RES_OUT_NAME "Result (output)" |
| 1189 | #define _BT_ASSERT_PRE_RES_OUT_ID "result-output" |
| 1190 | |
| 1191 | #define BT_ASSERT_PRE_RES_OUT_NON_NULL(_res) \ |
| 1192 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_RES_OUT_ID, (_res), \ |
| 1193 | _BT_ASSERT_PRE_RES_OUT_NAME) |
| 1194 | |
| 1195 | #define BT_ASSERT_PRE_DEV_RES_OUT_NON_NULL(_res) \ |
| 1196 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_RES_OUT_ID, (_res), \ |
| 1197 | _BT_ASSERT_PRE_RES_OUT_NAME) |
| 1198 | |
| 1199 | #define BT_ASSERT_PRE_METHOD_NON_NULL(_method) \ |
| 1200 | BT_ASSERT_PRE_NON_NULL("method", (_method), "Method"); |
| 1201 | |
| 1202 | #define _BT_ASSERT_PRE_NAME_NAME "Name" |
| 1203 | #define _BT_ASSERT_PRE_NAME_ID "name" |
| 1204 | |
| 1205 | #define BT_ASSERT_PRE_NAME_NON_NULL_FROM_FUNC(_func, _name) \ |
| 1206 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _BT_ASSERT_PRE_NAME_ID, \ |
| 1207 | (_name), _BT_ASSERT_PRE_NAME_NAME) |
| 1208 | |
| 1209 | #define BT_ASSERT_PRE_NAME_NON_NULL(_name) \ |
| 1210 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_NAME_ID, (_name), \ |
| 1211 | _BT_ASSERT_PRE_NAME_NAME) |
| 1212 | |
| 1213 | #define BT_ASSERT_PRE_DEV_NAME_NON_NULL_FROM_FUNC(_func, _name) \ |
| 1214 | BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \ |
| 1215 | _BT_ASSERT_PRE_NAME_ID, (_name), _BT_ASSERT_PRE_NAME_NAME) |
| 1216 | |
| 1217 | #define BT_ASSERT_PRE_DEV_NAME_NON_NULL(_name) \ |
| 1218 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_NAME_ID, (_name), \ |
| 1219 | _BT_ASSERT_PRE_NAME_NAME) |
| 1220 | |
| 1221 | #define _BT_ASSERT_PRE_DESCR_NAME "Description" |
| 1222 | #define _BT_ASSERT_PRE_DESCR_ID "description" |
| 1223 | |
| 1224 | #define BT_ASSERT_PRE_DESCR_NON_NULL(_descr) \ |
| 1225 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_DESCR_ID, (_descr), \ |
| 1226 | _BT_ASSERT_PRE_DESCR_NAME) |
| 1227 | |
| 1228 | #define BT_ASSERT_PRE_DEV_DESCR_NON_NULL(_descr) \ |
| 1229 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_DESCR_ID, (_descr), \ |
| 1230 | _BT_ASSERT_PRE_DESCR_NAME) |
| 1231 | |
| 1232 | #define _BT_ASSERT_PRE_UUID_NAME "UUID" |
| 1233 | #define _BT_ASSERT_PRE_UUID_ID "uuid" |
| 1234 | |
| 1235 | #define BT_ASSERT_PRE_UUID_NON_NULL(_uuid) \ |
| 1236 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_UUID_ID, (_uuid), \ |
| 1237 | _BT_ASSERT_PRE_UUID_NAME) |
| 1238 | |
| 1239 | #define BT_ASSERT_PRE_DEV_UUID_NON_NULL(_uuid) \ |
| 1240 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_UUID_ID, (_uuid), \ |
| 1241 | _BT_ASSERT_PRE_UUID_NAME) |
| 1242 | |
| 1243 | #define _BT_ASSERT_PRE_KEY_NAME "Key" |
| 1244 | #define _BT_ASSERT_PRE_KEY_ID "key" |
| 1245 | |
| 1246 | #define BT_ASSERT_PRE_KEY_NON_NULL_FROM_FUNC(_func, _key) \ |
| 1247 | BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _BT_ASSERT_PRE_KEY_ID, \ |
| 1248 | (_key), _BT_ASSERT_PRE_KEY_NAME) |
| 1249 | |
| 1250 | #define BT_ASSERT_PRE_KEY_NON_NULL(_key) \ |
| 1251 | BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_KEY_ID, (_key), \ |
| 1252 | _BT_ASSERT_PRE_KEY_NAME) |
| 1253 | |
| 1254 | #define BT_ASSERT_PRE_DEV_KEY_NON_NULL(_key) \ |
| 1255 | BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_KEY_ID, (_key), \ |
| 1256 | _BT_ASSERT_PRE_KEY_NAME) |
| 1257 | |
| 1258 | #endif /* BABELTRACE_ASSERT_COND_INTERNAL_H */ |