* Logic error in internal code, for example an unexpected value in a
`switch` statement.
* Failed assertion (within `BT_ASSERT()`).
-* Unsatisfied library precondition (within `BT_ASSERT_PRE()`).
-* Unsatisfied library postcondition (within `BT_ASSERT_POST()`).
+* Unsatisfied library precondition (within `BT_ASSERT_PRE()` or
+ `BT_ASSERT_PRE_DEV()`).
+* Unsatisfied library postcondition (within `BT_ASSERT_POST()` or
+ `BT_ASSERT_POST_DEV()`).
|Almost none: always enabled.
|_ERROR_
#include <inttypes.h>
#include "common/macros.h"
-#ifdef BT_DEV_MODE
/*
* Prints the details of an unsatisfied postcondition without
* immediately aborting. You should use this within a function which
- * checks postconditions, but which is called from a BT_ASSERT_POST()
- * context, so that the function can still return its result for
- * BT_ASSERT_POST() to evaluate it.
+ * checks postconditions, but which is called from a
+ * BT_ASSERT_POST() context, so that the function can still return
+ * its result for BT_ASSERT_POST() to evaluate it.
*
* Example:
*
* ...
*
* BT_ASSERT_POST(check_complex_postcond(...),
- * "Postcondition is not satisfied: ...", ...);
+ * "Postcondition is not satisfied: ...", ...);
*/
-# define BT_ASSERT_POST_MSG(_fmt, ...) \
+#define BT_ASSERT_POST_MSG(_fmt, ...) \
do { \
bt_lib_log(_BT_LOG_SRCLOC_FUNCTION, __FILE__, \
__LINE__, BT_LOG_FATAL, BT_LOG_TAG, \
} while (0)
/*
- * Developer mode: asserts that the library postcondition `_cond` is
- * satisfied.
+ * Asserts that the library postcondition `_cond` is satisfied.
*
* If `_cond` is false, log a fatal statement using `_fmt` and the
* optional arguments (same usage as BT_LIB_LOGF()), and abort.
* To assert that an internal postcondition is satisfied, use
* BT_ASSERT().
*/
-# define BT_ASSERT_POST(_cond, _fmt, ...) \
+#define BT_ASSERT_POST(_cond, _fmt, ...) \
do { \
if (!(_cond)) { \
BT_ASSERT_POST_MSG("Babeltrace 2 library postcondition not satisfied; error is:"); \
- BT_ASSERT_POST_MSG((_fmt), ##__VA_ARGS__); \
+ BT_ASSERT_POST_MSG(_fmt, ##__VA_ARGS__); \
BT_ASSERT_POST_MSG("Aborting..."); \
abort(); \
} \
* Marks a function as being only used within a BT_ASSERT_POST()
* context.
*/
-# define BT_ASSERT_POST_FUNC
+#define BT_ASSERT_POST_FUNC
+
+#ifdef BT_DEV_MODE
+/* Developer mode version of BT_ASSERT_POST_MSG(). */
+# define BT_ASSERT_POST_DEV_MSG(_fmt, ...) \
+ BT_ASSERT_POST_MSG(_fmt, ##__VA_ARGS__)
+
+/* Developer mode version of BT_ASSERT_POST(). */
+# define BT_ASSERT_POST_DEV(_cond, _fmt, ...) \
+ BT_ASSERT_POST((_cond), _fmt, ##__VA_ARGS__)
+
+/* Developer mode version of `BT_ASSERT_POST_FUNC`. */
+# define BT_ASSERT_POST_DEV_FUNC BT_ASSERT_POST_FUNC
#else
-# define BT_ASSERT_POST(_cond, _fmt, ...) ((void) sizeof((void) (_cond), 0))
-# define BT_ASSERT_POST_FUNC __attribute__((unused))
-# define BT_ASSERT_POST_MSG(_fmt, ...)
+# define BT_ASSERT_POST_DEV_MSG(_fmt, ...)
+# define BT_ASSERT_POST_DEV(_cond, _fmt, ...) ((void) sizeof((void) (_cond), 0))
+# define BT_ASSERT_POST_DEV_FUNC __attribute__((unused))
#endif /* BT_DEV_MODE */
#define BT_ASSERT_POST_SUPPORTED
#include <inttypes.h>
#include "common/macros.h"
-#ifdef BT_DEV_MODE
/*
* Prints the details of an unsatisfied precondition without immediately
* aborting. You should use this within a function which checks
* BT_ASSERT_PRE(check_complex_precond(...),
* "Precondition is not satisfied: ...", ...);
*/
-# define BT_ASSERT_PRE_MSG(_fmt, ...) \
+#define BT_ASSERT_PRE_MSG(_fmt, ...) \
do { \
bt_lib_log(_BT_LOG_SRCLOC_FUNCTION, __FILE__, \
__LINE__, BT_LOG_FATAL, BT_LOG_TAG, \
} while (0)
/*
- * Developer mode: asserts that the library precondition `_cond` is
- * satisfied.
+ * Asserts that the library precondition `_cond` is satisfied.
*
* If `_cond` is false, log a fatal statement using `_fmt` and the
* optional arguments (same usage as BT_LIB_LOGF()), and abort.
* To assert that an internal postcondition is satisfied, use
* BT_ASSERT().
*/
-# define BT_ASSERT_PRE(_cond, _fmt, ...) \
+#define BT_ASSERT_PRE(_cond, _fmt, ...) \
do { \
if (!(_cond)) { \
BT_ASSERT_PRE_MSG("Babeltrace 2 library precondition not satisfied; error is:"); \
- BT_ASSERT_PRE_MSG((_fmt), ##__VA_ARGS__); \
+ BT_ASSERT_PRE_MSG(_fmt, ##__VA_ARGS__); \
BT_ASSERT_PRE_MSG("Aborting..."); \
abort(); \
} \
} while (0)
/*
- * Marks a function as being only used within a BT_ASSERT_PRE() context.
+ * Asserts that a given variable `_obj` named `_obj_name` (capitalized)
+ * is not `NULL`.
*/
-# define BT_ASSERT_PRE_FUNC
-#else
-# define BT_ASSERT_PRE(_cond, _fmt, ...) ((void) sizeof((void) (_cond), 0))
-# define BT_ASSERT_PRE_FUNC __attribute__((unused))
-# define BT_ASSERT_PRE_MSG(_fmt, ...)
-#endif /* BT_DEV_MODE */
+#define BT_ASSERT_PRE_NON_NULL(_obj, _obj_name) \
+ BT_ASSERT_PRE((_obj) != NULL, "%s is NULL: ", _obj_name)
/*
- * Developer mode: asserts that a given variable `_obj` named
- * `_obj_name` (capitalized) is not `NULL`.
+ * Asserts that a given index `_index` is less than a given length
+ * `_length`.
*/
-#define BT_ASSERT_PRE_NON_NULL(_obj, _obj_name) \
- BT_ASSERT_PRE((_obj) != NULL, "%s is NULL: ", _obj_name)
+#define BT_ASSERT_PRE_VALID_INDEX(_index, _length) \
+ BT_ASSERT_PRE((_index) < (_length), \
+ "Index is out of bounds: index=%" PRIu64 ", " \
+ "count=%" PRIu64, (uint64_t) (_index), (uint64_t) (_length))
+
+/*
+ * Marks a function as being only used within a BT_ASSERT_PRE() context.
+ */
+#define BT_ASSERT_PRE_FUNC
+
+#ifdef BT_DEV_MODE
+/* Developer mode version of BT_ASSERT_PRE_MSG(). */
+# define BT_ASSERT_PRE_DEV_MSG(_fmt, ...) \
+ BT_ASSERT_PRE_MSG(_fmt, #__VA_ARGS__)
+
+/* Developer mode version of BT_ASSERT_PRE(). */
+# define BT_ASSERT_PRE_DEV(_cond, _fmt, ...) \
+ BT_ASSERT_PRE((_cond), _fmt, #__VA_ARGS__)
+
+/* Developer mode version of BT_ASSERT_PRE_NON_NULL() */
+# define BT_ASSERT_PRE_DEV_NON_NULL(_obj, _obj_name) \
+ BT_ASSERT_PRE_NON_NULL((_obj), (_obj_name))
/*
* Developer mode: asserts that a given object `_obj` named `_obj_name`
* (capitalized) is NOT frozen. This macro checks the `frozen` field of
* `_obj`.
+ *
+ * This currently only exists in developer mode because some freezing
+ * functions can be called on the fast path, so they too are only
+ * enabled in developer mode.
*/
-#define BT_ASSERT_PRE_HOT(_obj, _obj_name, _fmt, ...) \
+# define BT_ASSERT_PRE_DEV_HOT(_obj, _obj_name, _fmt, ...) \
BT_ASSERT_PRE(!(_obj)->frozen, "%s is frozen" _fmt, _obj_name, \
##__VA_ARGS__)
-/*
- * Developer mode: asserts that a given index `_index` is less than a
- * given length `_length`.
- */
-#define BT_ASSERT_PRE_VALID_INDEX(_index, _length) \
- BT_ASSERT_PRE((_index) < (_length), \
- "Index is out of bounds: index=%" PRIu64 ", " \
- "count=%" PRIu64, (uint64_t) (_index), (uint64_t) (_length))
+/* Developer mode version of BT_ASSERT_PRE_VALID_INDEX() */
+# define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length) \
+ BT_ASSERT_PRE_VALID_INDEX((_index), (_length))
+
+/* Developer mode version of `BT_ASSERT_PRE_FUNC`. */
+# define BT_ASSERT_PRE_DEV_FUNC
+#else
+# define BT_ASSERT_PRE_DEV_MSG(_fmt, ...)
+# define BT_ASSERT_PRE_DEV(_cond, _fmt, ...) ((void) sizeof((void) (_cond), 0))
+# define BT_ASSERT_PRE_DEV_NON_NULL(_obj, _obj_name) \
+ ((void) sizeof((void) (_obj), (void) (_obj_name), 0))
+# define BT_ASSERT_PRE_DEV_HOT(_obj, _obj_name, _fmt, ...) \
+ ((void) sizeof((void) (_obj), (void) (_obj_name), 0))
+# define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length) \
+ ((void) sizeof((void) (_index), (void) (_length), 0))
+# define BT_ASSERT_PRE_DEV_FUNC __attribute__((unused))
+#endif /* BT_DEV_MODE */
#define BT_ASSERT_PRE_SUPPORTED
#include "component-class.h"
#include "lib/func-status.h"
-#define BT_ASSERT_PRE_COMP_CLS_HOT(_cc) \
- BT_ASSERT_PRE_HOT(((const struct bt_component_class *) (_cc)), \
+#define BT_ASSERT_PRE_DEV_COMP_CLS_HOT(_cc) \
+ BT_ASSERT_PRE_DEV_HOT(((const struct bt_component_class *) (_cc)), \
"Component class", ": %!+C", (_cc))
static
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.init = method;
BT_LIB_LOGD("Set source component class's initialization method: "
"%!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.init = method;
BT_LIB_LOGD("Set filter component class's initialization method: "
"%!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.init = method;
BT_LIB_LOGD("Set sink component class's initialization method: "
"%!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.finalize = method;
BT_LIB_LOGD("Set source component class's finalization method: "
"%!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.finalize = method;
BT_LIB_LOGD("Set filter component class's finalization method: "
"%!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.finalize = method;
BT_LIB_LOGD("Set sink component class's finalization method: "
"%!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.query = method;
BT_LIB_LOGD("Set source component class's query method: "
"%!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.query = method;
BT_LIB_LOGD("Set filter component class's query method: "
"%!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.query = method;
BT_LIB_LOGD("Set sink component class's query method: "
"%!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.input_port_connected = method;
BT_LIB_LOGD("Set filter component class's \"input port connected\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.input_port_connected = method;
BT_LIB_LOGD("Set sink component class's \"input port connected\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.output_port_connected = method;
BT_LIB_LOGD("Set source component class's \"output port connected\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.output_port_connected = method;
BT_LIB_LOGD("Set filter component class's \"output port connected\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.graph_is_configured = method;
BT_LIB_LOGD("Set sink component class's \"graph is configured\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_init = method;
BT_LIB_LOGD("Set source component class's message iterator initialization method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_init = method;
BT_LIB_LOGD("Set filter component class's message iterator initialization method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_finalize = method;
BT_LIB_LOGD("Set source component class's message iterator finalization method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_finalize = method;
BT_LIB_LOGD("Set filter component class's message iterator finalization method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_seek_ns_from_origin = method;
BT_LIB_LOGD("Set filter component class's message iterator \"seek nanoseconds from origin\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_seek_ns_from_origin = method;
BT_LIB_LOGD("Set source component class's message iterator \"seek nanoseconds from origin\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_seek_beginning = method;
BT_LIB_LOGD("Set filter component class's message iterator \"seek beginning\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_seek_beginning = method;
BT_LIB_LOGD("Set source component class's message iterator \"seek beginning\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_can_seek_beginning = method;
BT_LIB_LOGD("Set filter component class's message iterator \"can seek beginning\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_can_seek_beginning = method;
BT_LIB_LOGD("Set source component class's message iterator \"can seek beginning\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_can_seek_ns_from_origin = method;
BT_LIB_LOGD("Set filter component class's message iterator \"can seek nanoseconds from origin\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(method, "Method");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
comp_cls->methods.msg_iter_can_seek_ns_from_origin = method;
BT_LIB_LOGD("Set source component class's message iterator \"can seek nanoseconds from origin\" method"
": %!+C", comp_cls);
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(description, "Description");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
g_string_assign(comp_cls->description, description);
BT_LIB_LOGD("Set component class's description: "
"addr=%p, name=\"%s\", type=%s",
{
BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
BT_ASSERT_PRE_NON_NULL(help, "Help");
- BT_ASSERT_PRE_COMP_CLS_HOT(comp_cls);
+ BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
g_string_assign(comp_cls->help, help);
BT_LIB_LOGD("Set component class's help text: %!+C", comp_cls);
return BT_FUNC_STATUS_OK;
const char *bt_component_class_get_name(const struct bt_component_class *comp_cls)
{
- BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
+ BT_ASSERT_PRE_DEV_NON_NULL(comp_cls, "Component class");
return comp_cls->name->str;
}
enum bt_component_class_type bt_component_class_get_type(
const struct bt_component_class *comp_cls)
{
- BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
+ BT_ASSERT_PRE_DEV_NON_NULL(comp_cls, "Component class");
return comp_cls->type;
}
const char *bt_component_class_get_description(
const struct bt_component_class *comp_cls)
{
- BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
+ BT_ASSERT_PRE_DEV_NON_NULL(comp_cls, "Component class");
return comp_cls->description &&
comp_cls->description->str[0] != '\0' ?
comp_cls->description->str : NULL;
const char *bt_component_class_get_help(
const struct bt_component_class *comp_cls)
{
- BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
+ BT_ASSERT_PRE_DEV_NON_NULL(comp_cls, "Component class");
return comp_cls->help &&
comp_cls->help->str[0] != '\0' ? comp_cls->help->str : NULL;
}
{
struct bt_component_class *cls;
- BT_ASSERT_PRE_NON_NULL(component, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(component, "Component");
cls = component->parent.class;
{
struct bt_component_class *cls;
- BT_ASSERT_PRE_NON_NULL(component, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(component, "Component");
cls = component->parent.class;
{
struct bt_component_class *cls;
- BT_ASSERT_PRE_NON_NULL(component, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(component, "Component");
cls = component->parent.class;
enum bt_component_class_type bt_component_get_class_type(
const struct bt_component *component)
{
- BT_ASSERT_PRE_NON_NULL(component, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(component, "Component");
return component->class->type;
}
BT_HIDDEN
uint64_t bt_component_get_input_port_count(const struct bt_component *comp)
{
- BT_ASSERT_PRE_NON_NULL(comp, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(comp, "Component");
return (uint64_t) comp->input_ports->len;
}
BT_HIDDEN
uint64_t bt_component_get_output_port_count(const struct bt_component *comp)
{
- BT_ASSERT_PRE_NON_NULL(comp, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(comp, "Component");
return (uint64_t) comp->output_ports->len;
}
const char *bt_component_get_name(const struct bt_component *component)
{
- BT_ASSERT_PRE_NON_NULL(component, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(component, "Component");
return component->name->str;
}
const struct bt_component_class *bt_component_borrow_class_const(
const struct bt_component *component)
{
- BT_ASSERT_PRE_NON_NULL(component, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(component, "Component");
return component->class;
}
{
struct bt_component *component = (void *) self_comp;
- BT_ASSERT_PRE_NON_NULL(component, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(component, "Component");
return component->user_data;
}
{
struct bt_component *component = (void *) self_comp;
- BT_ASSERT_PRE_NON_NULL(component, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(component, "Component");
component->user_data = data;
BT_LIB_LOGD("Set component's user data: %!+c", component);
}
struct bt_port_output *bt_component_borrow_output_port_by_name(
struct bt_component *comp, const char *name)
{
- BT_ASSERT_PRE_NON_NULL(comp, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(comp, "Component");
return (void *)
borrow_port_by_name(comp->output_ports, name);
}
struct bt_port_input *bt_component_borrow_input_port_by_index(
struct bt_component *comp, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(comp, "Component");
- BT_ASSERT_PRE_VALID_INDEX(index, comp->input_ports->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(comp, "Component");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, comp->input_ports->len);
return (void *)
borrow_port_by_index(comp->input_ports, index);
}
struct bt_port_output *bt_component_borrow_output_port_by_index(
struct bt_component *comp, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(comp, "Component");
- BT_ASSERT_PRE_VALID_INDEX(index, comp->output_ports->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(comp, "Component");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, comp->output_ports->len);
return (void *)
borrow_port_by_index(comp->output_ports, index);
}
bt_logging_level bt_component_get_logging_level(
const struct bt_component *component)
{
- BT_ASSERT_PRE_NON_NULL(component, "Component");
+ BT_ASSERT_PRE_DEV_NON_NULL(component, "Component");
return component->log_level;
}
const struct bt_port_output *bt_connection_borrow_upstream_port_const(
const struct bt_connection *connection)
{
- BT_ASSERT_PRE_NON_NULL(connection, "Connection");
+ BT_ASSERT_PRE_DEV_NON_NULL(connection, "Connection");
return (void *) connection->upstream_port;
}
const struct bt_port_input *bt_connection_borrow_downstream_port_const(
const struct bt_connection *connection)
{
- BT_ASSERT_PRE_NON_NULL(connection, "Connection");
+ BT_ASSERT_PRE_DEV_NON_NULL(connection, "Connection");
return (void *) connection->downstream_port;
}
consume_status = sink_class->methods.consume((void *) comp);
BT_LOGD("User method returned: status=%s",
bt_common_func_status_string(consume_status));
- BT_ASSERT_POST(consume_status == BT_FUNC_STATUS_OK ||
+ BT_ASSERT_POST_DEV(consume_status == BT_FUNC_STATUS_OK ||
consume_status == BT_FUNC_STATUS_END ||
consume_status == BT_FUNC_STATUS_AGAIN ||
consume_status == BT_FUNC_STATUS_ERROR ||
struct bt_component *sink;
GList *current_node;
- BT_ASSERT_PRE(graph->has_sink,
+ BT_ASSERT_PRE_DEV(graph->has_sink,
"Graph has no sink component: %!+g", graph);
BT_LIB_LOGD("Making next sink component consume: %![graph-]+g", graph);
{
enum bt_graph_consume_status status;
- BT_ASSERT_PRE_NON_NULL(graph, "Graph");
- BT_ASSERT_PRE(!graph->canceled, "Graph is canceled: %!+g", graph);
- BT_ASSERT_PRE(graph->can_consume,
+ BT_ASSERT_PRE_DEV_NON_NULL(graph, "Graph");
+ BT_ASSERT_PRE_DEV(!graph->canceled, "Graph is canceled: %!+g", graph);
+ BT_ASSERT_PRE_DEV(graph->can_consume,
"Cannot consume graph in its current state: %!+g", graph);
- BT_ASSERT_PRE(graph->config_state != BT_GRAPH_CONFIGURATION_STATE_FAULTY,
+ BT_ASSERT_PRE_DEV(graph->config_state !=
+ BT_GRAPH_CONFIGURATION_STATE_FAULTY,
"Graph is in a faulty state: %!+g", graph);
bt_graph_set_can_consume(graph, false);
status = bt_graph_configure(graph);
bt_bool bt_graph_is_canceled(const struct bt_graph *graph)
{
- BT_ASSERT_PRE_NON_NULL(graph, "Graph");
+ BT_ASSERT_PRE_DEV_NON_NULL(graph, "Graph");
return graph->canceled ? BT_TRUE : BT_FALSE;
}
};
static inline
-void _bt_graph_set_can_consume(struct bt_graph *graph, bool can_consume)
+void bt_graph_set_can_consume(struct bt_graph *graph, bool can_consume)
{
BT_ASSERT(graph);
graph->can_consume = can_consume;
}
-#ifdef BT_DEV_MODE
-# define bt_graph_set_can_consume _bt_graph_set_can_consume
-#else
-# define bt_graph_set_can_consume(_graph, _can_consume)
-#endif
-
BT_HIDDEN
int bt_graph_consume_sink_no_check(struct bt_graph *graph,
struct bt_component_sink *sink);
struct bt_self_component_port_input_message_iterator *iterator =
(void *) self_iterator;
- BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
+ BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
return iterator->user_data;
}
struct bt_self_component_port_input_message_iterator *iterator =
(void *) self_iterator;
- BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
+ BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
iterator->user_data = data;
BT_LIB_LOGD("Set message iterator's user data: "
"%!+i, user-data-addr=%p", iterator, data);
* time.
*/
-BT_ASSERT_POST_FUNC
+BT_ASSERT_POST_DEV_FUNC
static
bool clock_snapshots_are_monotonic_one(
struct bt_self_component_port_input_message_iterator *iterator,
return result;
}
-BT_ASSERT_POST_FUNC
+BT_ASSERT_POST_DEV_FUNC
static
bool clock_snapshots_are_monotonic(
struct bt_self_component_port_input_message_iterator *iterator,
* stream is compatible with what we've seen before.
*/
-BT_ASSERT_POST_FUNC
+BT_ASSERT_POST_DEV_FUNC
static
bool clock_classes_are_compatible_one(struct bt_self_component_port_input_message_iterator *iterator,
const struct bt_message *msg)
case CLOCK_EXPECTATION_NONE:
if (clock_class) {
- BT_ASSERT_POST_MSG("Expecting no clock class, got one: %![cc-]+K",
+ BT_ASSERT_POST_DEV_MSG(
+ "Expecting no clock class, got one: %![cc-]+K",
clock_class);
result = false;
goto end;
case CLOCK_EXPECTATION_ORIGIN_UNIX:
if (!clock_class) {
- BT_ASSERT_POST_MSG("Expecting a clock class, got none.");
+ BT_ASSERT_POST_DEV_MSG(
+ "Expecting a clock class, got none.");
result = false;
goto end;
}
if (!bt_clock_class_origin_is_unix_epoch(clock_class)) {
- BT_ASSERT_POST_MSG("Expecting a clock class with Unix epoch origin: %![cc-]+K",
+ BT_ASSERT_POST_DEV_MSG(
+ "Expecting a clock class with Unix epoch origin: %![cc-]+K",
clock_class);
result = false;
goto end;
case CLOCK_EXPECTATION_ORIGIN_OTHER_UUID:
if (!clock_class) {
- BT_ASSERT_POST_MSG("Expecting a clock class, got none.");
+ BT_ASSERT_POST_DEV_MSG(
+ "Expecting a clock class, got none.");
result = false;
goto end;
}
if (bt_clock_class_origin_is_unix_epoch(clock_class)) {
- BT_ASSERT_POST_MSG("Expecting a clock class without Unix epoch origin: %![cc-]+K",
+ BT_ASSERT_POST_DEV_MSG(
+ "Expecting a clock class without Unix epoch origin: %![cc-]+K",
clock_class);
result = false;
goto end;
}
if (!clock_class_uuid) {
- BT_ASSERT_POST_MSG("Expecting a clock class with UUID: %![cc-]+K",
+ BT_ASSERT_POST_DEV_MSG(
+ "Expecting a clock class with UUID: %![cc-]+K",
clock_class);
result = false;
goto end;
}
if (bt_uuid_compare(iterator->clock_expectation.uuid, clock_class_uuid)) {
- BT_ASSERT_POST_MSG("Expecting a clock class with UUID, got one "
+ BT_ASSERT_POST_DEV_MSG(
+ "Expecting a clock class with UUID, got one "
"with a different UUID: %![cc-]+K, expected-uuid=%!u",
clock_class, iterator->clock_expectation.uuid);
result = false;
case CLOCK_EXPECTATION_ORIGIN_OTHER_NO_UUID:
if (!clock_class) {
- BT_ASSERT_POST_MSG("Expecting a clock class, got none.");
+ BT_ASSERT_POST_DEV_MSG(
+ "Expecting a clock class, got none.");
result = false;
goto end;
}
if (bt_clock_class_origin_is_unix_epoch(clock_class)) {
- BT_ASSERT_POST_MSG("Expecting a clock class without Unix epoch origin: %![cc-]+K",
+ BT_ASSERT_POST_DEV_MSG(
+ "Expecting a clock class without Unix epoch origin: %![cc-]+K",
clock_class);
result = false;
goto end;
}
if (clock_class_uuid) {
- BT_ASSERT_POST_MSG("Expecting a clock class without UUID: %![cc-]+K",
+ BT_ASSERT_POST_DEV_MSG(
+ "Expecting a clock class without UUID: %![cc-]+K",
clock_class);
result = false;
goto end;
return result;
}
-BT_ASSERT_POST_FUNC
+BT_ASSERT_POST_DEV_FUNC
static
bool clock_classes_are_compatible(
struct bt_self_component_port_input_message_iterator *iterator,
bt_common_func_status_string(status), *user_count);
if (status == BT_FUNC_STATUS_OK) {
- BT_ASSERT_POST(clock_classes_are_compatible(iterator, msgs, *user_count),
+ BT_ASSERT_POST_DEV(clock_classes_are_compatible(iterator, msgs, *user_count),
"Clocks are not compatible");
- BT_ASSERT_POST(clock_snapshots_are_monotonic(iterator, msgs, *user_count),
+ BT_ASSERT_POST_DEV(clock_snapshots_are_monotonic(iterator, msgs, *user_count),
"Clock snapshots are not monotonic");
}
{
enum bt_message_iterator_next_status status = BT_FUNC_STATUS_OK;
- BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
- BT_ASSERT_PRE_NON_NULL(msgs, "Message array (output)");
- BT_ASSERT_PRE_NON_NULL(user_count, "Message count (output)");
- BT_ASSERT_PRE(iterator->state ==
+ BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
+ BT_ASSERT_PRE_DEV_NON_NULL(msgs, "Message array (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(user_count, "Message count (output)");
+ BT_ASSERT_PRE_DEV(iterator->state ==
BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE,
"Message iterator's \"next\" called, but "
"message iterator is in the wrong state: %!+i", iterator);
BT_ASSERT(iterator->upstream_component);
BT_ASSERT(iterator->upstream_component->class);
- BT_ASSERT_PRE(
+ BT_ASSERT_PRE_DEV(
bt_component_borrow_graph(iterator->upstream_component)->config_state !=
BT_GRAPH_CONFIGURATION_STATE_CONFIGURING,
"Graph is not configured: %!+g",
switch (status) {
case BT_FUNC_STATUS_OK:
- BT_ASSERT_POST(*user_count <= MSG_BATCH_SIZE,
+ BT_ASSERT_POST_DEV(*user_count <= MSG_BATCH_SIZE,
"Invalid returned message count: greater than "
"batch size: count=%" PRIu64 ", batch-size=%u",
*user_count, MSG_BATCH_SIZE);
enum bt_message_iterator_next_status status;
int graph_status;
- BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
- BT_ASSERT_PRE_NON_NULL(msgs_to_user, "Message array (output)");
- BT_ASSERT_PRE_NON_NULL(count_to_user, "Message count (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
+ BT_ASSERT_PRE_DEV_NON_NULL(msgs_to_user, "Message array (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(count_to_user, "Message count (output)");
BT_LIB_LOGD("Getting next output port message iterator's messages: "
"%!+i", iterator);
graph_status = bt_graph_consume_sink_no_check(iterator->graph,
bt_self_component_port_input_message_iterator_borrow_component(
struct bt_self_component_port_input_message_iterator *iterator)
{
- BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
+ BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
return iterator->upstream_component;
}
bt_self_component_port_input_message_iterator_borrow_component_const(
const struct bt_self_component_port_input_message_iterator *iterator)
{
- BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
+ BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
return iterator->upstream_component;
}
struct bt_self_component_port_input_message_iterator *iterator =
(void *) self_iterator;
- BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
+ BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
return (void *) iterator->upstream_component;
}
struct bt_self_component_port_input_message_iterator *iterator =
(void *) self_iterator;
- BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
+ BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
return (void *) iterator->upstream_port;
}
(const void *) msg;
clk_snapshot = event_msg->default_cs;
- BT_ASSERT_POST(clk_snapshot,
+ BT_ASSERT_POST_DEV(clk_snapshot,
"Event message has no default clock snapshot: %!+n",
event_msg);
break;
(const void *) msg;
clk_snapshot = packet_msg->default_cs;
- BT_ASSERT_POST(clk_snapshot,
+ BT_ASSERT_POST_DEV(clk_snapshot,
"Packet message has no default clock snapshot: %!+n",
packet_msg);
break;
struct bt_message_discarded_items *msg_disc_items =
(void *) msg;
- BT_ASSERT_POST(msg_disc_items->default_begin_cs &&
+ BT_ASSERT_POST_DEV(msg_disc_items->default_begin_cs &&
msg_disc_items->default_end_cs,
"Discarded events/packets message has no default clock snapshots: %!+n",
msg_disc_items);
switch (status) {
case BT_FUNC_STATUS_OK:
- BT_ASSERT_POST(user_count <= MSG_BATCH_SIZE,
+ BT_ASSERT_POST_DEV(user_count <= MSG_BATCH_SIZE,
"Invalid returned message count: greater than "
"batch size: count=%" PRIu64 ", batch-size=%u",
user_count, MSG_BATCH_SIZE);
struct bt_message_discarded_items *disc_items_msg = (void *) message;
BT_ASSERT(message);
- BT_ASSERT_PRE_HOT(message, "Message", ": %!+n", message);
+ BT_ASSERT_PRE_DEV_HOT(message, "Message", ": %!+n", message);
bt_property_uint_set(&disc_items_msg->count, count);
}
{
struct bt_message_discarded_items *disc_items_msg = (void *) message;
- BT_ASSERT_PRE_NON_NULL(count, "Count (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(count, "Count (output)");
BT_ASSERT(message);
*count = disc_items_msg->count.value;
return disc_items_msg->count.base.avail;
struct bt_message_discarded_items *disc_items_msg = (void *) message;
BT_ASSERT(message);
- BT_ASSERT_PRE(disc_items_msg->stream->class->default_clock_class,
+ BT_ASSERT_PRE_DEV(disc_items_msg->stream->class->default_clock_class,
"Message's stream's class has no default clock class: "
"%![msg-]+n, %![sc-]+S",
message, disc_items_msg->stream->class);
struct bt_message_discarded_items *disc_items_msg = (void *) message;
BT_ASSERT(message);
- BT_ASSERT_PRE(disc_items_msg->stream->class->default_clock_class,
+ BT_ASSERT_PRE_DEV(disc_items_msg->stream->class->default_clock_class,
"Message's stream's class has no default clock class: "
"%![msg-]+n, %![sc-]+S",
message, disc_items_msg->stream->class);
struct bt_stream *bt_message_discarded_events_borrow_stream(
struct bt_message *message)
{
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
return borrow_discarded_items_message_stream(message);
}
bt_message_discarded_events_borrow_beginning_default_clock_snapshot_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
return borrow_discarded_items_message_beginning_default_clock_snapshot_const(
msg);
}
bt_message_discarded_events_borrow_end_default_clock_snapshot_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
return borrow_discarded_items_message_end_default_clock_snapshot_const(
msg);
}
enum bt_property_availability bt_message_discarded_events_get_count(
const struct bt_message *message, uint64_t *count)
{
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message,
+ BT_MESSAGE_TYPE_DISCARDED_EVENTS);
return get_discarded_items_message_count(message, count);
}
struct bt_stream *bt_message_discarded_packets_borrow_stream(
struct bt_message *message)
{
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message,
+ BT_MESSAGE_TYPE_DISCARDED_PACKETS);
return borrow_discarded_items_message_stream(message);
}
bt_message_discarded_packets_borrow_beginning_default_clock_snapshot_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
return borrow_discarded_items_message_beginning_default_clock_snapshot_const(
msg);
}
bt_message_discarded_packets_borrow_end_default_clock_snapshot_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
return borrow_discarded_items_message_end_default_clock_snapshot_const(
msg);
}
enum bt_property_availability bt_message_discarded_packets_get_count(
const struct bt_message *message, uint64_t *count)
{
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message,
+ BT_MESSAGE_TYPE_DISCARDED_PACKETS);
return get_discarded_items_message_count(message, count);
}
bt_message_discarded_events_borrow_stream_class_default_clock_class_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_EVENTS);
return borrow_discarded_items_message_stream_class_default_clock_class(
msg);
}
bt_message_discarded_packets_borrow_stream_class_default_clock_class_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_DISCARDED_PACKETS);
return borrow_discarded_items_message_stream_class_default_clock_class(
msg);
}
{
struct bt_message_event *event_message;
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_EVENT);
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_EVENT);
event_message = container_of(message,
struct bt_message_event, parent);
return event_message->event;
struct bt_message_event *event_msg = (void *) msg;
struct bt_stream_class *stream_class;
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_EVENT);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_EVENT);
stream_class = bt_event_class_borrow_stream_class_inline(
event_msg->event->class);
BT_ASSERT(stream_class);
- BT_ASSERT_PRE(stream_class->default_clock_class,
+ BT_ASSERT_PRE_DEV(stream_class->default_clock_class,
"Message's stream's class has no default clock class: "
"%![msg-]+n, %![sc-]+S", msg, stream_class);
return event_msg->default_cs;
struct bt_message_event *event_msg = (void *) msg;
struct bt_stream_class *stream_class;
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_EVENT);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_EVENT);
stream_class = bt_event_class_borrow_stream_class_inline(
event_msg->event->class);
BT_ASSERT(stream_class);
{
struct bt_message_message_iterator_inactivity *inactivity = (void *) msg;
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg,
+ BT_MESSAGE_TYPE_MESSAGE_ITERATOR_INACTIVITY);
return inactivity->default_cs;
}
enum bt_message_type bt_message_get_type(
const struct bt_message *message)
{
- BT_ASSERT_PRE_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
return message->type;
}
struct bt_graph *graph;
};
-#define BT_ASSERT_PRE_MSG_IS_TYPE(_msg, _type) \
- BT_ASSERT_PRE(((struct bt_message *) (_msg))->type == (_type), \
- "Message has the wrong type: expected-type=%s, " \
- "%![msg-]+n", bt_message_type_string(_type), \
- (_msg))
+#define _BT_ASSERT_PRE_MSG_IS_TYPE_COND(_msg, _type) \
+ (((struct bt_message *) (_msg))->type == (_type))
+
+#define _BT_ASSERT_PRE_MSG_IS_TYPE_FMT \
+ "Message has the wrong type: expected-type=%s, %![msg-]+n"
+
+#define BT_ASSERT_PRE_MSG_IS_TYPE(_msg, _type) \
+ BT_ASSERT_PRE( \
+ _BT_ASSERT_PRE_MSG_IS_TYPE_COND((_msg), (_type)), \
+ _BT_ASSERT_PRE_MSG_IS_TYPE_FMT, \
+ bt_message_type_string(_type), (_msg))
+
+#define BT_ASSERT_PRE_DEV_MSG_IS_TYPE(_msg, _type) \
+ BT_ASSERT_PRE_DEV( \
+ _BT_ASSERT_PRE_MSG_IS_TYPE_COND((_msg), (_type)), \
+ _BT_ASSERT_PRE_MSG_IS_TYPE_FMT, \
+ bt_message_type_string(_type), (_msg))
BT_HIDDEN
void bt_message_init(struct bt_message *message,
{
struct bt_message_packet *packet_msg = (void *) message;
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message,
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message,
BT_MESSAGE_TYPE_PACKET_BEGINNING);
return packet_msg->packet;
}
{
struct bt_message_packet *packet_msg = (void *) message;
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message,
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message,
BT_MESSAGE_TYPE_PACKET_END);
return packet_msg->packet;
}
struct bt_message_packet *packet_msg = (void *) message;
BT_ASSERT(message);
- BT_ASSERT_PRE(packet_msg->packet->stream->class->default_clock_class,
+ BT_ASSERT_PRE_DEV(
+ packet_msg->packet->stream->class->default_clock_class,
"Message's stream's class has no default clock class: "
"%![msg-]+n, %![sc-]+S",
message, packet_msg->packet->stream->class);
bt_message_packet_beginning_borrow_default_clock_snapshot_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_BEGINNING);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_BEGINNING);
return borrow_packet_message_default_clock_snapshot_const(msg);
}
bt_message_packet_end_borrow_default_clock_snapshot_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_END);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_END);
return borrow_packet_message_default_clock_snapshot_const(msg);
}
bt_message_packet_beginning_borrow_stream_class_default_clock_class_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_BEGINNING);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_BEGINNING);
return borrow_packet_message_stream_class_default_clock_class(msg);
}
bt_message_packet_end_borrow_stream_class_default_clock_class_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_END);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_PACKET_END);
return borrow_packet_message_stream_class_default_clock_class(msg);
}
struct bt_stream *bt_message_stream_beginning_borrow_stream(
struct bt_message *message)
{
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_STREAM_BEGINNING);
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message,
+ BT_MESSAGE_TYPE_STREAM_BEGINNING);
return borrow_stream_message_stream(message);
}
struct bt_stream *bt_message_stream_end_borrow_stream(
struct bt_message *message)
{
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_STREAM_END);
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message,
+ BT_MESSAGE_TYPE_STREAM_END);
return borrow_stream_message_stream(message);
}
struct bt_stream_class *sc;
BT_ASSERT(msg);
- BT_ASSERT_PRE_HOT(msg, "Message", ": %!+n", msg);
+ BT_ASSERT_PRE_DEV_HOT(msg, "Message", ": %!+n", msg);
sc = stream_msg->stream->class;
BT_ASSERT(sc);
BT_ASSERT_PRE(sc->default_clock_class,
BT_ASSERT(msg);
sc = stream_msg->stream->class;
BT_ASSERT(sc);
- BT_ASSERT_PRE(sc->default_clock_class,
+ BT_ASSERT_PRE_DEV(sc->default_clock_class,
"Message's stream's class has no default clock class: "
"%![msg-]+n, %![sc-]+S", msg, sc);
BT_ASSERT(stream_msg->default_cs);
bt_message_stream_beginning_borrow_default_clock_snapshot_const(
const bt_message *message, const bt_clock_snapshot **snapshot)
{
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_STREAM_BEGINNING);
-
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message,
+ BT_MESSAGE_TYPE_STREAM_BEGINNING);
return bt_message_stream_borrow_default_clock_snapshot_const(
message, snapshot);
}
bt_message_stream_end_borrow_default_clock_snapshot_const(
const bt_message *message, const bt_clock_snapshot **snapshot)
{
- BT_ASSERT_PRE_NON_NULL(message, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_STREAM_END);
-
+ BT_ASSERT_PRE_DEV_NON_NULL(message, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(message, BT_MESSAGE_TYPE_STREAM_END);
return bt_message_stream_borrow_default_clock_snapshot_const(
message, snapshot);
}
bt_message_stream_beginning_borrow_stream_class_default_clock_class_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg,
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg,
BT_MESSAGE_TYPE_STREAM_BEGINNING);
return borrow_stream_message_stream_class_default_clock_class(msg);
}
bt_message_stream_end_borrow_stream_class_default_clock_class_const(
const struct bt_message *msg)
{
- BT_ASSERT_PRE_NON_NULL(msg, "Message");
- BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_END);
+ BT_ASSERT_PRE_DEV_NON_NULL(msg, "Message");
+ BT_ASSERT_PRE_DEV_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_END);
return borrow_stream_message_stream_class_default_clock_class(msg);
}
const char *bt_port_get_name(const struct bt_port *port)
{
- BT_ASSERT_PRE_NON_NULL(port, "Port");
+ BT_ASSERT_PRE_DEV_NON_NULL(port, "Port");
return port->name->str;
}
enum bt_port_type bt_port_get_type(const struct bt_port *port)
{
- BT_ASSERT_PRE_NON_NULL(port, "Port");
+ BT_ASSERT_PRE_DEV_NON_NULL(port, "Port");
return port->type;
}
const struct bt_connection *bt_port_borrow_connection_const(
const struct bt_port *port)
{
- BT_ASSERT_PRE_NON_NULL(port, "Port");
+ BT_ASSERT_PRE_DEV_NON_NULL(port, "Port");
return port->connection;
}
const struct bt_component *bt_port_borrow_component_const(
const struct bt_port *port)
{
- BT_ASSERT_PRE_NON_NULL(port, "Port");
+ BT_ASSERT_PRE_DEV_NON_NULL(port, "Port");
return bt_port_borrow_component_inline(port);
}
struct bt_self_component *bt_self_component_port_borrow_component(
struct bt_self_component_port *port)
{
- BT_ASSERT_PRE_NON_NULL(port, "Port");
+ BT_ASSERT_PRE_DEV_NON_NULL(port, "Port");
return (void *) bt_object_borrow_parent((void *) port);
}
bt_bool bt_port_is_connected(const struct bt_port *port)
{
- BT_ASSERT_PRE_NON_NULL(port, "Port");
+ BT_ASSERT_PRE_DEV_NON_NULL(port, "Port");
return port->connection ? BT_TRUE : BT_FALSE;
}
void *bt_self_component_port_get_data(const struct bt_self_component_port *port)
{
- BT_ASSERT_PRE_NON_NULL(port, "Port");
+ BT_ASSERT_PRE_DEV_NON_NULL(port, "Port");
return ((struct bt_port *) port)->user_data;
}
bt_bool bt_query_executor_is_canceled(const struct bt_query_executor *query_exec)
{
- BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor");
+ BT_ASSERT_PRE_DEV_NON_NULL(query_exec, "Query executor");
return query_exec->canceled;
}
return;
}
-#ifdef BT_ASSERT_PRE
- BT_ASSERT_PRE(obj->is_shared, "Object is not shared: %!+O", obj);
+#ifdef BT_ASSERT_PRE_DEV
+ BT_ASSERT_PRE_DEV(obj->is_shared, "Object is not shared: %!+O", obj);
#endif
bt_object_get_no_null_check(obj);
return;
}
-#ifdef BT_ASSERT_PRE
- BT_ASSERT_PRE(obj->is_shared, "Object is not shared: %!+O", obj);
- BT_ASSERT_PRE(bt_object_get_ref_count(obj) > 0,
+#ifdef BT_ASSERT_PRE_DEV
+ BT_ASSERT_PRE_DEV(obj->is_shared, "Object is not shared: %!+O", obj);
+ BT_ASSERT_PRE_DEV(bt_object_get_ref_count(obj) > 0,
"Decrementing a reference count set to 0: %!+O", ptr);
#endif
uint64_t bt_plugin_set_get_plugin_count(struct bt_plugin_set *plugin_set)
{
- BT_ASSERT_PRE_NON_NULL(plugin_set, "Plugin set");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin_set, "Plugin set");
return (uint64_t) plugin_set->plugins->len;
}
const struct bt_plugin *bt_plugin_set_borrow_plugin_by_index_const(
const struct bt_plugin_set *plugin_set, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(plugin_set, "Plugin set");
- BT_ASSERT_PRE_VALID_INDEX(index, plugin_set->plugins->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin_set, "Plugin set");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, plugin_set->plugins->len);
return g_ptr_array_index(plugin_set->plugins, index);
}
const char *bt_plugin_get_name(const struct bt_plugin *plugin)
{
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
return plugin->info.name_set ? plugin->info.name->str : NULL;
}
const char *bt_plugin_get_author(const struct bt_plugin *plugin)
{
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
return plugin->info.author_set ? plugin->info.author->str : NULL;
}
const char *bt_plugin_get_license(const struct bt_plugin *plugin)
{
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
return plugin->info.license_set ? plugin->info.license->str : NULL;
}
const char *bt_plugin_get_path(const struct bt_plugin *plugin)
{
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
return plugin->info.path_set ? plugin->info.path->str : NULL;
}
const char *bt_plugin_get_description(const struct bt_plugin *plugin)
{
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
return plugin->info.description_set ?
plugin->info.description->str : NULL;
}
enum bt_property_availability avail =
BT_PROPERTY_AVAILABILITY_AVAILABLE;
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
if (!plugin->info.version_set) {
BT_LIB_LOGD("Plugin's version is not set: %!+l", plugin);
uint64_t bt_plugin_get_source_component_class_count(const struct bt_plugin *plugin)
{
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
return (uint64_t) plugin->src_comp_classes->len;
}
uint64_t bt_plugin_get_filter_component_class_count(const struct bt_plugin *plugin)
{
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
return (uint64_t) plugin->flt_comp_classes->len;
}
uint64_t bt_plugin_get_sink_component_class_count(const struct bt_plugin *plugin)
{
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
return (uint64_t) plugin->sink_comp_classes->len;
}
const struct bt_plugin *plugin, GPtrArray *comp_classes,
uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
- BT_ASSERT_PRE_VALID_INDEX(index, comp_classes->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, comp_classes->len);
return g_ptr_array_index(comp_classes, index);
}
struct bt_component_class *comp_class = NULL;
size_t i;
- BT_ASSERT_PRE_NON_NULL(plugin, "Plugin");
- BT_ASSERT_PRE_NON_NULL(name, "Name");
+ BT_ASSERT_PRE_DEV_NON_NULL(plugin, "Plugin");
+ BT_ASSERT_PRE_DEV_NON_NULL(name, "Name");
for (i = 0; i < comp_classes->len; i++) {
struct bt_component_class *comp_class_candidate =
#include "common/assert.h"
#include "lib/func-status.h"
-#define BT_ASSERT_PRE_CLOCK_CLASS_HOT(_cc) \
- BT_ASSERT_PRE_HOT((_cc), "Clock class", ": %!+K", (_cc))
+#define BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(_cc) \
+ BT_ASSERT_PRE_DEV_HOT((_cc), "Clock class", ": %!+K", (_cc))
static
void destroy_clock_class(struct bt_object *obj)
const char *bt_clock_class_get_name(const struct bt_clock_class *clock_class)
{
- BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class");
return clock_class->name.value;
}
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
BT_ASSERT_PRE_NON_NULL(name, "Name");
- BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class);
+ BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
g_string_assign(clock_class->name.str, name);
clock_class->name.value = clock_class->name.str->str;
BT_LIB_LOGD("Set clock class's name: %!+K", clock_class);
const char *bt_clock_class_get_description(
const struct bt_clock_class *clock_class)
{
- BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class");
return clock_class->description.value;
}
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
BT_ASSERT_PRE_NON_NULL(descr, "Description");
- BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class);
+ BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
g_string_assign(clock_class->description.str, descr);
clock_class->description.value = clock_class->description.str->str;
BT_LIB_LOGD("Set clock class's description: %!+K",
uint64_t bt_clock_class_get_frequency(const struct bt_clock_class *clock_class)
{
- BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class");
return clock_class->frequency;
}
uint64_t frequency)
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
- BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class);
+ BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
BT_ASSERT_PRE(frequency != UINT64_C(-1) && frequency != 0,
"Invalid frequency: %![cc-]+K, new-freq=%" PRIu64,
clock_class, frequency);
uint64_t bt_clock_class_get_precision(const struct bt_clock_class *clock_class)
{
- BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class");
return clock_class->precision;
}
uint64_t precision)
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
- BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class);
+ BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
BT_ASSERT_PRE(precision != UINT64_C(-1),
"Invalid precision: %![cc-]+K, new-precision=%" PRIu64,
clock_class, precision);
void bt_clock_class_get_offset(const struct bt_clock_class *clock_class,
int64_t *seconds, uint64_t *cycles)
{
- BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
- BT_ASSERT_PRE_NON_NULL(seconds, "Seconds (output)");
- BT_ASSERT_PRE_NON_NULL(cycles, "Cycles (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class");
+ BT_ASSERT_PRE_DEV_NON_NULL(seconds, "Seconds (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(cycles, "Cycles (output)");
*seconds = clock_class->offset_seconds;
*cycles = clock_class->offset_cycles;
}
int64_t seconds, uint64_t cycles)
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
- BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class);
+ BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
BT_ASSERT_PRE(cycles < clock_class->frequency,
"Offset (cycles) is greater than clock class's frequency: "
"%![cc-]+K, new-offset-cycles=%" PRIu64, clock_class, cycles);
bt_bool bt_clock_class_origin_is_unix_epoch(const struct bt_clock_class *clock_class)
{
- BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class");
return (bool) clock_class->origin_is_unix_epoch;
}
bt_bool origin_is_unix_epoch)
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
- BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class);
+ BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
clock_class->origin_is_unix_epoch = (bool) origin_is_unix_epoch;
BT_LIB_LOGD("Set clock class's origin is Unix epoch property: %!+K",
clock_class);
bt_uuid bt_clock_class_get_uuid(const struct bt_clock_class *clock_class)
{
- BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class");
return clock_class->uuid.value;
}
{
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
BT_ASSERT_PRE_NON_NULL(uuid, "UUID");
- BT_ASSERT_PRE_CLOCK_CLASS_HOT(clock_class);
+ BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
bt_uuid_copy(clock_class->uuid.uuid, uuid);
clock_class->uuid.value = clock_class->uuid.uuid;
BT_LIB_LOGD("Set clock class's UUID: %!+K", clock_class);
{
int ret;
- BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
- BT_ASSERT_PRE_NON_NULL(ns, "Nanoseconds (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_class, "Clock class");
+ BT_ASSERT_PRE_DEV_NON_NULL(ns, "Nanoseconds (output)");
ret = bt_util_ns_from_origin_clock_class(clock_class, cycles, ns);
if (ret) {
ret = BT_FUNC_STATUS_OVERFLOW;
uint64_t bt_clock_snapshot_get_value(
const struct bt_clock_snapshot *clock_snapshot)
{
- BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot");
- BT_ASSERT_PRE(clock_snapshot->is_set,
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot");
+ BT_ASSERT_PRE_DEV(clock_snapshot->is_set,
"Clock snapshot is not set: %!+k", clock_snapshot);
return clock_snapshot->value_cycles;
}
{
int ret = BT_FUNC_STATUS_OK;
- BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot");
- BT_ASSERT_PRE_NON_NULL(ret_value_ns, "Value (ns) (output)");
- BT_ASSERT_PRE(clock_snapshot->is_set,
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot");
+ BT_ASSERT_PRE_DEV_NON_NULL(ret_value_ns, "Value (ns) (output)");
+ BT_ASSERT_PRE_DEV(clock_snapshot->is_set,
"Clock snapshot is not set: %!+k", clock_snapshot);
if (clock_snapshot->ns_from_origin_overflows) {
const struct bt_clock_class *bt_clock_snapshot_borrow_clock_class_const(
const struct bt_clock_snapshot *clock_snapshot)
{
- BT_ASSERT_PRE_NON_NULL(clock_snapshot, "Clock snapshot");
+ BT_ASSERT_PRE_DEV_NON_NULL(clock_snapshot, "Clock snapshot");
return clock_snapshot->clock_class;
}
#include "utils.h"
#include "lib/func-status.h"
-#define BT_ASSERT_PRE_EVENT_CLASS_HOT(_ec) \
- BT_ASSERT_PRE_HOT(((const struct bt_event_class *) (_ec)), \
+#define BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(_ec) \
+ BT_ASSERT_PRE_DEV_HOT(((const struct bt_event_class *) (_ec)), \
"Event class", ": %!+E", (_ec))
static
const char *bt_event_class_get_name(const struct bt_event_class *event_class)
{
- BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
+ BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class");
return event_class->name.value;
}
{
BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
BT_ASSERT_PRE_NON_NULL(name, "Name");
- BT_ASSERT_PRE_EVENT_CLASS_HOT(event_class);
+ BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
g_string_assign(event_class->name.str, name);
event_class->name.value = event_class->name.str->str;
BT_LIB_LOGD("Set event class's name: %!+E", event_class);
uint64_t bt_event_class_get_id(const struct bt_event_class *event_class)
{
- BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
+ BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class");
return event_class->id;
}
const struct bt_event_class *event_class,
enum bt_event_class_log_level *log_level)
{
- BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
- BT_ASSERT_PRE_NON_NULL(log_level, "Log level (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class");
+ BT_ASSERT_PRE_DEV_NON_NULL(log_level, "Log level (output)");
*log_level = (enum bt_event_class_log_level)
event_class->log_level.value;
return event_class->log_level.base.avail;
enum bt_event_class_log_level log_level)
{
BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
- BT_ASSERT_PRE_EVENT_CLASS_HOT(event_class);
+ BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
bt_property_uint_set(&event_class->log_level,
(uint64_t) log_level);
BT_LIB_LOGD("Set event class's log level: %!+E", event_class);
const char *bt_event_class_get_emf_uri(const struct bt_event_class *event_class)
{
- BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
+ BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class");
return event_class->emf_uri.value;
}
{
BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
BT_ASSERT_PRE_NON_NULL(emf_uri, "EMF URI");
- BT_ASSERT_PRE_EVENT_CLASS_HOT(event_class);
+ BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
g_string_assign(event_class->emf_uri.str, emf_uri);
event_class->emf_uri.value = event_class->emf_uri.str->str;
BT_LIB_LOGD("Set event class's EMF URI: %!+E", event_class);
struct bt_stream_class *bt_event_class_borrow_stream_class(
struct bt_event_class *event_class)
{
- BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
+ BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class");
return bt_event_class_borrow_stream_class_inline(event_class);
}
bt_event_class_borrow_specific_context_field_class_const(
const struct bt_event_class *event_class)
{
- BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
+ BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class");
return event_class->specific_context_fc;
}
bt_event_class_borrow_specific_context_field_class(
struct bt_event_class *event_class)
{
- BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
+ BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class");
return event_class->specific_context_fc;
}
BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
BT_ASSERT_PRE_NON_NULL(field_class, "Field class");
- BT_ASSERT_PRE_EVENT_CLASS_HOT(event_class);
+ BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
BT_ASSERT_PRE(bt_field_class_get_type(field_class) ==
BT_FIELD_CLASS_TYPE_STRUCTURE,
"Specific context field class is not a structure field class: "
const struct bt_field_class *bt_event_class_borrow_payload_field_class_const(
const struct bt_event_class *event_class)
{
- BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
+ BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class");
return event_class->payload_fc;
}
struct bt_field_class *bt_event_class_borrow_payload_field_class(
struct bt_event_class *event_class)
{
- BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
+ BT_ASSERT_PRE_DEV_NON_NULL(event_class, "Event class");
return event_class->payload_fc;
}
BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
BT_ASSERT_PRE_NON_NULL(field_class, "Field class");
- BT_ASSERT_PRE_EVENT_CLASS_HOT(event_class);
+ BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
BT_ASSERT_PRE(bt_field_class_get_type(field_class) ==
BT_FIELD_CLASS_TYPE_STRUCTURE,
"Payload field class is not a structure field class: %!+F",
struct bt_event_class *bt_event_borrow_class(struct bt_event *event)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
return event->class;
}
struct bt_stream *bt_event_borrow_stream(struct bt_event *event)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
return event->stream;
}
struct bt_field *bt_event_borrow_common_context_field(struct bt_event *event)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
return event->common_context_field;
}
const struct bt_field *bt_event_borrow_common_context_field_const(
const struct bt_event *event)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
return event->common_context_field;
}
struct bt_field *bt_event_borrow_specific_context_field(struct bt_event *event)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
return event->specific_context_field;
}
const struct bt_field *bt_event_borrow_specific_context_field_const(
const struct bt_event *event)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
return event->specific_context_field;
}
struct bt_field *bt_event_borrow_payload_field(struct bt_event *event)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
return event->payload_field;
}
const struct bt_field *bt_event_borrow_payload_field_const(
const struct bt_event *event)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
return event->payload_field;
}
struct bt_packet *bt_event_borrow_packet(struct bt_event *event)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
return event->packet;
}
#include "packet.h"
#include "stream.h"
-#define BT_ASSERT_PRE_EVENT_HOT(_event) \
- BT_ASSERT_PRE_HOT(((const struct bt_event *) (_event)), \
+#define BT_ASSERT_PRE_DEV_EVENT_HOT(_event) \
+ BT_ASSERT_PRE_DEV_HOT(((const struct bt_event *) (_event)), \
"Event", ": %!+e", (_event))
struct bt_event {
static inline
void bt_event_set_packet(struct bt_event *event, struct bt_packet *packet)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
- BT_ASSERT_PRE_NON_NULL(packet, "Packet");
- BT_ASSERT_PRE_EVENT_HOT(event);
- BT_ASSERT_PRE(bt_event_class_borrow_stream_class(
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(packet, "Packet");
+ BT_ASSERT_PRE_DEV_EVENT_HOT(event);
+ BT_ASSERT_PRE_DEV(bt_event_class_borrow_stream_class(
event->class) == packet->stream->class,
"Packet's stream class and event's stream class differ: "
"%![event-]+e, %![packet-]+a", event, packet);
static inline
void bt_event_set_stream(struct bt_event *event, struct bt_stream *stream)
{
- BT_ASSERT_PRE_NON_NULL(event, "Event");
- BT_ASSERT_PRE_NON_NULL(stream, "Stream");
- BT_ASSERT_PRE_EVENT_HOT(event);
- BT_ASSERT_PRE(bt_event_class_borrow_stream_class(
+ BT_ASSERT_PRE_DEV_NON_NULL(event, "Event");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream");
+ BT_ASSERT_PRE_DEV_EVENT_HOT(event);
+ BT_ASSERT_PRE_DEV(bt_event_class_borrow_stream_class(
event->class) == stream->class,
"Stream's class and event's stream class differ: "
"%![event-]+e, %![stream-]+s", event, stream);
enum bt_field_class_type bt_field_class_get_type(
const struct bt_field_class *fc)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
return fc->type;
}
{
const struct bt_field_class_integer *int_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_IS_INT(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_IS_INT(fc, "Field class");
return int_fc->range;
}
BT_ASSERT_PRE_NON_NULL(fc, "Field class");
BT_ASSERT_PRE_FC_IS_INT(fc, "Field class");
- BT_ASSERT_PRE_FC_HOT(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class");
BT_ASSERT_PRE(size <= 64,
"Unsupported size for integer field class's field value range "
"(maximum is 64): size=%" PRIu64, size);
{
const struct bt_field_class_integer *int_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_IS_INT(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_IS_INT(fc, "Field class");
return int_fc->base;
}
BT_ASSERT_PRE_NON_NULL(fc, "Field class");
BT_ASSERT_PRE_FC_IS_INT(fc, "Field class");
- BT_ASSERT_PRE_FC_HOT(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class");
int_fc->base = base;
BT_LIB_LOGD("Set integer field class's preferred display base: %!+F", fc);
}
{
const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_IS_ENUM(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_IS_ENUM(fc, "Field class");
return (uint64_t) enum_fc->mappings->len;
}
{
const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_VALID_INDEX(index, enum_fc->mappings->len);
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, enum_fc->mappings->len);
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
"Field class");
return (const void *) BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(fc, index);
}
{
const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_VALID_INDEX(index, enum_fc->mappings->len);
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, enum_fc->mappings->len);
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
"Field class");
return (const void *) BT_FIELD_CLASS_ENUM_MAPPING_AT_INDEX(fc, index);
}
const char *bt_field_class_enumeration_mapping_get_label(
const struct bt_field_class_enumeration_mapping *mapping)
{
- BT_ASSERT_PRE_NON_NULL(mapping, "Enumeration field class mapping");
+ BT_ASSERT_PRE_DEV_NON_NULL(mapping, "Enumeration field class mapping");
return mapping->label->str;
}
uint64_t bt_field_class_enumeration_mapping_get_range_count(
const struct bt_field_class_enumeration_mapping *mapping)
{
- BT_ASSERT_PRE_NON_NULL(mapping, "Enumeration field class mapping");
+ BT_ASSERT_PRE_DEV_NON_NULL(mapping, "Enumeration field class mapping");
return (uint64_t) mapping->ranges->len;
}
{
const struct bt_field_class_enumeration_mapping_range *range;
- BT_ASSERT_PRE_NON_NULL(mapping, "Ranges");
- BT_ASSERT_PRE_NON_NULL(lower, "Range's lower (output)");
- BT_ASSERT_PRE_NON_NULL(upper, "Range's upper (output)");
- BT_ASSERT_PRE_VALID_INDEX(index, mapping->ranges->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(mapping, "Ranges");
+ BT_ASSERT_PRE_DEV_NON_NULL(lower, "Range's lower (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(upper, "Range's upper (output)");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, mapping->ranges->len);
range = BT_FIELD_CLASS_ENUM_MAPPING_RANGE_AT_INDEX(mapping, index);
*lower = range->lower.u;
*upper = range->upper.u;
const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
uint64_t i;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_NON_NULL(label_array, "Label array (output)");
- BT_ASSERT_PRE_NON_NULL(count, "Count (output)");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Label array (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(count, "Count (output)");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
"Field class");
g_ptr_array_set_size(enum_fc->label_buf, 0);
const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
uint64_t i;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_NON_NULL(label_array, "Label array (output)");
- BT_ASSERT_PRE_NON_NULL(count, "Count (output)");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Label array (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(count, "Count (output)");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
"Field class");
g_ptr_array_set_size(enum_fc->label_buf, 0);
return ret;
}
-enum bt_field_class_enumeration_map_range_status bt_field_class_unsigned_enumeration_map_range(
+enum bt_field_class_enumeration_map_range_status
+bt_field_class_unsigned_enumeration_map_range(
struct bt_field_class *fc, const char *label,
uint64_t range_lower, uint64_t range_upper)
{
range_upper);
}
-enum bt_field_class_enumeration_map_range_status bt_field_class_signed_enumeration_map_range(
+enum bt_field_class_enumeration_map_range_status
+bt_field_class_signed_enumeration_map_range(
struct bt_field_class *fc, const char *label,
int64_t range_lower, int64_t range_upper)
{
{
const struct bt_field_class_real *real_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_REAL, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_REAL, "Field class");
return real_fc->is_single_precision;
}
BT_ASSERT_PRE_NON_NULL(fc, "Field class");
BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_REAL, "Field class");
- BT_ASSERT_PRE_FC_HOT(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class");
real_fc->is_single_precision = (bool) is_single_precision;
BT_LIB_LOGD("Set real field class's \"is single precision\" property: "
"%!+F", fc);
GString *name_str;
BT_ASSERT(container_fc);
- BT_ASSERT_PRE_FC_HOT(container_fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(container_fc, "Field class");
BT_ASSERT_PRE_NON_NULL(name, "Name");
BT_ASSERT_PRE_NON_NULL(fc, "Field class");
BT_ASSERT_PRE(!bt_g_hash_table_contains(container_fc->name_to_index,
{
struct bt_field_class_structure *struct_fc = (void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
"Field class");
return (uint64_t) struct_fc->common.named_fcs->len;
}
uint64_t index)
{
BT_ASSERT(fc);
- BT_ASSERT_PRE_VALID_INDEX(index, fc->named_fcs->len);
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, fc->named_fcs->len);
return BT_FIELD_CLASS_NAMED_FC_AT_INDEX(fc, index);
}
bt_field_class_structure_borrow_member_by_index_const(
const struct bt_field_class *fc, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
"Field class");
return (const void *)
borrow_named_field_class_from_container_field_class_at_index(
bt_field_class_structure_borrow_member_by_index(
struct bt_field_class *fc, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
"Field class");
return (void *)
borrow_named_field_class_from_container_field_class_at_index(
gpointer value;
BT_ASSERT(fc);
- BT_ASSERT_PRE_NON_NULL(name, "Name");
+ BT_ASSERT_PRE_DEV_NON_NULL(name, "Name");
if (!g_hash_table_lookup_extended(fc->name_to_index, name, &orig_key,
&value)) {
goto end;
bt_field_class_structure_borrow_member_by_name_const(
const struct bt_field_class *fc, const char *name)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
"Field class");
return (const void *)
borrow_named_field_class_from_container_field_class_by_name(
bt_field_class_structure_borrow_member_by_name(
struct bt_field_class *fc, const char *name)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
"Field class");
return (void *)
borrow_named_field_class_from_container_field_class_by_name(
{
const struct bt_named_field_class *named_fc = (const void *) member;
- BT_ASSERT_PRE_NON_NULL(member, "Structure field class member");
+ BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member");
return named_fc->name->str;
}
{
const struct bt_named_field_class *named_fc = (const void *) member;
- BT_ASSERT_PRE_NON_NULL(member, "Structure field class member");
+ BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member");
return named_fc->fc;
}
{
struct bt_named_field_class *named_fc = (void *) member;
- BT_ASSERT_PRE_NON_NULL(member, "Structure field class member");
+ BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member");
return named_fc->fc;
}
BT_ASSERT_PRE_NON_NULL(selector_fc, "Selector field class");
BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
BT_ASSERT_PRE_FC_IS_ENUM(selector_fc, "Selector field class");
- BT_ASSERT_PRE_FC_HOT(fc, "Variant field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Variant field class");
var_fc->selector_fc = selector_fc;
bt_object_get_no_null_check(selector_fc);
bt_field_class_freeze(selector_fc);
bt_field_class_variant_borrow_option_by_name_const(
const struct bt_field_class *fc, const char *name)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT,
+ "Field class");
return (const void *)
borrow_named_field_class_from_container_field_class_by_name(
(void *) fc, name);
bt_field_class_variant_borrow_option_by_name(
struct bt_field_class *fc, const char *name)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
return (void *)
borrow_named_field_class_from_container_field_class_by_name(
(void *) fc, name);
{
const struct bt_field_class_variant *var_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
return (uint64_t) var_fc->common.named_fcs->len;
}
bt_field_class_variant_borrow_option_by_index_const(
const struct bt_field_class *fc, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
return (const void *)
borrow_named_field_class_from_container_field_class_at_index(
(void *) fc, index);
bt_field_class_variant_borrow_option_by_index(
struct bt_field_class *fc, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT, "Field class");
return (void *)
borrow_named_field_class_from_container_field_class_at_index(
(void *) fc, index);
{
const struct bt_named_field_class *named_fc = (const void *) option;
- BT_ASSERT_PRE_NON_NULL(option, "Variant field class option");
+ BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option");
return named_fc->name->str;
}
{
const struct bt_named_field_class *named_fc = (const void *) option;
- BT_ASSERT_PRE_NON_NULL(option, "Variant field class option");
+ BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option");
return named_fc->fc;
}
{
struct bt_named_field_class *named_fc = (void *) option;
- BT_ASSERT_PRE_NON_NULL(option, "Variant field class option");
+ BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option");
return named_fc->fc;
}
{
const struct bt_field_class_variant *var_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_VARIANT,
"Field class");
return var_fc->selector_field_path;
}
{
const struct bt_field_class_array *array_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_IS_ARRAY(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_IS_ARRAY(fc, "Field class");
return array_fc->element_fc;
}
{
struct bt_field_class_array *array_fc = (void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_IS_ARRAY(fc, "Field class");
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_IS_ARRAY(fc, "Field class");
return array_fc->element_fc;
}
{
const struct bt_field_class_static_array *array_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STATIC_ARRAY,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STATIC_ARRAY,
"Field class");
return (uint64_t) array_fc->length;
}
BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
"Field class");
BT_ASSERT_PRE_FC_IS_UNSIGNED_INT(length_fc, "Length field class");
- BT_ASSERT_PRE_FC_HOT(fc, "Dynamic array field class");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Dynamic array field class");
array_fc->length_fc = length_fc;
bt_object_get_no_null_check(length_fc);
bt_field_class_freeze(length_fc);
{
const struct bt_field_class_dynamic_array *seq_fc = (const void *) fc;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
- BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY,
"Field class");
return seq_fc->length_field_path;
}
}
BT_HIDDEN
-void _bt_field_class_make_part_of_trace_class(const struct bt_field_class *c_fc)
+void bt_field_class_make_part_of_trace_class(const struct bt_field_class *c_fc)
{
struct bt_field_class *fc = (void *) c_fc;
#include <stdint.h>
#include <glib.h>
+#define _BT_ASSERT_PRE_FC_IS_INT_COND(_fc) \
+ (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
+ ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || \
+ ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION || \
+ ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION)
+
+#define _BT_ASSERT_PRE_FC_IS_INT_FMT(_name) \
+ _name " is not an integer field class: %![fc-]+F"
+
+#define _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_COND(_fc) \
+ (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
+ ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION)
+
+#define _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_FMT(_name) \
+ _name " is not an unsigned integer field class: %![fc-]+F"
+
+#define _BT_ASSERT_PRE_FC_IS_ENUM_COND(_fc) \
+ (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION || \
+ ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION)
+
+#define _BT_ASSERT_PRE_FC_IS_ENUM_FMT(_name) \
+ _name " is not an enumeration field class: %![fc-]+F"
+
+#define _BT_ASSERT_PRE_FC_IS_ARRAY_COND(_fc) \
+ (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY || \
+ ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY)
+
+#define _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name) \
+ _name " is not an array field class: %![fc-]+F"
+
+#define _BT_ASSERT_PRE_FC_HAS_ID_COND(_fc, _type) \
+ (((const struct bt_field_class *) (_fc))->type == (_type))
+
+#define _BT_ASSERT_PRE_FC_HAS_ID_FMT(_name) \
+ _name " has the wrong type: expected-type=%s, %![fc-]+F"
+
#define BT_ASSERT_PRE_FC_IS_INT(_fc, _name) \
- BT_ASSERT_PRE( \
- ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
- ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || \
- ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION || \
- ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, \
- _name " is not an integer field class: %![fc-]+F", (_fc))
+ BT_ASSERT_PRE(_BT_ASSERT_PRE_FC_IS_INT_COND(_fc), \
+ _BT_ASSERT_PRE_FC_IS_INT_FMT(_name), (_fc))
#define BT_ASSERT_PRE_FC_IS_UNSIGNED_INT(_fc, _name) \
- BT_ASSERT_PRE( \
- ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
- ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, \
- _name " is not an unsigned integer field class: %![fc-]+F", (_fc))
+ BT_ASSERT_PRE(_BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_COND(_fc), \
+ _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_FMT(_name), (_fc))
#define BT_ASSERT_PRE_FC_IS_ENUM(_fc, _name) \
- BT_ASSERT_PRE( \
- ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION || \
- ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, \
- _name " is not an enumeration field class: %![fc-]+F", (_fc))
+ BT_ASSERT_PRE(_BT_ASSERT_PRE_FC_IS_ENUM_COND(_fc), \
+ _BT_ASSERT_PRE_FC_IS_ENUM_FMT(_name), (_fc))
#define BT_ASSERT_PRE_FC_IS_ARRAY(_fc, _name) \
- BT_ASSERT_PRE( \
- ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY || \
- ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, \
- _name " is not an array field class: %![fc-]+F", (_fc))
+ BT_ASSERT_PRE(_BT_ASSERT_PRE_FC_IS_ARRAY_COND(_fc), \
+ _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name), (_fc))
#define BT_ASSERT_PRE_FC_HAS_ID(_fc, _type, _name) \
- BT_ASSERT_PRE(((const struct bt_field_class *) (_fc))->type == (_type), \
- _name " has the wrong type: expected-type=%s, " \
- "%![fc-]+F", bt_common_field_class_type_string(_type), (_fc))
+ BT_ASSERT_PRE(_BT_ASSERT_PRE_FC_HAS_ID_COND((_fc), (_type)), \
+ _BT_ASSERT_PRE_FC_HAS_ID_FMT(_name), \
+ bt_common_field_class_type_string(_type), (_fc))
-#define BT_ASSERT_PRE_FC_HOT(_fc, _name) \
- BT_ASSERT_PRE_HOT((const struct bt_field_class *) (_fc), \
+#define BT_ASSERT_PRE_DEV_FC_IS_INT(_fc, _name) \
+ BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_FC_IS_INT_COND(_fc), \
+ _BT_ASSERT_PRE_FC_IS_INT_FMT(_name), (_fc))
+
+#define BT_ASSERT_PRE_DEV_FC_IS_UNSIGNED_INT(_fc, _name) \
+ BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_COND(_fc), \
+ _BT_ASSERT_PRE_FC_IS_UNSIGNED_INT_FMT(_name), (_fc))
+
+#define BT_ASSERT_PRE_DEV_FC_IS_ENUM(_fc, _name) \
+ BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_FC_IS_ENUM_COND(_fc), \
+ _BT_ASSERT_PRE_FC_IS_ENUM_FMT(_name), (_fc))
+
+#define BT_ASSERT_PRE_DEV_FC_IS_ARRAY(_fc, _name) \
+ BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_FC_IS_ARRAY_COND(_fc), \
+ _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name), (_fc))
+
+#define BT_ASSERT_PRE_DEV_FC_HAS_ID(_fc, _type, _name) \
+ BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_FC_HAS_ID_COND((_fc), (_type)), \
+ _BT_ASSERT_PRE_FC_HAS_ID_FMT(_name), \
+ bt_common_field_class_type_string(_type), (_fc))
+
+#define BT_ASSERT_PRE_DEV_FC_HOT(_fc, _name) \
+ BT_ASSERT_PRE_DEV_HOT((const struct bt_field_class *) (_fc), \
(_name), ": %!+F", (_fc))
-#define BT_FIELD_CLASS_NAMED_FC_AT_INDEX(_fc, _index) \
+#define BT_FIELD_CLASS_NAMED_FC_AT_INDEX(_fc, _index) \
(&g_array_index(((struct bt_field_class_named_field_class_container *) (_fc))->named_fcs, \
struct bt_named_field_class, (_index)))
bool frozen;
/*
- * Only used in developer mode, this flag indicates whether or
- * not this field class is part of a trace class.
+ * This flag indicates whether or not this field class is part
+ * of a trace class.
*/
bool part_of_trace_class;
};
* shared objects for other purposes.
*/
BT_HIDDEN
-void _bt_field_class_make_part_of_trace_class(
+void bt_field_class_make_part_of_trace_class(
const struct bt_field_class *field_class);
-#ifdef BT_DEV_MODE
-# define bt_field_class_make_part_of_trace_class _bt_field_class_make_part_of_trace_class
-#else
-# define bt_field_class_make_part_of_trace_class(_fc) ((void) _fc)
-#endif
-
#endif /* BABELTRACE_TRACE_IR_FIELD_CLASSES_INTERNAL_H */
enum bt_scope bt_field_path_get_root_scope(
const struct bt_field_path *field_path)
{
- BT_ASSERT_PRE_NON_NULL(field_path, "Field path");
+ BT_ASSERT_PRE_DEV_NON_NULL(field_path, "Field path");
return field_path->root;
}
uint64_t bt_field_path_get_item_count(const struct bt_field_path *field_path)
{
- BT_ASSERT_PRE_NON_NULL(field_path, "Field path");
+ BT_ASSERT_PRE_DEV_NON_NULL(field_path, "Field path");
return (uint64_t) field_path->items->len;
}
const struct bt_field_path_item *bt_field_path_borrow_item_by_index_const(
const struct bt_field_path *field_path, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(field_path, "Field path");
- BT_ASSERT_PRE_VALID_INDEX(index, field_path->items->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(field_path, "Field path");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, field_path->items->len);
return bt_field_path_borrow_item_by_index_inline(field_path, index);
}
enum bt_field_path_item_type bt_field_path_item_get_type(
const struct bt_field_path_item *field_path_item)
{
- BT_ASSERT_PRE_NON_NULL(field_path_item, "Field path item");
+ BT_ASSERT_PRE_DEV_NON_NULL(field_path_item, "Field path item");
return field_path_item->type;
}
uint64_t bt_field_path_item_index_get_index(
const struct bt_field_path_item *field_path_item)
{
- BT_ASSERT_PRE_NON_NULL(field_path_item, "Field path item");
- BT_ASSERT_PRE(field_path_item->type == BT_FIELD_PATH_ITEM_TYPE_INDEX,
+ BT_ASSERT_PRE_DEV_NON_NULL(field_path_item, "Field path item");
+ BT_ASSERT_PRE_DEV(field_path_item->type == BT_FIELD_PATH_ITEM_TYPE_INDEX,
"Field path item is not an index field path item: "
"addr=%p, type=%s", field_path_item,
bt_field_path_item_type_string(field_path_item->type));
struct bt_field_class *bt_field_borrow_class(const struct bt_field *field)
{
- BT_ASSERT_PRE_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
return field->class;
}
const struct bt_field_class *bt_field_borrow_class_const(
const struct bt_field *field)
{
- BT_ASSERT_PRE_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
return field->class;
}
enum bt_field_class_type bt_field_get_class_type(const struct bt_field *field)
{
- BT_ASSERT_PRE_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
return field->class->type;
}
{
struct bt_field *field = NULL;
- BT_ASSERT_PRE_NON_NULL(fc, "Field class");
+ BT_ASSERT(fc);
BT_ASSERT(bt_field_class_has_known_type(fc));
field = field_create_funcs[fc->type](fc);
if (!field) {
{
const struct bt_field_integer *int_field = (const void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_SET(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_SIGNED_INT(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_SIGNED_INT(field, "Field");
return int_field->value.i;
}
{
struct bt_field_integer *int_field = (void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_SIGNED_INT(field, "Field");
- BT_ASSERT_PRE_FIELD_HOT(field, "Field");
- BT_ASSERT_PRE(bt_util_value_is_in_range_signed(
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_SIGNED_INT(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
+ BT_ASSERT_PRE_DEV(bt_util_value_is_in_range_signed(
((struct bt_field_class_integer *) field->class)->range, value),
"Value is out of bounds: value=%" PRId64 ", %![field-]+f, "
"%![fc-]+F", value, field, field->class);
{
const struct bt_field_integer *int_field = (const void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_SET(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_UNSIGNED_INT(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_UNSIGNED_INT(field, "Field");
return int_field->value.u;
}
{
struct bt_field_integer *int_field = (void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_UNSIGNED_INT(field, "Field");
- BT_ASSERT_PRE_FIELD_HOT(field, "Field");
- BT_ASSERT_PRE(bt_util_value_is_in_range_unsigned(
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_UNSIGNED_INT(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
+ BT_ASSERT_PRE_DEV(bt_util_value_is_in_range_unsigned(
((struct bt_field_class_integer *) field->class)->range, value),
"Value is out of bounds: value=%" PRIu64 ", %![field-]+f, "
"%![fc-]+F", value, field, field->class);
{
const struct bt_field_real *real_field = (const void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_SET(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_REAL, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_REAL, "Field");
return real_field->value;
}
{
struct bt_field_real *real_field = (void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_REAL, "Field");
- BT_ASSERT_PRE_FIELD_HOT(field, "Field");
- BT_ASSERT_PRE(
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_REAL, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
+ BT_ASSERT_PRE_DEV(
!((struct bt_field_class_real *) field->class)->is_single_precision ||
(double) (float) value == value,
"Invalid value for a single-precision real number: value=%f, "
{
const struct bt_field_integer *int_field = (const void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_NON_NULL(label_array, "Label array (output)");
- BT_ASSERT_PRE_NON_NULL(label_array, "Count (output)");
- BT_ASSERT_PRE_FIELD_IS_SET(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Label array (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Count (output)");
+ BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, "Field");
return (int)
bt_field_class_unsigned_enumeration_get_mapping_labels_for_value(
{
const struct bt_field_integer *int_field = (const void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_NON_NULL(label_array, "Label array (output)");
- BT_ASSERT_PRE_NON_NULL(label_array, "Count (output)");
- BT_ASSERT_PRE_FIELD_IS_SET(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Label array (output)");
+ BT_ASSERT_PRE_DEV_NON_NULL(label_array, "Count (output)");
+ BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, "Field");
return (int)
bt_field_class_signed_enumeration_get_mapping_labels_for_value(
{
const struct bt_field_string *string_field = (const void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_SET(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING,
"Field");
return (const char *) string_field->buf->data;
}
{
const struct bt_field_string *string_field = (const void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_SET(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_SET(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING,
"Field");
return string_field->length;
}
enum bt_field_string_set_value_status bt_field_string_set_value(
struct bt_field *field, const char *value)
{
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_NON_NULL(value, "Value");
- BT_ASSERT_PRE_FIELD_HOT(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(value, "Value");
+ BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field, BT_FIELD_CLASS_TYPE_STRING,
"Field");
clear_string_field(field);
return (int) bt_field_string_append_with_length(field, value,
char *data;
uint64_t new_length;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_NON_NULL(value, "Value");
- BT_ASSERT_PRE_FIELD_HOT(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(value, "Value");
+ BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_STRING, "Field");
/* Make sure no null bytes are appended */
- BT_ASSERT_PRE(memchr(value, '\0', length) == NULL,
+ BT_ASSERT_PRE_DEV(memchr(value, '\0', length) == NULL,
"String value to append contains a null character: "
"partial-value=\"%.32s\", length=%" PRIu64, value, length);
void bt_field_string_clear(struct bt_field *field)
{
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_HOT(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_STRING, "Field");
clear_string_field(field);
}
{
const struct bt_field_array *array_field = (const void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_ARRAY(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY(field, "Field");
return array_field->length;
}
int ret = BT_FUNC_STATUS_OK;
struct bt_field_array *array_field = (void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, "Field");
- BT_ASSERT_PRE_FIELD_HOT(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
if (G_UNLIKELY(length > array_field->fields->len)) {
/* Make more room */
{
struct bt_field_array *array_field = (void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_IS_ARRAY(field, "Field");
- BT_ASSERT_PRE_VALID_INDEX(index, array_field->length);
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY(field, "Field");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, array_field->length);
return array_field->fields->pdata[index];
}
{
struct bt_field_structure *struct_field = (void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_STRUCTURE, "Field");
- BT_ASSERT_PRE_VALID_INDEX(index, struct_field->fields->len);
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, struct_field->fields->len);
return struct_field->fields->pdata[index];
}
gpointer orig_key;
gpointer index;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_NON_NULL(name, "Field name");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_NON_NULL(name, "Field name");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_STRUCTURE, "Field");
struct_fc = (void *) field->class;
{
struct bt_field_variant *var_field = (void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_VARIANT, "Field");
- BT_ASSERT_PRE(var_field->selected_field,
+ BT_ASSERT_PRE_DEV(var_field->selected_field,
"Variant field has no selected field: %!+f", field);
return var_field->selected_field;
}
{
struct bt_field_variant *var_field = (void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_VARIANT, "Field");
- BT_ASSERT_PRE_FIELD_HOT(field, "Field");
- BT_ASSERT_PRE_VALID_INDEX(index, var_field->fields->len);
+ BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, var_field->fields->len);
var_field->selected_field = var_field->fields->pdata[index];
var_field->selected_index = index;
return BT_FUNC_STATUS_OK;
{
const struct bt_field_variant *var_field = (const void *) field;
- BT_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(field,
+ BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
+ BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(field,
BT_FIELD_CLASS_TYPE_VARIANT, "Field");
- BT_ASSERT_PRE(var_field->selected_field,
+ BT_ASSERT_PRE_DEV(var_field->selected_field,
"Variant field has no selected field: %!+f", field);
return var_field->selected_index;
}
#include "field-class.h"
#include "utils.h"
-#define BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(_field, _cls_type, _name) \
- BT_ASSERT_PRE(((const struct bt_field *) (_field))->class->type == (_cls_type), \
+#define BT_ASSERT_PRE_DEV_FIELD_HAS_CLASS_TYPE(_field, _cls_type, _name) \
+ BT_ASSERT_PRE_DEV(((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_FIELD_IS_UNSIGNED_INT(_field, _name) \
- BT_ASSERT_PRE( \
+#define BT_ASSERT_PRE_DEV_FIELD_IS_UNSIGNED_INT(_field, _name) \
+ BT_ASSERT_PRE_DEV( \
((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \
((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, \
_name " is not an unsigned integer field: %![field-]+f", \
(_field))
-#define BT_ASSERT_PRE_FIELD_IS_SIGNED_INT(_field, _name) \
- BT_ASSERT_PRE( \
+#define BT_ASSERT_PRE_DEV_FIELD_IS_SIGNED_INT(_field, _name) \
+ BT_ASSERT_PRE_DEV( \
((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || \
((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, \
- _name " is not a signed integer field: %![field-]+f", \
+ _name " is not a signed integer field: %![field-]+f", \
(_field))
-#define BT_ASSERT_PRE_FIELD_IS_ARRAY(_field, _name) \
- BT_ASSERT_PRE( \
+#define BT_ASSERT_PRE_DEV_FIELD_IS_ARRAY(_field, _name) \
+ BT_ASSERT_PRE_DEV( \
((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, \
_name " is not an array field: %![field-]+f", (_field))
-#define BT_ASSERT_PRE_FIELD_IS_SET(_field, _name) \
- BT_ASSERT_PRE(bt_field_is_set(_field), \
+#define BT_ASSERT_PRE_DEV_FIELD_IS_SET(_field, _name) \
+ BT_ASSERT_PRE_DEV(bt_field_is_set(_field), \
_name " is not set: %!+f", (_field))
-#define BT_ASSERT_PRE_FIELD_HOT(_field, _name) \
- BT_ASSERT_PRE_HOT((const struct bt_field *) (_field), (_name), \
+#define BT_ASSERT_PRE_DEV_FIELD_HOT(_field, _name) \
+ BT_ASSERT_PRE_DEV_HOT((const struct bt_field *) (_field), (_name), \
": %!+f", (_field))
struct bt_field;
#include "trace.h"
#include "lib/func-status.h"
-#define BT_ASSERT_PRE_PACKET_HOT(_packet) \
- BT_ASSERT_PRE_HOT((_packet), "Packet", ": %!+a", (_packet))
-
struct bt_stream *bt_packet_borrow_stream(struct bt_packet *packet)
{
- BT_ASSERT_PRE_NON_NULL(packet, "Packet");
+ BT_ASSERT_PRE_DEV_NON_NULL(packet, "Packet");
return packet->stream;
}
struct bt_field *bt_packet_borrow_context_field(struct bt_packet *packet)
{
- BT_ASSERT_PRE_NON_NULL(packet, "Packet");
+ BT_ASSERT_PRE_DEV_NON_NULL(packet, "Packet");
return packet->context_field ? packet->context_field->field : NULL;
}
struct bt_stream_class *stream_class;
struct bt_field_wrapper *field_wrapper = (void *) context_field;
- BT_ASSERT_PRE_NON_NULL(packet, "Packet");
- BT_ASSERT_PRE_NON_NULL(field_wrapper, "Context field");
- BT_ASSERT_PRE_HOT(packet, "Packet", ": %!+a", packet);
+ BT_ASSERT_PRE_DEV_NON_NULL(packet, "Packet");
+ BT_ASSERT_PRE_DEV_NON_NULL(field_wrapper, "Context field");
+ BT_ASSERT_PRE_DEV_HOT(packet, "Packet", ": %!+a", packet);
stream_class = packet->stream->class;
- BT_ASSERT_PRE(stream_class->packet_context_fc,
+ BT_ASSERT_PRE_DEV(stream_class->packet_context_fc,
"Stream class has no packet context field class: %!+S",
stream_class);
- BT_ASSERT_PRE(field_wrapper->field->class ==
+ BT_ASSERT_PRE_DEV(field_wrapper->field->class ==
stream_class->packet_context_fc,
"Unexpected packet context field's class: "
"%![fc-]+F, %![expected-fc-]+F", field_wrapper->field->class,
return field_path;
}
-BT_ASSERT_PRE_FUNC
+BT_ASSERT_PRE_DEV_FUNC
static inline
bool target_is_before_source(struct bt_field_path *src_field_path,
struct bt_field_path *tgt_field_path)
return is_valid;
}
-BT_ASSERT_PRE_FUNC
+BT_ASSERT_PRE_DEV_FUNC
static inline
struct bt_field_class *borrow_root_field_class(
struct bt_resolve_field_path_context *ctx, enum bt_scope scope)
return NULL;
}
-BT_ASSERT_PRE_FUNC
+BT_ASSERT_PRE_DEV_FUNC
static inline
struct bt_field_class *borrow_child_field_class(
struct bt_field_class *parent_fc,
return child_fc;
}
-BT_ASSERT_PRE_FUNC
+BT_ASSERT_PRE_DEV_FUNC
static inline
bool target_field_path_in_different_scope_has_struct_fc_only(
struct bt_field_path *src_field_path,
return is_valid;
}
-BT_ASSERT_PRE_FUNC
+BT_ASSERT_PRE_DEV_FUNC
static inline
bool lca_is_structure_field_class(struct bt_field_path *src_field_path,
struct bt_field_path *tgt_field_path,
return is_valid;
}
-BT_ASSERT_PRE_FUNC
+BT_ASSERT_PRE_DEV_FUNC
static inline
bool lca_to_target_has_struct_fc_only(struct bt_field_path *src_field_path,
struct bt_field_path *tgt_field_path,
return is_valid;
}
-BT_ASSERT_PRE_FUNC
+BT_ASSERT_PRE_DEV_FUNC
static inline
bool field_path_is_valid(struct bt_field_class *src_fc,
struct bt_field_class *tgt_fc,
tgt_fc, ctx);
if (!src_field_path) {
- BT_ASSERT_PRE_MSG("Cannot find requesting field class in "
+ BT_ASSERT_PRE_DEV_MSG("Cannot find requesting field class in "
"resolving context: %!+F", src_fc);
is_valid = false;
goto end;
}
if (!tgt_field_path) {
- BT_ASSERT_PRE_MSG("Cannot find target field class in "
+ BT_ASSERT_PRE_DEV_MSG("Cannot find target field class in "
"resolving context: %!+F", tgt_fc);
is_valid = false;
goto end;
/* Target must be before source */
if (!target_is_before_source(src_field_path, tgt_field_path)) {
- BT_ASSERT_PRE_MSG("Target field class is located after "
+ BT_ASSERT_PRE_DEV_MSG("Target field class is located after "
"requesting field class: %![req-fc-]+F, %![tgt-fc-]+F",
src_fc, tgt_fc);
is_valid = false;
*/
if (!target_field_path_in_different_scope_has_struct_fc_only(
src_field_path, tgt_field_path, ctx)) {
- BT_ASSERT_PRE_MSG("Target field class is located in a "
+ BT_ASSERT_PRE_DEV_MSG("Target field class is located in a "
"different scope than requesting field class, "
"but within an array or a variant field class: "
"%![req-fc-]+F, %![tgt-fc-]+F",
/* Same scope: LCA must be a structure field class */
if (!lca_is_structure_field_class(src_field_path, tgt_field_path, ctx)) {
- BT_ASSERT_PRE_MSG("Lowest common ancestor of target and "
+ BT_ASSERT_PRE_DEV_MSG("Lowest common ancestor of target and "
"requesting field classes is not a structure field class: "
"%![req-fc-]+F, %![tgt-fc-]+F",
src_fc, tgt_fc);
/* Same scope: path from LCA to target has no array/variant FTs */
if (!lca_to_target_has_struct_fc_only(src_field_path, tgt_field_path,
ctx)) {
- BT_ASSERT_PRE_MSG("Path from lowest common ancestor of target "
+ BT_ASSERT_PRE_DEV_MSG("Path from lowest common ancestor of target "
"and requesting field classes to target field class "
"contains an array or a variant field class: "
"%![req-fc-]+F, %![tgt-fc-]+F", src_fc, tgt_fc);
struct bt_field_class *tgt_fc,
struct bt_resolve_field_path_context *ctx)
{
- BT_ASSERT_PRE(field_path_is_valid(src_fc, tgt_fc, ctx),
+ BT_ASSERT_PRE_DEV(field_path_is_valid(src_fc, tgt_fc, ctx),
"Invalid target field class: %![req-fc-]+F, %![tgt-fc-]+F",
src_fc, tgt_fc);
return find_field_class_in_ctx(tgt_fc, ctx);
#include "utils.h"
#include "lib/func-status.h"
-#define BT_ASSERT_PRE_STREAM_CLASS_HOT(_sc) \
- BT_ASSERT_PRE_HOT((_sc), "Stream class", ": %!+S", (_sc))
+#define BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(_sc) \
+ BT_ASSERT_PRE_DEV_HOT((_sc), "Stream class", ": %!+S", (_sc))
static
void destroy_stream_class(struct bt_object *obj)
struct bt_trace_class *bt_stream_class_borrow_trace_class(
struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return bt_stream_class_borrow_trace_class_inline(stream_class);
}
const char *bt_stream_class_get_name(const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return stream_class->name.value;
}
{
BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
BT_ASSERT_PRE_NON_NULL(name, "Name");
- BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
+ BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
g_string_assign(stream_class->name.str, name);
stream_class->name.value = stream_class->name.str->str;
BT_LIB_LOGD("Set stream class's name: %!+S", stream_class);
uint64_t bt_stream_class_get_id(const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return stream_class->id;
}
uint64_t bt_stream_class_get_event_class_count(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return (uint64_t) stream_class->event_classes->len;
}
struct bt_event_class *bt_stream_class_borrow_event_class_by_index(
struct bt_stream_class *stream_class, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
- BT_ASSERT_PRE_VALID_INDEX(index, stream_class->event_classes->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, stream_class->event_classes->len);
return g_ptr_array_index(stream_class->event_classes, index);
}
struct bt_event_class *event_class = NULL;
uint64_t i;
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
for (i = 0; i < stream_class->event_classes->len; i++) {
struct bt_event_class *event_class_candidate =
bt_stream_class_borrow_packet_context_field_class_const(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return stream_class->packet_context_fc;
}
bt_stream_class_borrow_packet_context_field_class(
struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return stream_class->packet_context_fc;
}
"Stream class does not support packets: %![sc-]+S",
stream_class);
BT_ASSERT_PRE_NON_NULL(field_class, "Field class");
- BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
+ BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
BT_ASSERT_PRE(bt_field_class_get_type(field_class) ==
BT_FIELD_CLASS_TYPE_STRUCTURE,
"Packet context field class is not a structure field class: %!+F",
bt_stream_class_borrow_event_common_context_field_class_const(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return stream_class->event_common_context_fc;
}
bt_stream_class_borrow_event_common_context_field_class(
struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return stream_class->event_common_context_fc;
}
BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
BT_ASSERT_PRE_NON_NULL(field_class, "Field class");
- BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
+ BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
BT_ASSERT_PRE(bt_field_class_get_type(field_class) ==
BT_FIELD_CLASS_TYPE_STRUCTURE,
"Event common context field class is not a structure field class: %!+F",
{
BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
- BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
+ BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
bt_object_put_ref(stream_class->default_clock_class);
stream_class->default_clock_class = clock_class;
bt_object_get_no_null_check(stream_class->default_clock_class);
struct bt_clock_class *bt_stream_class_borrow_default_clock_class(
struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return stream_class->default_clock_class;
}
const struct bt_clock_class *bt_stream_class_borrow_default_clock_class_const(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return stream_class->default_clock_class;
}
bt_bool bt_stream_class_assigns_automatic_event_class_id(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return (bt_bool) stream_class->assigns_automatic_event_class_id;
}
bt_bool value)
{
BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
- BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
+ BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
stream_class->assigns_automatic_event_class_id = (bool) value;
BT_LIB_LOGD("Set stream class's automatic event class ID "
"assignment property: %!+S", stream_class);
bt_bool bt_stream_class_assigns_automatic_stream_id(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return (bt_bool) stream_class->assigns_automatic_stream_id;
}
bt_bool with_default_clock_snapshots)
{
BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
- BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
+ BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
BT_ASSERT_PRE(supports_discarded_events ||
!with_default_clock_snapshots,
"Discarded events cannot have default clock snapshots when "
bt_bool bt_stream_class_supports_discarded_events(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return (bt_bool) stream_class->supports_discarded_events;
}
bt_bool bt_stream_class_discarded_events_have_default_clock_snapshots(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return (bt_bool) stream_class->discarded_events_have_default_clock_snapshots;
}
bt_bool with_default_clock_snapshots)
{
BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
- BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
+ BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
BT_ASSERT_PRE(!supports_discarded_packets ||
stream_class->supports_packets,
"Stream class does not support packets: %!+S",
bt_bool bt_stream_class_supports_discarded_packets(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return (bt_bool) stream_class->supports_discarded_packets;
}
bt_bool bt_stream_class_discarded_packets_have_default_clock_snapshots(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return (bt_bool) stream_class->discarded_packets_have_default_clock_snapshots;
}
with_beginning_default_clock_snapshot ||
with_end_default_clock_snapshot;
BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
- BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
+ BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
BT_ASSERT_PRE(supports_packets ||
!with_default_clock_snapshot,
"Packets cannot have default clock snapshots when "
bt_bool bt_stream_class_packets_have_beginning_default_clock_snapshot(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return (bt_bool) stream_class->packets_have_beginning_default_clock_snapshot;
}
bt_bool bt_stream_class_packets_have_end_default_clock_snapshot(
const struct bt_stream_class *stream_class)
{
- BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream_class, "Stream class");
return (bt_bool) stream_class->packets_have_end_default_clock_snapshot;
}
bt_bool value)
{
BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
- BT_ASSERT_PRE_STREAM_CLASS_HOT(stream_class);
+ BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
stream_class->assigns_automatic_stream_id = (bool) value;
BT_LIB_LOGD("Set stream class's automatic stream ID "
"assignment property: %!+S", stream_class);
#include "trace.h"
#include "lib/func-status.h"
-#define BT_ASSERT_PRE_STREAM_HOT(_stream) \
- BT_ASSERT_PRE_HOT((_stream), "Stream", ": %!+s", (_stream))
+#define BT_ASSERT_PRE_DEV_STREAM_HOT(_stream) \
+ BT_ASSERT_PRE_DEV_HOT((_stream), "Stream", ": %!+s", (_stream))
static
void destroy_stream(struct bt_object *obj)
struct bt_stream_class *bt_stream_borrow_class(struct bt_stream *stream)
{
- BT_ASSERT_PRE_NON_NULL(stream, "Stream");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream");
return stream->class;
}
struct bt_trace *bt_stream_borrow_trace(struct bt_stream *stream)
{
- BT_ASSERT_PRE_NON_NULL(stream, "Stream");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream");
return bt_stream_borrow_trace_inline(stream);
}
const char *bt_stream_get_name(const struct bt_stream *stream)
{
- BT_ASSERT_PRE_NON_NULL(stream, "Stream");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream");
return stream->name.value;
}
{
BT_ASSERT_PRE_NON_NULL(stream, "Stream");
BT_ASSERT_PRE_NON_NULL(name, "Name");
- BT_ASSERT_PRE_STREAM_HOT(stream);
+ BT_ASSERT_PRE_DEV_STREAM_HOT(stream);
g_string_assign(stream->name.str, name);
stream->name.value = stream->name.str->str;
BT_LIB_LOGD("Set stream's name: %!+s", stream);
uint64_t bt_stream_get_id(const struct bt_stream *stream)
{
- BT_ASSERT_PRE_NON_NULL(stream, "Stream class");
+ BT_ASSERT_PRE_DEV_NON_NULL(stream, "Stream class");
return stream->id;
}
void *data;
};
-#define BT_ASSERT_PRE_TRACE_CLASS_HOT(_tc) \
- BT_ASSERT_PRE_HOT((_tc), "Trace class", ": %!+T", (_tc))
+#define BT_ASSERT_PRE_DEV_TRACE_CLASS_HOT(_tc) \
+ BT_ASSERT_PRE_DEV_HOT((_tc), "Trace class", ": %!+T", (_tc))
static
void destroy_trace_class(struct bt_object *obj)
uint64_t bt_trace_class_get_stream_class_count(const struct bt_trace_class *tc)
{
- BT_ASSERT_PRE_NON_NULL(tc, "Trace class");
+ BT_ASSERT_PRE_DEV_NON_NULL(tc, "Trace class");
return (uint64_t) tc->stream_classes->len;
}
struct bt_stream_class *bt_trace_class_borrow_stream_class_by_index(
struct bt_trace_class *tc, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(tc, "Trace class");
- BT_ASSERT_PRE_VALID_INDEX(index, tc->stream_classes->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(tc, "Trace class");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, tc->stream_classes->len);
return g_ptr_array_index(tc->stream_classes, index);
}
struct bt_stream_class *stream_class = NULL;
uint64_t i;
- BT_ASSERT_PRE_NON_NULL(tc, "Trace class");
+ BT_ASSERT_PRE_DEV_NON_NULL(tc, "Trace class");
for (i = 0; i < tc->stream_classes->len; i++) {
struct bt_stream_class *stream_class_candidate =
bt_bool bt_trace_class_assigns_automatic_stream_class_id(const struct bt_trace_class *tc)
{
- BT_ASSERT_PRE_NON_NULL(tc, "Trace class");
+ BT_ASSERT_PRE_DEV_NON_NULL(tc, "Trace class");
return (bt_bool) tc->assigns_automatic_stream_class_id;
}
bt_bool value)
{
BT_ASSERT_PRE_NON_NULL(tc, "Trace class");
- BT_ASSERT_PRE_TRACE_CLASS_HOT(tc);
+ BT_ASSERT_PRE_DEV_TRACE_CLASS_HOT(tc);
tc->assigns_automatic_stream_class_id = (bool) value;
BT_LIB_LOGD("Set trace class's automatic stream class ID "
"assignment property: %!+T", tc);
void *data;
};
-#define BT_ASSERT_PRE_TRACE_HOT(_trace) \
- BT_ASSERT_PRE_HOT((_trace), "Trace", ": %!+t", (_trace))
+#define BT_ASSERT_PRE_DEV_TRACE_HOT(_trace) \
+ BT_ASSERT_PRE_DEV_HOT((_trace), "Trace", ": %!+t", (_trace))
static
void destroy_trace(struct bt_object *obj)
const char *bt_trace_get_name(const struct bt_trace *trace)
{
- BT_ASSERT_PRE_NON_NULL(trace, "Trace");
+ BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace");
return trace->name.value;
}
{
BT_ASSERT_PRE_NON_NULL(trace, "Trace");
BT_ASSERT_PRE_NON_NULL(name, "Name");
- BT_ASSERT_PRE_TRACE_HOT(trace);
+ BT_ASSERT_PRE_DEV_TRACE_HOT(trace);
g_string_assign(trace->name.str, name);
trace->name.value = trace->name.str->str;
BT_LIB_LOGD("Set trace's name: %!+t", trace);
bt_uuid bt_trace_get_uuid(const struct bt_trace *trace)
{
- BT_ASSERT_PRE_NON_NULL(trace, "Trace");
+ BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace");
return trace->uuid.value;
}
{
BT_ASSERT_PRE_NON_NULL(trace, "Trace");
BT_ASSERT_PRE_NON_NULL(uuid, "UUID");
- BT_ASSERT_PRE_TRACE_HOT(trace);
+ BT_ASSERT_PRE_DEV_TRACE_HOT(trace);
bt_uuid_copy(trace->uuid.uuid, uuid);
trace->uuid.value = trace->uuid.uuid;
BT_LIB_LOGD("Set trace's UUID: %!+t", trace);
{
int64_t ret;
- BT_ASSERT_PRE_NON_NULL(trace, "Trace");
+ BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace");
ret = bt_attributes_get_count(trace->environment);
BT_ASSERT(ret >= 0);
return (uint64_t) ret;
const struct bt_trace *trace, uint64_t index,
const char **name, const struct bt_value **value)
{
- BT_ASSERT_PRE_NON_NULL(trace, "Trace");
- BT_ASSERT_PRE_NON_NULL(name, "Name");
- BT_ASSERT_PRE_NON_NULL(value, "Value");
- BT_ASSERT_PRE_VALID_INDEX(index,
+ BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace");
+ BT_ASSERT_PRE_DEV_NON_NULL(name, "Name");
+ BT_ASSERT_PRE_DEV_NON_NULL(value, "Value");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index,
bt_attributes_get_count(trace->environment));
*value = bt_attributes_borrow_field_value(trace->environment, index);
BT_ASSERT(*value);
const struct bt_value *bt_trace_borrow_environment_entry_value_by_name_const(
const struct bt_trace *trace, const char *name)
{
- BT_ASSERT_PRE_NON_NULL(trace, "Trace");
- BT_ASSERT_PRE_NON_NULL(name, "Name");
+ BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace");
+ BT_ASSERT_PRE_DEV_NON_NULL(name, "Name");
return bt_attributes_borrow_field_value_by_name(trace->environment,
name);
}
uint64_t bt_trace_get_stream_count(const struct bt_trace *trace)
{
- BT_ASSERT_PRE_NON_NULL(trace, "Trace");
+ BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace");
return (uint64_t) trace->streams->len;
}
struct bt_stream *bt_trace_borrow_stream_by_index(
struct bt_trace *trace, uint64_t index)
{
- BT_ASSERT_PRE_NON_NULL(trace, "Trace");
- BT_ASSERT_PRE_VALID_INDEX(index, trace->streams->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace");
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, trace->streams->len);
return g_ptr_array_index(trace->streams, index);
}
struct bt_stream *stream = NULL;
uint64_t i;
- BT_ASSERT_PRE_NON_NULL(trace, "Trace");
+ BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace");
for (i = 0; i < trace->streams->len; i++) {
struct bt_stream *stream_candidate =
struct bt_trace_class *bt_trace_borrow_class(struct bt_trace *trace)
{
- BT_ASSERT_PRE_NON_NULL(trace, "Trace");
+ BT_ASSERT_PRE_DEV_NON_NULL(trace, "Trace");
return trace->class;
}
#define BT_VALUE_TO_ARRAY(_base) ((struct bt_value_array *) (_base))
#define BT_VALUE_TO_MAP(_base) ((struct bt_value_map *) (_base))
-#define BT_ASSERT_PRE_VALUE_IS_TYPE(_value, _type) \
- BT_ASSERT_PRE(((struct bt_value *) (_value))->type == (_type), \
- "Value has the wrong type ID: expected-type=%s, " \
- "%![value-]+v", bt_common_value_type_string(_type), \
- (_value))
+#define _BT_ASSERT_PRE_VALUE_IS_TYPE_COND(_value, _type) \
+ (((struct bt_value *) (_value))->type == (_type))
-#define BT_ASSERT_PRE_VALUE_HOT(_value, _name) \
- BT_ASSERT_PRE_HOT(((struct bt_value *) (_value)), (_name), \
- ": %!+v", (_value))
+#define _BT_ASSERT_PRE_VALUE_IS_TYPE_FMT \
+ "Value has the wrong type ID: expected-type=%s, %![value-]+v"
-#define BT_ASSERT_PRE_VALUE_INDEX_IN_BOUNDS(_index, _count) \
- BT_ASSERT_PRE((_index) < (_count), \
- "Index is out of bound: " \
- "index=%" PRIu64 ", count=%u", (_index), (_count));
+#define BT_ASSERT_PRE_VALUE_IS_TYPE(_value, _type) \
+ BT_ASSERT_PRE( \
+ _BT_ASSERT_PRE_VALUE_IS_TYPE_COND((_value), (_type)), \
+ _BT_ASSERT_PRE_VALUE_IS_TYPE_FMT, \
+ bt_common_value_type_string(_type), (_value))
+
+#define BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(_value, _type) \
+ BT_ASSERT_PRE_DEV( \
+ _BT_ASSERT_PRE_VALUE_IS_TYPE_COND((_value), (_type)), \
+ _BT_ASSERT_PRE_VALUE_IS_TYPE_FMT, \
+ bt_common_value_type_string(_type), (_value))
+
+#define BT_ASSERT_PRE_DEV_VALUE_HOT(_value, _name) \
+ BT_ASSERT_PRE_DEV_HOT(((struct bt_value *) (_value)), (_name), \
+ ": %!+v", (_value))
static
void bt_value_null_instance_release_func(struct bt_object *obj)
enum bt_value_type bt_value_get_type(const struct bt_value *object)
{
- BT_ASSERT_PRE_NON_NULL(object, "Value object");
+ BT_ASSERT_PRE_DEV_NON_NULL(object, "Value object");
return object->type;
}
bt_bool bt_value_bool_get(const struct bt_value *bool_obj)
{
- BT_ASSERT_PRE_NON_NULL(bool_obj, "Value object");
- BT_ASSERT_PRE_VALUE_IS_TYPE(bool_obj, BT_VALUE_TYPE_BOOL);
+ BT_ASSERT_PRE_DEV_NON_NULL(bool_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(bool_obj, BT_VALUE_TYPE_BOOL);
return BT_VALUE_TO_BOOL(bool_obj)->value;
}
{
BT_ASSERT_PRE_NON_NULL(bool_obj, "Value object");
BT_ASSERT_PRE_VALUE_IS_TYPE(bool_obj, BT_VALUE_TYPE_BOOL);
- BT_ASSERT_PRE_VALUE_HOT(bool_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_HOT(bool_obj, "Value object");
BT_VALUE_TO_BOOL(bool_obj)->value = val;
BT_LOGT("Set boolean value's raw value: value-addr=%p, value=%d",
bool_obj, val);
uint64_t bt_value_unsigned_integer_get(const struct bt_value *integer_obj)
{
- BT_ASSERT_PRE_NON_NULL(integer_obj, "Value object");
- BT_ASSERT_PRE_VALUE_IS_TYPE(integer_obj,
+ BT_ASSERT_PRE_DEV_NON_NULL(integer_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(integer_obj,
BT_VALUE_TYPE_UNSIGNED_INTEGER);
return BT_VALUE_TO_INTEGER(integer_obj)->value.u;
}
int64_t bt_value_signed_integer_get(const struct bt_value *integer_obj)
{
- BT_ASSERT_PRE_NON_NULL(integer_obj, "Value object");
- BT_ASSERT_PRE_VALUE_IS_TYPE(integer_obj,
+ BT_ASSERT_PRE_DEV_NON_NULL(integer_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(integer_obj,
BT_VALUE_TYPE_SIGNED_INTEGER);
return BT_VALUE_TO_INTEGER(integer_obj)->value.i;
}
{
BT_ASSERT_PRE_NON_NULL(integer_obj, "Value object");
BT_ASSERT_PRE_VALUE_IS_TYPE(integer_obj, expected_type);
- BT_ASSERT_PRE_VALUE_HOT(integer_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_HOT(integer_obj, "Value object");
BT_VALUE_TO_INTEGER(integer_obj)->value.u = uval;
}
double bt_value_real_get(const struct bt_value *real_obj)
{
- BT_ASSERT_PRE_NON_NULL(real_obj, "Value object");
- BT_ASSERT_PRE_VALUE_IS_TYPE(real_obj, BT_VALUE_TYPE_REAL);
+ BT_ASSERT_PRE_DEV_NON_NULL(real_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(real_obj, BT_VALUE_TYPE_REAL);
return BT_VALUE_TO_REAL(real_obj)->value;
}
{
BT_ASSERT_PRE_NON_NULL(real_obj, "Value object");
BT_ASSERT_PRE_VALUE_IS_TYPE(real_obj, BT_VALUE_TYPE_REAL);
- BT_ASSERT_PRE_VALUE_HOT(real_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_HOT(real_obj, "Value object");
BT_VALUE_TO_REAL(real_obj)->value = val;
BT_LOGT("Set real number value's raw value: value-addr=%p, value=%f",
real_obj, val);
const char *bt_value_string_get(const struct bt_value *string_obj)
{
- BT_ASSERT_PRE_NON_NULL(string_obj, "Value object");
- BT_ASSERT_PRE_VALUE_IS_TYPE(string_obj, BT_VALUE_TYPE_STRING);
+ BT_ASSERT_PRE_DEV_NON_NULL(string_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(string_obj, BT_VALUE_TYPE_STRING);
return BT_VALUE_TO_STRING(string_obj)->gstr->str;
}
{
BT_ASSERT_PRE_NON_NULL(string_obj, "Value object");
BT_ASSERT_PRE_VALUE_IS_TYPE(string_obj, BT_VALUE_TYPE_STRING);
- BT_ASSERT_PRE_VALUE_HOT(string_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_HOT(string_obj, "Value object");
g_string_assign(BT_VALUE_TO_STRING(string_obj)->gstr, val);
BT_LOGT("Set string value's raw value: value-addr=%p, raw-value-addr=%p",
string_obj, val);
uint64_t bt_value_array_get_size(const struct bt_value *array_obj)
{
- BT_ASSERT_PRE_NON_NULL(array_obj, "Value object");
- BT_ASSERT_PRE_VALUE_IS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY);
+ BT_ASSERT_PRE_DEV_NON_NULL(array_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY);
return (uint64_t) BT_VALUE_TO_ARRAY(array_obj)->garray->len;
}
struct bt_value_array *typed_array_obj =
BT_VALUE_TO_ARRAY(array_obj);
- BT_ASSERT_PRE_NON_NULL(array_obj, "Value object");
- BT_ASSERT_PRE_VALUE_IS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY);
- BT_ASSERT_PRE_VALUE_INDEX_IN_BOUNDS(index,
- typed_array_obj->garray->len);
+ BT_ASSERT_PRE_DEV_NON_NULL(array_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY);
+ BT_ASSERT_PRE_DEV_VALID_INDEX(index, typed_array_obj->garray->len);
return g_ptr_array_index(typed_array_obj->garray, index);
}
BT_ASSERT_PRE_NON_NULL(array_obj, "Array value object");
BT_ASSERT_PRE_NON_NULL(element_obj, "Element value object");
BT_ASSERT_PRE_VALUE_IS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY);
- BT_ASSERT_PRE_VALUE_HOT(array_obj, "Array value object");
+ BT_ASSERT_PRE_DEV_VALUE_HOT(array_obj, "Array value object");
g_ptr_array_add(typed_array_obj->garray, element_obj);
bt_object_get_ref(element_obj);
BT_LOGT("Appended element to array value: array-value-addr=%p, "
BT_ASSERT_PRE_NON_NULL(array_obj, "Array value object");
BT_ASSERT_PRE_NON_NULL(element_obj, "Element value object");
BT_ASSERT_PRE_VALUE_IS_TYPE(array_obj, BT_VALUE_TYPE_ARRAY);
- BT_ASSERT_PRE_VALUE_HOT(array_obj, "Array value object");
- BT_ASSERT_PRE_VALUE_INDEX_IN_BOUNDS(index,
- typed_array_obj->garray->len);
+ BT_ASSERT_PRE_DEV_VALUE_HOT(array_obj, "Array value object");
+ BT_ASSERT_PRE_VALID_INDEX(index, typed_array_obj->garray->len);
bt_object_put_ref(g_ptr_array_index(typed_array_obj->garray, index));
g_ptr_array_index(typed_array_obj->garray, index) = element_obj;
bt_object_get_ref(element_obj);
uint64_t bt_value_map_get_size(const struct bt_value *map_obj)
{
- BT_ASSERT_PRE_NON_NULL(map_obj, "Value object");
- BT_ASSERT_PRE_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
+ BT_ASSERT_PRE_DEV_NON_NULL(map_obj, "Value object");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
return (uint64_t) g_hash_table_size(BT_VALUE_TO_MAP(map_obj)->ght);
}
struct bt_value *bt_value_map_borrow_entry_value(struct bt_value *map_obj,
const char *key)
{
- BT_ASSERT_PRE_NON_NULL(map_obj, "Value object");
- BT_ASSERT_PRE_NON_NULL(key, "Key");
- BT_ASSERT_PRE_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
+ BT_ASSERT_PRE_DEV_NON_NULL(map_obj, "Value object");
+ BT_ASSERT_PRE_DEV_NON_NULL(key, "Key");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
return g_hash_table_lookup(BT_VALUE_TO_MAP(map_obj)->ght,
GUINT_TO_POINTER(g_quark_from_string(key)));
}
bt_bool bt_value_map_has_entry(const struct bt_value *map_obj, const char *key)
{
- BT_ASSERT_PRE_NON_NULL(map_obj, "Value object");
- BT_ASSERT_PRE_NON_NULL(key, "Key");
- BT_ASSERT_PRE_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
+ BT_ASSERT_PRE_DEV_NON_NULL(map_obj, "Value object");
+ BT_ASSERT_PRE_DEV_NON_NULL(key, "Key");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
return bt_g_hash_table_contains(BT_VALUE_TO_MAP(map_obj)->ght,
GUINT_TO_POINTER(g_quark_from_string(key)));
}
BT_ASSERT_PRE_NON_NULL(key, "Key");
BT_ASSERT_PRE_NON_NULL(element_obj, "Element value object");
BT_ASSERT_PRE_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
- BT_ASSERT_PRE_VALUE_HOT(map_obj, "Map value object");
+ BT_ASSERT_PRE_DEV_VALUE_HOT(map_obj, "Map value object");
g_hash_table_insert(BT_VALUE_TO_MAP(map_obj)->ght,
GUINT_TO_POINTER(g_quark_from_string(key)), element_obj);
bt_object_get_ref(element_obj);
GHashTableIter iter;
struct bt_value_map *typed_map_obj = BT_VALUE_TO_MAP(map_obj);
- BT_ASSERT_PRE_NON_NULL(map_obj, "Value object");
- BT_ASSERT_PRE_NON_NULL(func, "Callback");
- BT_ASSERT_PRE_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
+ BT_ASSERT_PRE_DEV_NON_NULL(map_obj, "Value object");
+ BT_ASSERT_PRE_DEV_NON_NULL(func, "Callback");
+ BT_ASSERT_PRE_DEV_VALUE_IS_TYPE(map_obj, BT_VALUE_TYPE_MAP);
g_hash_table_iter_init(&iter, typed_map_obj->ght);
while (g_hash_table_iter_next(&iter, &key, &element_obj)) {
{
bt_bool ret = BT_FALSE;
- BT_ASSERT_PRE_NON_NULL(object_a, "Value object A");
- BT_ASSERT_PRE_NON_NULL(object_b, "Value object B");
+ BT_ASSERT_PRE_DEV_NON_NULL(object_a, "Value object A");
+ BT_ASSERT_PRE_DEV_NON_NULL(object_b, "Value object B");
if (object_a->type != object_b->type) {
BT_LOGT("Values are different: type mismatch: "