X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Flib%2Fassert-cond.h;h=bca924e8c029f22254683c53c79d44171e3a6969;hp=411f1364b786deb14805bd2c7a542164597b8bce;hb=867eb7632255f6a84234542198bd7edaac1bce12;hpb=1778c2a4134647150b199b2b57130817144446b0 diff --git a/src/lib/assert-cond.h b/src/lib/assert-cond.h index 411f1364..bca924e8 100644 --- a/src/lib/assert-cond.h +++ b/src/lib/assert-cond.h @@ -17,7 +17,7 @@ */ #define BT_ASSERT_PRE_NON_NULL_FROM_FUNC(_func, _obj_id, _obj, _obj_name) \ BT_ASSERT_PRE_FROM_FUNC(_func, "not-null:" _obj_id, (_obj), \ - "%s is NULL: ", _obj_name) + "%s is NULL.", _obj_name) #define BT_ASSERT_PRE_NON_NULL(_obj_id, _obj, _obj_name) \ BT_ASSERT_PRE_NON_NULL_FROM_FUNC(__func__, _obj_id, (_obj), _obj_name) @@ -569,13 +569,17 @@ BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_FP_ID, (_fp), \ _BT_ASSERT_PRE_FP_NAME) -#define BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(_field_id, _field, _cls_type_id, _cls_type, _name) \ - BT_ASSERT_PRE_DEV("is-" _cls_type_id ":" _field_id, \ +#define BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE_FROM_FUNC(_func, _field_id, _field, _cls_type_id, _cls_type, _name) \ + BT_ASSERT_PRE_DEV_FROM_FUNC(_func, "is-" _cls_type_id ":" _field_id, \ ((const struct bt_field *) (_field))->class->type == (_cls_type), \ _name " has the wrong class type: expected-class-type=%s, " \ "%![field-]+f", \ bt_common_field_class_type_string(_cls_type), (_field)) +#define BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(_field_id, _field, _cls_type_id, _cls_type, _name) \ + BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE_FROM_FUNC(__func__, \ + _field_id, (_field), _cls_type_id, _cls_type, _name) + #define BT_ASSERT_PRE_DEV_FIELD_IS_UNSIGNED_INT(_field_id, _field, _name) \ BT_ASSERT_PRE_DEV( \ "is-unsigned-integer-field:" _field_id, \ @@ -592,14 +596,18 @@ _name " is not a signed integer field: %![field-]+f", \ (_field)) -#define BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY(_field_id, _field, _name) \ - BT_ASSERT_PRE_DEV( \ +#define BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY_FROM_FUNC(_func, _field_id, _field, _name) \ + BT_ASSERT_PRE_DEV_FROM_FUNC(_func, \ "is-array-field:" _field_id, \ ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY || \ ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD || \ ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD, \ _name " is not an array field: %![field-]+f", (_field)) +#define BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY(_field_id, _field, _name) \ + BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY_FROM_FUNC(__func__, _field_id, \ + (_field), _name) + #define BT_ASSERT_PRE_DEV_FIELD_IS_DYNAMIC_ARRAY(_field_id, _field, _name) \ BT_ASSERT_PRE_DEV( \ "is-dynamic-array-field:" _field_id, \ @@ -636,6 +644,11 @@ BT_ASSERT_PRE_NON_NULL(_BT_ASSERT_PRE_FIELD_ID, (_field), \ _BT_ASSERT_PRE_FIELD_NAME) +#define BT_ASSERT_PRE_DEV_FIELD_NON_NULL_FROM_FUNC(_func, _field) \ + BT_ASSERT_PRE_DEV_NON_NULL_FROM_FUNC(_func, \ + _BT_ASSERT_PRE_FIELD_ID, (_field), \ + _BT_ASSERT_PRE_FIELD_NAME) + #define BT_ASSERT_PRE_DEV_FIELD_NON_NULL(_field) \ BT_ASSERT_PRE_DEV_NON_NULL(_BT_ASSERT_PRE_FIELD_ID, (_field), \ _BT_ASSERT_PRE_FIELD_NAME) @@ -817,14 +830,14 @@ _BT_ASSERT_PRE_MSG_HAS_TYPE_ID(_msg_id, _type_id), \ _BT_ASSERT_PRE_MSG_HAS_TYPE_COND((_msg), (_type)), \ _BT_ASSERT_PRE_MSG_HAS_TYPE_FMT, \ - bt_message_type_string(_type), (_msg)) + bt_common_message_type_string(_type), (_msg)) #define BT_ASSERT_PRE_DEV_MSG_HAS_TYPE(_msg_id, _msg, _type_id, _type) \ BT_ASSERT_PRE_DEV( \ _BT_ASSERT_PRE_MSG_HAS_TYPE_ID(_msg_id, _type_id), \ _BT_ASSERT_PRE_MSG_HAS_TYPE_COND((_msg), (_type)), \ _BT_ASSERT_PRE_MSG_HAS_TYPE_FMT, \ - bt_message_type_string(_type), (_msg)) + bt_common_message_type_string(_type), (_msg)) #define _BT_ASSERT_PRE_MSG_NAME "Message" #define _BT_ASSERT_PRE_MSG_ID "message"