doc/api/libbabeltrace2/DoxygenLayout.xml: use `topics` tab
[babeltrace.git] / src / lib / assert-cond.h
index 411f1364b786deb14805bd2c7a542164597b8bce..4868c48c07fd3738912b8a1d6afaf3c02a698b86 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "assert-cond-base.h"
 
+#include <inttypes.h>
+
 /*
  * Asserts that a given variable `_obj` named `_obj_name` (capitalized)
  * and having the ID `_obj_id` (within the function's context) is not
@@ -17,7 +19,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)
        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,                 \
                _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,                    \
        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)
                _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"
This page took 0.025876 seconds and 4 git commands to generate.