lib: add pre condition asserts to check current thread has no error
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 8 Nov 2019 22:19:13 +0000 (17:19 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 11 Nov 2019 18:53:14 +0000 (13:53 -0500)
The user must not call an API function while the current thread has an
error set, especially a function that can itself fail and set an error.
Otherwise, causes from two unrelated errors will end up in the same
stack, which will produce some misleading information.

Add a precondition assertion to all API functions that are likely to
themselves set an error to the current thread, to verify that there is
not error on the current thread when they are called.

Change-Id: I9aadbc4e00d06f3e893970c7c8891dbe7c68606b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
32 files changed:
src/lib/assert-pre.h
src/lib/graph/component-class-sink-simple.c
src/lib/graph/component-class.c
src/lib/graph/component-descriptor-set.c
src/lib/graph/component-filter.c
src/lib/graph/component-sink.c
src/lib/graph/component-source.c
src/lib/graph/graph.c
src/lib/graph/interrupter.c
src/lib/graph/iterator.c
src/lib/graph/message/discarded-items.c
src/lib/graph/message/event.c
src/lib/graph/message/message-iterator-inactivity.c
src/lib/graph/message/packet.c
src/lib/graph/message/stream.c
src/lib/graph/mip.c
src/lib/graph/query-executor.c
src/lib/integer-range-set.c
src/lib/plugin/plugin.c
src/lib/trace-ir/clock-class.c
src/lib/trace-ir/clock-snapshot.c
src/lib/trace-ir/event-class.c
src/lib/trace-ir/field-class.c
src/lib/trace-ir/field.c
src/lib/trace-ir/packet-context-field.c
src/lib/trace-ir/packet.c
src/lib/trace-ir/stream-class.c
src/lib/trace-ir/stream.c
src/lib/trace-ir/trace-class.c
src/lib/trace-ir/trace.c
src/lib/util.c
src/lib/value.c

index 03d86de368fd8d5d4f61a15eba644525029fee5f..138977558f95daf67d542e679ba5a005d0dddc3e 100644 (file)
                "Index is out of bounds: index=%" PRIu64 ", "           \
                "count=%" PRIu64, (uint64_t) (_index), (uint64_t) (_length))
 
+/*
+ * Asserts that the current thread has no error set.
+ */
+#define BT_ASSERT_PRE_NO_ERROR() \
+       do {                                                                    \
+               const struct bt_error *err = bt_current_thread_take_error();    \
+               if (err) {                                                      \
+                       bt_current_thread_move_error(err);                      \
+               }                                                               \
+               BT_ASSERT_PRE(!err,                                             \
+                       "API function called while current thread has an "      \
+                       "error: function=%s", __func__);                        \
+       } while (0)
+
 #ifdef BT_DEV_MODE
 /* Developer mode version of BT_ASSERT_PRE_MSG(). */
 # define BT_ASSERT_PRE_DEV_MSG(_fmt, ...)                              \
 # define BT_ASSERT_PRE_DEV_VALID_INDEX(_index, _length)                        \
        BT_ASSERT_PRE_VALID_INDEX((_index), (_length))
 
+/* Developer mode version of BT_ASSERT_PRE_NO_ERROR(). */
+# define BT_ASSERT_PRE_DEV_NO_ERROR() \
+       BT_ASSERT_PRE_NO_ERROR()
+
 /*
  * Marks a function as being only used within a BT_ASSERT_PRE_DEV()
  * context.
        ((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_NO_ERROR()
 # define BT_ASSERT_PRE_DEV_FUNC                __attribute__((unused))
 #endif /* BT_DEV_MODE */
 
index b347280f7a8588b573c52d8bd8df097fc08eee1d..21fb0b799ed65e2bc0b431c8b46c4cfca28ed3e3 100644 (file)
@@ -192,6 +192,8 @@ struct bt_component_class_sink *bt_component_class_sink_simple_borrow(void)
 {
        enum bt_component_class_set_method_status set_method_status;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        if (simple_comp_cls) {
                goto end;
        }
index 9bbf4172e751845d0c1afc2b32fe11457249fef4..5f01158a2d5b7e7e82fb636d37d4ac1bd264ad9c 100644 (file)
@@ -152,6 +152,7 @@ struct bt_component_class_source *bt_component_class_source_create(
        struct bt_component_class_source *source_class = NULL;
        int ret;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_NON_NULL(method, "Message iterator next method");
        BT_LOGI("Creating source component class: "
@@ -191,6 +192,7 @@ struct bt_component_class_filter *bt_component_class_filter_create(
        struct bt_component_class_filter *filter_class = NULL;
        int ret;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_NON_NULL(method, "Message iterator next method");
        BT_LOGI("Creating filter component class: "
@@ -229,6 +231,7 @@ struct bt_component_class_sink *bt_component_class_sink_create(
        struct bt_component_class_sink *sink_class = NULL;
        int ret;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_NON_NULL(method, "Consume next method");
        BT_LOGI("Creating sink component class: "
@@ -266,6 +269,7 @@ bt_component_class_source_set_get_supported_mip_versions_method(
                struct bt_component_class_source *comp_cls,
                bt_component_class_source_get_supported_mip_versions_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -280,6 +284,7 @@ bt_component_class_filter_set_get_supported_mip_versions_method(
                struct bt_component_class_filter *comp_cls,
                bt_component_class_filter_get_supported_mip_versions_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -294,6 +299,7 @@ bt_component_class_sink_set_get_supported_mip_versions_method(
                struct bt_component_class_sink *comp_cls,
                bt_component_class_sink_get_supported_mip_versions_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -308,6 +314,7 @@ bt_component_class_source_set_initialize_method(
                struct bt_component_class_source *comp_cls,
                bt_component_class_source_initialize_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -322,6 +329,7 @@ bt_component_class_filter_set_initialize_method(
                struct bt_component_class_filter *comp_cls,
                bt_component_class_filter_initialize_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -336,6 +344,7 @@ bt_component_class_sink_set_initialize_method(
                struct bt_component_class_sink *comp_cls,
                bt_component_class_sink_initialize_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -350,6 +359,7 @@ bt_component_class_source_set_finalize_method(
                struct bt_component_class_source *comp_cls,
                bt_component_class_source_finalize_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -364,6 +374,7 @@ bt_component_class_filter_set_finalize_method(
                struct bt_component_class_filter *comp_cls,
                bt_component_class_filter_finalize_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -378,6 +389,7 @@ bt_component_class_sink_set_finalize_method(
                struct bt_component_class_sink *comp_cls,
                bt_component_class_sink_finalize_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -392,6 +404,7 @@ bt_component_class_source_set_query_method(
                struct bt_component_class_source *comp_cls,
                bt_component_class_source_query_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -406,6 +419,7 @@ bt_component_class_filter_set_query_method(
                struct bt_component_class_filter *comp_cls,
                bt_component_class_filter_query_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -420,6 +434,7 @@ bt_component_class_sink_set_query_method(
                struct bt_component_class_sink *comp_cls,
                bt_component_class_sink_query_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -434,6 +449,7 @@ bt_component_class_filter_set_input_port_connected_method(
                struct bt_component_class_filter *comp_cls,
                bt_component_class_filter_input_port_connected_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -448,6 +464,7 @@ bt_component_class_sink_set_input_port_connected_method(
                struct bt_component_class_sink *comp_cls,
                bt_component_class_sink_input_port_connected_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -462,6 +479,7 @@ bt_component_class_source_set_output_port_connected_method(
                struct bt_component_class_source *comp_cls,
                bt_component_class_source_output_port_connected_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -476,6 +494,7 @@ bt_component_class_filter_set_output_port_connected_method(
                struct bt_component_class_filter *comp_cls,
                bt_component_class_filter_output_port_connected_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -490,6 +509,7 @@ bt_component_class_sink_set_graph_is_configured_method(
                struct bt_component_class_sink *comp_cls,
                bt_component_class_sink_graph_is_configured_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -504,6 +524,7 @@ bt_component_class_source_set_message_iterator_initialize_method(
                struct bt_component_class_source *comp_cls,
                bt_component_class_source_message_iterator_initialize_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -518,6 +539,7 @@ bt_component_class_filter_set_message_iterator_initialize_method(
                struct bt_component_class_filter *comp_cls,
                bt_component_class_filter_message_iterator_initialize_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -532,6 +554,7 @@ bt_component_class_source_set_message_iterator_finalize_method(
                struct bt_component_class_source *comp_cls,
                bt_component_class_source_message_iterator_finalize_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -546,6 +569,7 @@ bt_component_class_filter_set_message_iterator_finalize_method(
                struct bt_component_class_filter *comp_cls,
                bt_component_class_filter_message_iterator_finalize_method method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(method, "Method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -561,6 +585,7 @@ bt_component_class_filter_set_message_iterator_seek_ns_from_origin_methods(
                bt_component_class_filter_message_iterator_seek_ns_from_origin_method seek_method,
                bt_component_class_filter_message_iterator_can_seek_ns_from_origin_method can_seek_method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(seek_method, "Seek method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -577,6 +602,7 @@ bt_component_class_source_set_message_iterator_seek_ns_from_origin_methods(
                bt_component_class_source_message_iterator_seek_ns_from_origin_method seek_method,
                bt_component_class_source_message_iterator_can_seek_ns_from_origin_method can_seek_method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(seek_method, "Seek method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -593,6 +619,7 @@ bt_component_class_filter_set_message_iterator_seek_beginning_methods(
                bt_component_class_filter_message_iterator_seek_beginning_method seek_method,
                bt_component_class_filter_message_iterator_can_seek_beginning_method can_seek_method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(seek_method, "Seek method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -609,6 +636,7 @@ bt_component_class_source_set_message_iterator_seek_beginning_methods(
                bt_component_class_source_message_iterator_seek_beginning_method seek_method,
                bt_component_class_source_message_iterator_can_seek_beginning_method can_seek_method)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(seek_method, "Seek method");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -624,6 +652,7 @@ bt_component_class_set_description(
                struct bt_component_class *comp_cls,
                const char *description)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(description, "Description");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
@@ -640,6 +669,7 @@ enum bt_component_class_set_help_status bt_component_class_set_help(
                struct bt_component_class *comp_cls,
                const char *help)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(help, "Help");
        BT_ASSERT_PRE_DEV_COMP_CLS_HOT(comp_cls);
index 9dcbabf5a8828bcef5498dbda66ed01bff17ef55..e6b0894d0d7f3c9c7e6896bf309231be97613b5d 100644 (file)
@@ -86,6 +86,8 @@ struct bt_component_descriptor_set *bt_component_descriptor_set_create(void)
 {
        struct bt_component_descriptor_set *comp_descr_set;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        BT_LOGI_STR("Creating component descriptor set object.");
        comp_descr_set = g_new0(struct bt_component_descriptor_set, 1);
        if (!comp_descr_set) {
@@ -140,6 +142,7 @@ bt_component_descriptor_set_add_descriptor_with_initialize_method_data(
        struct bt_component_descriptor_set_entry *entry = NULL;
        GPtrArray *comp_descr_array = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_descr_set, "Component descriptor set");
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE(!params || bt_value_is_map(params),
@@ -214,6 +217,8 @@ bt_component_descriptor_set_add_descriptor(
                const struct bt_component_class *comp_cls,
                const struct bt_value *params)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return bt_component_descriptor_set_add_descriptor_with_initialize_method_data(
                comp_descr_set, comp_cls, params, NULL);
 }
index 010e8fe85f5b2007ada57d7a57ee1d646ec1b39a..9950a50295d43d9c79450ae3226664407891873d 100644 (file)
@@ -48,6 +48,8 @@ struct bt_component *bt_component_filter_create(
 {
        struct bt_component_filter *filter = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        filter = g_new0(struct bt_component_filter, 1);
        if (!filter) {
                BT_LIB_LOGE_APPEND_CAUSE(
@@ -122,6 +124,8 @@ enum bt_self_component_add_port_status bt_self_component_filter_add_output_port(
        enum bt_self_component_add_port_status status;
        struct bt_port *port = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        /* bt_component_add_output_port() logs details and errors */
        status = bt_component_add_output_port(comp, name, user_data, &port);
        if (status != BT_FUNC_STATUS_OK) {
@@ -190,6 +194,8 @@ enum bt_self_component_add_port_status bt_self_component_filter_add_input_port(
        struct bt_port *port = NULL;
        struct bt_component *comp = (void *) self_comp;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        /* bt_component_add_input_port() logs details/errors */
        status = bt_component_add_input_port(comp, name, user_data, &port);
        if (status != BT_FUNC_STATUS_OK) {
index b848a019acba3932a7d054efdb326f5a4aedf1a1..577239acf963582158570e1ee11791f82f1aef28 100644 (file)
@@ -49,6 +49,8 @@ struct bt_component *bt_component_sink_create(
 {
        struct bt_component_sink *sink = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        sink = g_new0(struct bt_component_sink, 1);
        if (!sink) {
                BT_LIB_LOGE_APPEND_CAUSE(
@@ -126,6 +128,8 @@ enum bt_self_component_add_port_status bt_self_component_sink_add_input_port(
        struct bt_port *port = NULL;
        struct bt_component *comp = (void *) self_comp;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        /* bt_component_add_input_port() logs details/errors */
        status = bt_component_add_input_port(comp, name, user_data, &port);
        if (status != BT_FUNC_STATUS_OK) {
index aed5dafd60b7840b42af4f85e8aa14db54f83bc2..d793c1920799997f7a4de8310d7639e30624c13d 100644 (file)
@@ -48,6 +48,8 @@ struct bt_component *bt_component_source_create(
 {
        struct bt_component_source *source = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        source = g_new0(struct bt_component_source, 1);
        if (!source) {
                BT_LIB_LOGE_APPEND_CAUSE(
@@ -120,6 +122,8 @@ enum bt_self_component_add_port_status bt_self_component_source_add_output_port(
        enum bt_self_component_add_port_status status;
        struct bt_port *port = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        /* bt_component_add_output_port() logs details and errors */
        status = bt_component_add_output_port(comp, name, user_data, &port);
        if (status != BT_FUNC_STATUS_OK) {
index 0f30ec46a529a217c451810b13347492cfb560af..22c4f92f8ec33314cd7f74cec71a5adb0781e3b8 100644 (file)
@@ -268,6 +268,7 @@ struct bt_graph *bt_graph_create(uint64_t mip_version)
        struct bt_graph *graph;
        int ret;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE(mip_version <= bt_get_maximal_mip_version(),
                "Unknown MIP version: mip-version=%" PRIu64 ", "
                "max-mip-version=%" PRIu64,
@@ -432,6 +433,7 @@ enum bt_graph_connect_ports_status bt_graph_connect_ports(
        enum bt_component_class_port_connected_method_status port_connected_status;
        bool init_can_consume;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(upstream_port, "Upstream port");
        BT_ASSERT_PRE_NON_NULL(downstream_port, "Downstream port port");
@@ -704,6 +706,7 @@ enum bt_graph_run_once_status bt_graph_run_once(struct bt_graph *graph)
 {
        enum bt_graph_run_once_status status;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_DEV_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_DEV(graph->can_consume,
                "Cannot consume graph in its current state: %!+g", graph);
@@ -728,6 +731,7 @@ enum bt_graph_run_status bt_graph_run(struct bt_graph *graph)
 {
        enum bt_graph_run_status status;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE(graph->can_consume,
                "Cannot consume graph in its current state: %!+g", graph);
@@ -809,6 +813,7 @@ bt_graph_add_source_component_output_port_added_listener(
        };
        bt_listener_id listener_id;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
        BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
@@ -844,6 +849,7 @@ bt_graph_add_filter_component_output_port_added_listener(
        };
        bt_listener_id listener_id;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
        BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
@@ -879,6 +885,7 @@ bt_graph_add_filter_component_input_port_added_listener(
        };
        bt_listener_id listener_id;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
        BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
@@ -914,6 +921,7 @@ bt_graph_add_sink_component_input_port_added_listener(
        };
        bt_listener_id listener_id;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
        BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
@@ -949,6 +957,7 @@ bt_graph_add_source_filter_component_ports_connected_listener(
        };
        bt_listener_id listener_id;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
        BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
@@ -985,6 +994,7 @@ bt_graph_add_source_sink_component_ports_connected_listener(
        };
        bt_listener_id listener_id;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
        BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
@@ -1021,6 +1031,7 @@ bt_graph_add_filter_filter_component_ports_connected_listener(
        };
        bt_listener_id listener_id;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
        BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
@@ -1057,6 +1068,7 @@ bt_graph_add_filter_sink_component_ports_connected_listener(
        };
        bt_listener_id listener_id;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(func, "Listener");
        BT_ASSERT_PRE_NON_NULL(func, "\"Listener removed\" listener");
@@ -1413,6 +1425,7 @@ bt_graph_add_source_component_with_initialize_method_data(
                void *init_method_data, bt_logging_level log_level,
                const struct bt_component_source **component)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        return add_component_with_init_method_data(graph,
                (void *) comp_cls, (comp_init_method_t) comp_cls->methods.init,
@@ -1426,6 +1439,7 @@ enum bt_graph_add_component_status bt_graph_add_source_component(
                enum bt_logging_level log_level,
                const struct bt_component_source **component)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        return bt_graph_add_source_component_with_initialize_method_data(
                graph, comp_cls, name, params, NULL, log_level, component);
 }
@@ -1438,6 +1452,7 @@ bt_graph_add_filter_component_with_initialize_method_data(
                void *init_method_data, enum bt_logging_level log_level,
                const struct bt_component_filter **component)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        return add_component_with_init_method_data(graph,
                (void *) comp_cls, (comp_init_method_t) comp_cls->methods.init,
@@ -1451,6 +1466,7 @@ enum bt_graph_add_component_status bt_graph_add_filter_component(
                enum bt_logging_level log_level,
                const struct bt_component_filter **component)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        return bt_graph_add_filter_component_with_initialize_method_data(
                graph, comp_cls, name, params, NULL, log_level, component);
 }
@@ -1463,6 +1479,7 @@ bt_graph_add_sink_component_with_initialize_method_data(
                void *init_method_data, enum bt_logging_level log_level,
                const struct bt_component_sink **component)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        return add_component_with_init_method_data(graph,
                (void *) comp_cls, (comp_init_method_t) comp_cls->methods.init,
@@ -1476,6 +1493,7 @@ enum bt_graph_add_component_status bt_graph_add_sink_component(
                enum bt_logging_level log_level,
                const struct bt_component_sink **component)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        return bt_graph_add_sink_component_with_initialize_method_data(
                graph, comp_cls, name, params, NULL, log_level, component);
 }
@@ -1496,6 +1514,8 @@ bt_graph_add_simple_sink_component(struct bt_graph *graph, const char *name,
                .user_data = user_data,
        };
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        /*
         * Other preconditions are checked by
         * bt_graph_add_sink_component_with_init_method_data().
@@ -1546,6 +1566,7 @@ bool bt_graph_is_interrupted(const struct bt_graph *graph)
 enum bt_graph_add_interrupter_status bt_graph_add_interrupter(
                struct bt_graph *graph, const struct bt_interrupter *intr)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(graph, "Graph");
        BT_ASSERT_PRE_NON_NULL(intr, "Interrupter");
        g_ptr_array_add(graph->interrupters, (void *) intr);
index 2a066ddd90542505c3445db2c103b8ee71966f88..5e48e5e69e4392bbe51351439437066c3224b216 100644 (file)
@@ -40,6 +40,8 @@ extern struct bt_interrupter *bt_interrupter_create(void)
 {
        struct bt_interrupter *intr = g_new0(struct bt_interrupter, 1);
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        if (!intr) {
                BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate one interrupter.");
                goto error;
index 6dc3ba98266d37fe88f94d4e617b1a3fc36113bf..49381a3ca9f69dcb4d21c7cd4520462053380726 100644 (file)
@@ -527,6 +527,7 @@ bt_self_component_port_input_message_iterator_create_from_message_iterator(
                struct bt_self_component_port_input *input_port,
                struct bt_self_component_port_input_message_iterator **message_iterator)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator");
        return create_self_component_input_port_message_iterator(self_msg_iter,
                input_port, message_iterator);
@@ -538,6 +539,7 @@ bt_self_component_port_input_message_iterator_create_from_sink_component(
                struct bt_self_component_port_input *input_port,
                struct bt_self_component_port_input_message_iterator **message_iterator)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(self_comp, "Sink component");
        return create_self_component_input_port_message_iterator(NULL,
                input_port, message_iterator);
@@ -882,6 +884,7 @@ bt_self_component_port_input_message_iterator_next(
 {
        enum bt_message_iterator_next_status status = BT_FUNC_STATUS_OK;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        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)");
@@ -988,6 +991,7 @@ bt_self_component_port_input_message_iterator_can_seek_ns_from_origin(
 {
        enum bt_message_iterator_can_seek_ns_from_origin_status status;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
        BT_ASSERT_PRE_NON_NULL(can_seek, "Result (output)");
        BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator);
@@ -1058,6 +1062,7 @@ bt_self_component_port_input_message_iterator_can_seek_beginning(
 {
        enum bt_message_iterator_can_seek_beginning_status status;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
        BT_ASSERT_PRE_NON_NULL(can_seek, "Result (output)");
        BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator);
@@ -1150,6 +1155,7 @@ bt_self_component_port_input_message_iterator_seek_beginning(
 {
        int status;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
        BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator);
        BT_ASSERT_PRE(
@@ -1714,6 +1720,7 @@ bt_self_component_port_input_message_iterator_seek_ns_from_origin(
        GHashTable *stream_states = NULL;
        bt_bool can_seek_by_itself;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
        BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(iterator);
        BT_ASSERT_PRE(
index b3522adf75a4257e23c355812f492d477ead6b43..0b19abc367de1704417921bfc20437d49f5896b7 100644 (file)
@@ -225,6 +225,8 @@ struct bt_message *bt_message_discarded_events_create(
                struct bt_self_message_iterator *message_iterator,
                const struct bt_stream *stream)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
+
        return create_discarded_items_message(message_iterator,
                BT_MESSAGE_TYPE_DISCARDED_EVENTS, (void *) stream,
                false, 0, 0);
@@ -235,6 +237,8 @@ struct bt_message *bt_message_discarded_events_create_with_default_clock_snapsho
                const struct bt_stream *stream, uint64_t beginning_raw_value,
                uint64_t end_raw_value)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
+
        return create_discarded_items_message(message_iterator,
                BT_MESSAGE_TYPE_DISCARDED_EVENTS, (void *) stream,
                true, beginning_raw_value, end_raw_value);
@@ -296,6 +300,8 @@ struct bt_message *bt_message_discarded_packets_create(
                struct bt_self_message_iterator *message_iterator,
                const struct bt_stream *stream)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
+
        return create_discarded_items_message(message_iterator,
                BT_MESSAGE_TYPE_DISCARDED_PACKETS, (void *) stream,
                false, 0, 0);
@@ -306,6 +312,8 @@ struct bt_message *bt_message_discarded_packets_create_with_default_clock_snapsh
                const struct bt_stream *stream, uint64_t beginning_raw_value,
                uint64_t end_raw_value)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
+
        return create_discarded_items_message(message_iterator,
                BT_MESSAGE_TYPE_DISCARDED_PACKETS, (void *) stream,
                true, beginning_raw_value, end_raw_value);
index 576257900dc62e3dd9db693c2b4508148d87817a..7c4754f9794cc6213ff3f63e606a807a458e794c 100644 (file)
@@ -177,6 +177,7 @@ struct bt_message *bt_message_event_create(
                const struct bt_event_class *event_class,
                const struct bt_stream *stream)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
        return create_event_message(msg_iter, event_class, NULL, stream, false, 0);
 }
@@ -186,6 +187,7 @@ struct bt_message *bt_message_event_create_with_packet(
                const struct bt_event_class *event_class,
                const struct bt_packet *packet)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(packet, "Packet");
        return create_event_message(msg_iter, event_class, packet,
                packet->stream, false, 0);
@@ -197,6 +199,7 @@ struct bt_message *bt_message_event_create_with_default_clock_snapshot(
                const struct bt_stream *stream,
                uint64_t raw_value)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
        return create_event_message(msg_iter, event_class, NULL, stream,
                true, raw_value);
@@ -209,6 +212,7 @@ bt_message_event_create_with_packet_and_default_clock_snapshot(
                const struct bt_packet *packet,
                uint64_t raw_value)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(packet, "Packet");
        return create_event_message(msg_iter, event_class, packet,
                packet->stream, true, raw_value);
index adfa4c574ea4675886f8fe43e1f0f9f279ea05c9..e5776ae0490fdd982b7c5ab0e296a0a8e8c3bbfe 100644 (file)
@@ -61,6 +61,7 @@ struct bt_message *bt_message_message_iterator_inactivity_create(
        struct bt_message_message_iterator_inactivity *message;
        struct bt_message *ret_msg = NULL;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
        BT_ASSERT_PRE_NON_NULL(default_clock_class, "Default clock class");
        BT_LIB_LOGD("Creating message iterator inactivity message object: "
index 061254173cae2ea9503143b2ff1ef4ab51b7d20c..25c1abf49555b2c9a935d483a596294abbb35124 100644 (file)
@@ -174,6 +174,7 @@ struct bt_message *bt_message_packet_beginning_create(
        struct bt_self_component_port_input_message_iterator *msg_iter =
                (void *) self_msg_iter;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
        return create_packet_message(msg_iter, (void *) packet,
                &msg_iter->graph->packet_begin_msg_pool, false, 0);
@@ -186,6 +187,7 @@ struct bt_message *bt_message_packet_beginning_create_with_default_clock_snapsho
        struct bt_self_component_port_input_message_iterator *msg_iter =
                (void *) self_msg_iter;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
        return create_packet_message(msg_iter, (void *) packet,
                &msg_iter->graph->packet_begin_msg_pool, true, raw_value);
@@ -198,6 +200,7 @@ struct bt_message *bt_message_packet_end_create(
        struct bt_self_component_port_input_message_iterator *msg_iter =
                (void *) self_msg_iter;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
        return create_packet_message(msg_iter, (void *) packet,
                &msg_iter->graph->packet_end_msg_pool, false, 0);
@@ -210,6 +213,7 @@ struct bt_message *bt_message_packet_end_create_with_default_clock_snapshot(
        struct bt_self_component_port_input_message_iterator *msg_iter =
                (void *) self_msg_iter;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(msg_iter, "Message iterator");
        return create_packet_message(msg_iter, (void *) packet,
                &msg_iter->graph->packet_end_msg_pool, true, raw_value);
index a110338aa1b5b42bfe1d0bf1d1816b70d6efa29b..40903d001b39a7e164e35d0991e1bc0dd15422d7 100644 (file)
@@ -113,6 +113,8 @@ struct bt_message *bt_message_stream_beginning_create(
                struct bt_self_message_iterator *self_msg_iter,
                const struct bt_stream *stream)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
+
        return create_stream_message(self_msg_iter, (void *) stream,
                BT_MESSAGE_TYPE_STREAM_BEGINNING);
 }
@@ -121,6 +123,8 @@ struct bt_message *bt_message_stream_end_create(
                struct bt_self_message_iterator *self_msg_iter,
                const struct bt_stream *stream)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
+
        return create_stream_message(self_msg_iter, (void *) stream,
                BT_MESSAGE_TYPE_STREAM_END);
 }
index 2e0aac35d65a8d5f03f555c81a4ca32e22957611..a4704c5d51a0efbe5f8fd247e0fa2aef92e8f7bd 100644 (file)
@@ -195,6 +195,7 @@ bt_get_greatest_operative_mip_version(
 {
        int status = BT_FUNC_STATUS_OK;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_descr_set, "Component descriptor set");
        BT_ASSERT_PRE_NON_NULL(operative_mip_version,
                "Operative MIP version (output)");
index c798cfe5b7f94713e65c24833a9e3a94dafdf865..9a78d790a8233263917dc693515db8c0f39cd197 100644 (file)
@@ -74,6 +74,7 @@ struct bt_query_executor *bt_query_executor_create_with_method_data(
 {
        struct bt_query_executor *query_exec;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(comp_cls, "Component class");
        BT_ASSERT_PRE_NON_NULL(object, "Object");
        BT_LIB_LOGD("Creating query executor: "
@@ -137,6 +138,7 @@ struct bt_query_executor *bt_query_executor_create(
                const bt_component_class *comp_cls, const char *object,
                const bt_value *params)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        return bt_query_executor_create_with_method_data(comp_cls,
                object, params, NULL);
 }
@@ -157,6 +159,7 @@ enum bt_query_executor_query_status bt_query_executor_query(
        enum bt_component_class_query_method_status query_status;
        method_t method = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor");
        BT_ASSERT_PRE_NON_NULL(user_result, "Result (output)");
 
@@ -256,6 +259,7 @@ enum bt_query_executor_add_interrupter_status bt_query_executor_add_interrupter(
                struct bt_query_executor *query_exec,
                const struct bt_interrupter *intr)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(query_exec, "Query executor");
        BT_ASSERT_PRE_NON_NULL(intr, "Interrupter");
        g_ptr_array_add(query_exec->interrupters, (void *) intr);
index 3c01ba35b868cf9da5c79c0ec5d6a69433ac5e85..e1c5e6d1e9397847f421563d1b0e5c74e6b3f917 100644 (file)
@@ -180,11 +180,15 @@ end:
 
 struct bt_integer_range_set_unsigned *bt_integer_range_set_unsigned_create(void)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return (void *) create_range_set();
 }
 
 struct bt_integer_range_set_signed *bt_integer_range_set_signed_create(void)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return (void *) create_range_set();
 }
 
@@ -211,6 +215,7 @@ bt_integer_range_set_unsigned_add_range(
                struct bt_integer_range_set_unsigned *range_set,
                uint64_t lower, uint64_t upper)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE(lower <= upper,
                "Range's upper bound is less than lower bound: "
                "upper=%" PRIu64 ", lower=%" PRIu64, lower, upper);
@@ -223,6 +228,7 @@ bt_integer_range_set_signed_add_range(
                struct bt_integer_range_set_signed *range_set,
                int64_t lower, int64_t upper)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE(lower <= upper,
                "Range's upper bound is less than lower bound: "
                "upper=%" PRId64 ", lower=%" PRId64, lower, upper);
index 58a2419044fc9cd1c34e37d981220fa8079e09b2..16850d80ec2ab68bc8ca26c24138cdb4516e302d 100644 (file)
@@ -188,6 +188,8 @@ enum bt_plugin_find_all_from_static_status bt_plugin_find_all_from_static(
                bt_bool fail_on_load_error,
                const struct bt_plugin_set **plugin_set_out)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        /* bt_plugin_so_create_all_from_static() logs errors */
        return bt_plugin_so_create_all_from_static(fail_on_load_error,
                (void *) plugin_set_out);
@@ -199,6 +201,7 @@ enum bt_plugin_find_all_from_file_status bt_plugin_find_all_from_file(
 {
        enum bt_plugin_find_all_from_file_status status;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(path, "Path");
        BT_ASSERT_PRE_NON_NULL(path, "Plugin set (output)");
        BT_LOGI("Creating plugins from file: path=\"%s\"", path);
@@ -282,6 +285,7 @@ enum bt_plugin_find_all_status bt_plugin_find_all(bt_bool find_in_std_env_var,
        int status = BT_FUNC_STATUS_OK;
        uint64_t dir_i, plugin_i;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(plugin_set_out, "Plugin set (output)");
        BT_LOGI("Finding all plugins in standard directories and built-in plugins: "
                "find-in-std-env-var=%d, find-in-user-dir=%d, "
@@ -465,6 +469,7 @@ enum bt_plugin_find_status bt_plugin_find(const char *plugin_name,
        const struct bt_plugin_set *plugin_set = NULL;
        uint64_t i;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(plugin_name, "Name");
        BT_ASSERT_PRE_NON_NULL(plugin_out, "Plugin (output)");
        BT_LOGI("Finding named plugin in standard directories and built-in plugins: "
@@ -666,6 +671,7 @@ enum bt_plugin_find_all_from_dir_status bt_plugin_find_all_from_dir(
        enum bt_plugin_find_all_from_dir_status status =
                BT_FUNC_STATUS_OK;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(plugin_set_out, "Plugin set (output)");
        BT_LOGI("Creating all plugins in directory: path=\"%s\", recurse=%d",
                path, recurse);
index 0b449e277ad2e4b8f5911373de10a55c822d60ff..736e0b8e2d50f53810eec72c65e65d34b58ceebe 100644 (file)
@@ -88,6 +88,7 @@ struct bt_clock_class *bt_clock_class_create(bt_self_component *self_comp)
        int ret;
        struct bt_clock_class *clock_class = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(self_comp, "Self component");
        BT_LOGD_STR("Creating default clock class object");
 
@@ -152,6 +153,7 @@ const char *bt_clock_class_get_name(const struct bt_clock_class *clock_class)
 enum bt_clock_class_set_name_status bt_clock_class_set_name(
                struct bt_clock_class *clock_class, const char *name)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
@@ -171,6 +173,7 @@ const char *bt_clock_class_get_description(
 enum bt_clock_class_set_description_status bt_clock_class_set_description(
                struct bt_clock_class *clock_class, const char *descr)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
        BT_ASSERT_PRE_NON_NULL(descr, "Description");
        BT_ASSERT_PRE_DEV_CLOCK_CLASS_HOT(clock_class);
@@ -301,6 +304,7 @@ bt_clock_class_cycles_to_ns_from_origin(
 {
        int ret;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        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);
index cbce39c14e022f90fd93c74473f719dc314dba77..19aab80aabdfc34f0e6a18515c9f394a32a31a84 100644 (file)
@@ -149,6 +149,7 @@ bt_clock_snapshot_get_ns_from_origin(
 {
        int ret = BT_FUNC_STATUS_OK;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        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,
index ba79f28b6ff7ca1eb5865f05e87b89216e04d426..22211cd1aae8a32d02d2801d5222bf06a01e01aa 100644 (file)
@@ -178,6 +178,7 @@ end:
 struct bt_event_class *bt_event_class_create(
                struct bt_stream_class *stream_class)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
        BT_ASSERT_PRE(stream_class->assigns_automatic_event_class_id,
                "Stream class does not automatically assigns event class IDs: "
@@ -189,6 +190,7 @@ struct bt_event_class *bt_event_class_create(
 struct bt_event_class *bt_event_class_create_with_id(
                struct bt_stream_class *stream_class, uint64_t id)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE(!stream_class->assigns_automatic_event_class_id,
                "Stream class automatically assigns event class IDs: "
                "%![sc-]+S", stream_class);
@@ -204,6 +206,7 @@ const char *bt_event_class_get_name(const struct bt_event_class *event_class)
 enum bt_event_class_set_name_status bt_event_class_set_name(
                struct bt_event_class *event_class, const char *name)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
@@ -251,6 +254,7 @@ enum bt_event_class_set_emf_uri_status bt_event_class_set_emf_uri(
                struct bt_event_class *event_class,
                const char *emf_uri)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
        BT_ASSERT_PRE_NON_NULL(emf_uri, "EMF URI");
        BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
@@ -304,6 +308,7 @@ bt_event_class_set_specific_context_field_class(
                .event_payload = NULL,
        };
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
        BT_ASSERT_PRE_NON_NULL(field_class, "Field class");
        BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
@@ -368,6 +373,7 @@ bt_event_class_set_payload_field_class(
                .event_payload = field_class,
        };
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
        BT_ASSERT_PRE_NON_NULL(field_class, "Field class");
        BT_ASSERT_PRE_DEV_EVENT_CLASS_HOT(event_class);
index a282c9bcee4c314abab889a409a0a3df526e8732..e036cfae2e41e69a6e55f538c43a1e5f91d64e3f 100644 (file)
@@ -98,6 +98,7 @@ struct bt_field_class *bt_field_class_bit_array_create(
 {
        struct bt_field_class_bit_array *ba_fc = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class");
        BT_ASSERT_PRE(length > 0 && length <= 64,
                "Unsupported length for bit array field class "
@@ -150,6 +151,7 @@ struct bt_field_class *bt_field_class_bool_create(
 {
        struct bt_field_class_bool *bool_fc = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class");
        BT_LOGD("Creating default boolean field class object.");
        bool_fc = g_new0(struct bt_field_class_bool, 1);
@@ -236,6 +238,8 @@ end:
 struct bt_field_class *bt_field_class_integer_unsigned_create(
                bt_trace_class *trace_class)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return create_integer_field_class(trace_class,
                BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER);
 }
@@ -243,6 +247,8 @@ struct bt_field_class *bt_field_class_integer_unsigned_create(
 struct bt_field_class *bt_field_class_integer_signed_create(
                bt_trace_class *trace_class)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return create_integer_field_class(trace_class,
                BT_FIELD_CLASS_TYPE_SIGNED_INTEGER);
 }
@@ -400,6 +406,8 @@ end:
 struct bt_field_class *bt_field_class_enumeration_unsigned_create(
                bt_trace_class *trace_class)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return create_enumeration_field_class(trace_class,
                BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION);
 }
@@ -407,6 +415,8 @@ struct bt_field_class *bt_field_class_enumeration_unsigned_create(
 struct bt_field_class *bt_field_class_enumeration_signed_create(
                bt_trace_class *trace_class)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return create_enumeration_field_class(trace_class,
                BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION);
 }
@@ -532,6 +542,7 @@ bt_field_class_enumeration_unsigned_get_mapping_labels_for_value(
        const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
        uint64_t i;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        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)");
@@ -572,6 +583,7 @@ bt_field_class_enumeration_signed_get_mapping_labels_for_value(
        const struct bt_field_class_enumeration *enum_fc = (const void *) fc;
        uint64_t i;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        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)");
@@ -638,6 +650,7 @@ add_mapping_to_enumeration_field_class(struct bt_field_class *fc,
        struct bt_field_class_enumeration *enum_fc = (void *) fc;
        struct bt_field_class_enumeration_mapping mapping = { 0 };
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT(fc);
        BT_ASSERT_PRE_NON_NULL(label, "Label");
        BT_ASSERT_PRE_NON_NULL(range_set, "Integer range set");
@@ -667,6 +680,7 @@ bt_field_class_enumeration_unsigned_add_mapping(
                struct bt_field_class *fc, const char *label,
                const struct bt_integer_range_set_unsigned *range_set)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(fc, "Field class");
        BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION,
                "Field class");
@@ -679,6 +693,7 @@ bt_field_class_enumeration_signed_add_mapping(
                struct bt_field_class *fc, const char *label,
                const struct bt_integer_range_set_signed *range_set)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(fc, "Field class");
        BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION,
                "Field class");
@@ -727,6 +742,8 @@ end:
 struct bt_field_class *bt_field_class_real_single_precision_create(
        bt_trace_class *trace_class)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return create_real_field_class(trace_class,
                BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL);
 }
@@ -734,6 +751,8 @@ struct bt_field_class *bt_field_class_real_single_precision_create(
 struct bt_field_class *bt_field_class_real_double_precision_create(
        bt_trace_class *trace_class)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return create_real_field_class(trace_class,
                BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL);
 }
@@ -847,6 +866,7 @@ struct bt_field_class *bt_field_class_structure_create(
        int ret;
        struct bt_field_class_structure *struct_fc = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class");
        BT_LOGD_STR("Creating default structure field class object.");
        struct_fc = g_new0(struct bt_field_class_structure, 1);
@@ -1001,6 +1021,7 @@ bt_field_class_structure_append_member(
        enum bt_field_class_structure_append_member_status status;
        struct bt_named_field_class *named_fc = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(fc, "Field class");
        BT_ASSERT_PRE_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_STRUCTURE,
                "Field class");
@@ -1258,6 +1279,8 @@ struct bt_field_class *bt_field_class_option_without_selector_create(
                struct bt_trace_class *trace_class,
                struct bt_field_class *content_fc)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return create_option_field_class(trace_class,
                BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD,
                content_fc, NULL);
@@ -1268,17 +1291,11 @@ struct bt_field_class *bt_field_class_option_with_selector_field_bool_create(
                struct bt_field_class *content_fc,
                struct bt_field_class *selector_fc)
 {
-       struct bt_field_class_option_with_selector_field_bool *fc =
-               (void *) create_option_field_class(trace_class,
-                       BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD,
-                       content_fc, selector_fc);
+       BT_ASSERT_PRE_NO_ERROR();
 
-       if (!fc) {
-               goto end;
-       }
-
-end:
-       return (void *) fc;
+       return create_option_field_class(trace_class,
+               BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD,
+               content_fc, selector_fc);
 }
 
 struct bt_field_class *
@@ -1292,6 +1309,7 @@ bt_field_class_option_with_selector_field_integer_unsigned_create(
        const struct bt_integer_range_set *range_set =
                (const void *) u_range_set;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(range_set, "Integer range set");
        BT_ASSERT_PRE(range_set->ranges->len > 0,
                "Integer range set is empty: %!+R", range_set);
@@ -1322,6 +1340,7 @@ bt_field_class_option_with_selector_field_integer_signed_create(
        const struct bt_integer_range_set *range_set =
                (const void *) i_range_set;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(range_set, "Integer range set");
        BT_ASSERT_PRE(range_set->ranges->len > 0,
                "Integer range set is empty: %!+R", range_set);
@@ -1461,6 +1480,7 @@ struct bt_field_class *bt_field_class_variant_create(
        struct bt_field_class_variant_with_selector_field *var_with_sel_fc = NULL;
        enum bt_field_class_type fc_type;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class");
 
        if (selector_fc) {
@@ -1538,6 +1558,7 @@ bt_field_class_variant_without_selector_append_option(struct bt_field_class *fc,
        enum bt_field_class_variant_without_selector_append_option_status status;
        struct bt_named_field_class *named_fc = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(fc, "Field class");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_NON_NULL(option_fc, "Option field class");
@@ -1708,6 +1729,8 @@ bt_field_class_variant_with_selector_field_integer_unsigned_append_option(
                struct bt_field_class *option_fc,
                const struct bt_integer_range_set_unsigned *range_set)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return append_option_to_variant_with_selector_field_field_class(fc,
                name, option_fc, (const void *) range_set,
                BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD);
@@ -1719,6 +1742,8 @@ bt_field_class_variant_with_selector_field_integer_signed_append_option(
                struct bt_field_class *option_fc,
                const struct bt_integer_range_set_signed *range_set)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return append_option_to_variant_with_selector_field_field_class(fc,
                name, option_fc, (const void *) range_set,
                BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD);
@@ -1937,6 +1962,7 @@ bt_field_class_array_static_create(bt_trace_class *trace_class,
 {
        struct bt_field_class_array_static *array_fc = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class");
        BT_ASSERT_PRE_NON_NULL(element_fc, "Element field class");
        BT_LOGD_STR("Creating default static array field class object.");
@@ -2017,6 +2043,7 @@ struct bt_field_class *bt_field_class_array_dynamic_create(
 {
        struct bt_field_class_array_dynamic *array_fc = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class");
        BT_ASSERT_PRE_NON_NULL(element_fc, "Element field class");
        BT_LOGD_STR("Creating default dynamic array field class object.");
@@ -2059,6 +2086,7 @@ bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const(
 {
        const struct bt_field_class_array_dynamic *seq_fc = (const void *) fc;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
        BT_ASSERT_PRE_DEV_FC_HAS_ID(fc,
                BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD,
@@ -2079,6 +2107,7 @@ struct bt_field_class *bt_field_class_string_create(bt_trace_class *trace_class)
 {
        struct bt_field_class_string *string_fc = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace_class, "Trace class");
        BT_LOGD_STR("Creating default string field class object.");
        string_fc = g_new0(struct bt_field_class_string, 1);
index 8db595ec87fffa60d3c42bfc197f02fc7f8cf5b5..91e918dda74bce7fbf559f605b840502bb506c69 100644 (file)
@@ -797,6 +797,7 @@ bt_field_enumeration_unsigned_get_mapping_labels(
 {
        const struct bt_field_integer *int_field = (const void *) field;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        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)");
@@ -816,6 +817,7 @@ bt_field_enumeration_signed_get_mapping_labels(
 {
        const struct bt_field_integer *int_field = (const void *) field;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        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)");
@@ -862,6 +864,7 @@ void clear_string_field(struct bt_field *field)
 enum bt_field_string_set_value_status bt_field_string_set_value(
                struct bt_field *field, const char *value)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
        BT_ASSERT_PRE_DEV_NON_NULL(value, "Value");
        BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
@@ -875,6 +878,8 @@ enum bt_field_string_set_value_status bt_field_string_set_value(
 enum bt_field_string_append_status bt_field_string_append(
                struct bt_field *field, const char *value)
 {
+       BT_ASSERT_PRE_DEV_NO_ERROR();
+
        return bt_field_string_append_with_length(field,
                value, (uint64_t) strlen(value));
 }
@@ -886,6 +891,7 @@ enum bt_field_string_append_status bt_field_string_append_with_length(
        char *data;
        uint64_t new_length;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
        BT_ASSERT_PRE_DEV_NON_NULL(value, "Value");
        BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
@@ -935,6 +941,7 @@ enum bt_field_array_dynamic_set_length_status bt_field_array_dynamic_set_length(
        int ret = BT_FUNC_STATUS_OK;
        struct bt_field_array *array_field = (void *) field;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
        BT_ASSERT_PRE_DEV_FIELD_IS_DYNAMIC_ARRAY(field, "Field");
        BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
@@ -1171,6 +1178,7 @@ bt_field_variant_select_option_field_by_index(
 {
        struct bt_field_variant *var_field = (void *) field;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        BT_ASSERT_PRE_DEV_NON_NULL(field, "Field");
        BT_ASSERT_PRE_DEV_FIELD_IS_VARIANT(field, "Field");
        BT_ASSERT_PRE_DEV_FIELD_HOT(field, "Field");
index 786cbdf6a76aa24b12f8a93a39abf11d3a28d30b..c5a628c2e1e5ac96a8c51f69fa3a77bdfb8e7556 100644 (file)
@@ -62,6 +62,7 @@ struct bt_packet_context_field *bt_packet_context_field_create(
 {
        struct bt_field_wrapper *field_wrapper;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
        BT_ASSERT_PRE(stream_class->supports_packets,
                "Stream class does not support packets: %![sc-]+S",
index a5c3fc7a196e61878b88fe3da34040446120ae83..166f7ca2e5d433532d11d712e4d1f276b421d61d 100644 (file)
@@ -219,6 +219,7 @@ struct bt_packet *bt_packet_create(const struct bt_stream *c_stream)
        struct bt_packet *packet = NULL;
        struct bt_stream *stream = (void *) c_stream;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
        BT_ASSERT_PRE(stream->class->supports_packets,
                "Stream class does not support packets: %![sc-]+S",
@@ -248,6 +249,7 @@ enum bt_packet_move_context_field_status bt_packet_move_context_field(
        struct bt_stream_class *stream_class;
        struct bt_field_wrapper *field_wrapper = (void *) context_field;
 
+       BT_ASSERT_PRE_DEV_NO_ERROR();
        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);
index c87978b5a19e5c92ad1287ad99161fb2571f1f72..e580b2a9e4f132619466c8c05252ff547b682274 100644 (file)
@@ -177,6 +177,7 @@ end:
 
 struct bt_stream_class *bt_stream_class_create(struct bt_trace_class *tc)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(tc, "Trace class");
        BT_ASSERT_PRE(tc->assigns_automatic_stream_class_id,
                "Trace class does not automatically assigns stream class IDs: "
@@ -188,6 +189,7 @@ struct bt_stream_class *bt_stream_class_create(struct bt_trace_class *tc)
 struct bt_stream_class *bt_stream_class_create_with_id(
                struct bt_trace_class *tc, uint64_t id)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(tc, "Trace class");
        BT_ASSERT_PRE(!tc->assigns_automatic_stream_class_id,
                "Trace class automatically assigns stream class IDs: "
@@ -218,6 +220,7 @@ enum bt_stream_class_set_name_status bt_stream_class_set_name(
                struct bt_stream_class *stream_class,
                const char *name)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
@@ -315,6 +318,7 @@ bt_stream_class_set_packet_context_field_class(
                .event_payload = NULL,
        };
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
        BT_ASSERT_PRE(stream_class->supports_packets,
                "Stream class does not support packets: %![sc-]+S",
@@ -377,6 +381,7 @@ bt_stream_class_set_event_common_context_field_class(
                .event_payload = NULL,
        };
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
        BT_ASSERT_PRE_NON_NULL(field_class, "Field class");
        BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
@@ -425,6 +430,7 @@ bt_stream_class_set_default_clock_class(
                struct bt_stream_class *stream_class,
                struct bt_clock_class *clock_class)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
        BT_ASSERT_PRE_NON_NULL(clock_class, "Clock class");
        BT_ASSERT_PRE_DEV_STREAM_CLASS_HOT(stream_class);
index ec97a292cf46036e0fef3e74019806996bf3a62c..c35b9da99ea2851a71de06cf3e328e0e014fc559 100644 (file)
@@ -167,6 +167,7 @@ struct bt_stream *bt_stream_create(struct bt_stream_class *stream_class,
 {
        uint64_t id;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE(stream_class->assigns_automatic_stream_id,
@@ -179,6 +180,7 @@ struct bt_stream *bt_stream_create(struct bt_stream_class *stream_class,
 struct bt_stream *bt_stream_create_with_id(struct bt_stream_class *stream_class,
                struct bt_trace *trace, uint64_t id)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE(!stream_class->assigns_automatic_stream_id,
@@ -220,6 +222,7 @@ const char *bt_stream_get_name(const struct bt_stream *stream)
 enum bt_stream_set_name_status bt_stream_set_name(struct bt_stream *stream,
                const char *name)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(stream, "Stream");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_DEV_STREAM_HOT(stream);
index 3e6a872c1666d46a369af24c67438abe4f34ee8e..f9aedea0947c2b93092d5917c5575cb69d463352 100644 (file)
@@ -128,6 +128,7 @@ struct bt_trace_class *bt_trace_class_create(bt_self_component *self_comp)
 {
        struct bt_trace_class *tc = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(self_comp, "Self component");
        BT_LOGD_STR("Creating default trace class object.");
        tc = g_new0(struct bt_trace_class, 1);
@@ -181,6 +182,7 @@ enum bt_trace_class_add_listener_status bt_trace_class_add_destruction_listener(
                .data = data,
        };
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(tc, "Trace class");
        BT_ASSERT_PRE_NON_NULL(listener, "Listener");
 
@@ -225,6 +227,7 @@ enum bt_trace_class_remove_listener_status bt_trace_class_remove_destruction_lis
        struct bt_trace_class *tc = (void *) _tc;
        struct bt_trace_class_destruction_listener_elem *elem;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(tc, "Trace class");
        BT_ASSERT_PRE(has_listener_id(tc, listener_id),
                "Trace class has no such trace class destruction listener ID: "
index 3bf26b7bcdb8b009a32311ff9dd29e07a3c81582..d155cae2e0ea205c0a04ffc5ab0d3019d6d637ed 100644 (file)
@@ -150,6 +150,8 @@ struct bt_trace *bt_trace_create(struct bt_trace_class *tc)
 {
        struct bt_trace *trace = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        BT_LIB_LOGD("Creating trace object: %![tc-]+T", tc);
        trace = g_new0(struct bt_trace, 1);
        if (!trace) {
@@ -219,6 +221,7 @@ const char *bt_trace_get_name(const struct bt_trace *trace)
 enum bt_trace_set_name_status bt_trace_set_name(struct bt_trace *trace,
                const char *name)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_DEV_TRACE_HOT(trace);
@@ -289,9 +292,12 @@ bt_trace_set_environment_entry_string(
 {
        int ret;
        struct bt_value *value_obj;
+
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
        BT_ASSERT_PRE_NON_NULL(value, "Value");
+
        value_obj = bt_value_string_create_init(value);
        if (!value_obj) {
                BT_LIB_LOGE_APPEND_CAUSE(
@@ -314,8 +320,11 @@ bt_trace_set_environment_entry_integer(
 {
        int ret;
        struct bt_value *value_obj;
+
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE_NON_NULL(name, "Name");
+
        value_obj = bt_value_integer_signed_create_init(value);
        if (!value_obj) {
                BT_LIB_LOGE_APPEND_CAUSE(
@@ -422,6 +431,7 @@ enum bt_trace_add_listener_status bt_trace_add_destruction_listener(
                .data = data,
        };
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE_NON_NULL(listener, "Listener");
 
@@ -466,6 +476,7 @@ enum bt_trace_remove_listener_status bt_trace_remove_destruction_listener(
        struct bt_trace *trace = (void *) c_trace;
        struct bt_trace_destruction_listener_elem *elem;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(trace, "Trace");
        BT_ASSERT_PRE(has_listener_id(trace, listener_id),
                "Trace has no such trace destruction listener ID: "
index af2d1a4a61a4d63dc71006a66d2e5cd19b010a47..8c54e0ea4ea2f4509b532b24f591c345ebde2d25 100644 (file)
@@ -42,6 +42,7 @@ bt_util_clock_cycles_to_ns_from_origin(uint64_t cycles,
                BT_FUNC_STATUS_OK;
        int ret;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(ns, "Nanoseconds (output)");
        BT_ASSERT_PRE(frequency != UINT64_C(-1) && frequency != 0,
                "Invalid frequency: freq=%" PRIu64, frequency);
index 96c01ac453f9d79abcd0410cb82488a029f467e0..15a97a828f9656501e01993c69f458867697cc2b 100644 (file)
@@ -590,6 +590,8 @@ struct bt_value *bt_value_bool_create_init(bt_bool val)
 {
        struct bt_value_bool *bool_obj;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        BT_LOGD("Creating boolean value object: val=%d", val);
        bool_obj = g_new0(struct bt_value_bool, 1);
        if (!bool_obj) {
@@ -608,6 +610,8 @@ end:
 
 struct bt_value *bt_value_bool_create(void)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return bt_value_bool_create_init(BT_FALSE);
 }
 
@@ -647,23 +651,31 @@ end:
 
 struct bt_value *bt_value_integer_unsigned_create_init(uint64_t val)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return bt_value_integer_create_init(BT_VALUE_TYPE_UNSIGNED_INTEGER,
                val);
 }
 
 struct bt_value *bt_value_integer_unsigned_create(void)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return bt_value_integer_unsigned_create_init(0);
 }
 
 struct bt_value *bt_value_integer_signed_create_init(int64_t val)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return bt_value_integer_create_init(BT_VALUE_TYPE_SIGNED_INTEGER,
                (uint64_t) val);
 }
 
 struct bt_value *bt_value_integer_signed_create(void)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return bt_value_integer_signed_create_init(0);
 }
 
@@ -671,6 +683,8 @@ struct bt_value *bt_value_real_create_init(double val)
 {
        struct bt_value_real *real_obj;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        BT_LOGD("Creating real number value object: val=%f", val);
        real_obj = g_new0(struct bt_value_real, 1);
        if (!real_obj) {
@@ -690,6 +704,8 @@ end:
 
 struct bt_value *bt_value_real_create(void)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return bt_value_real_create_init(0.);
 }
 
@@ -697,7 +713,9 @@ struct bt_value *bt_value_string_create_init(const char *val)
 {
        struct bt_value_string *string_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(val, "Value");
+
        BT_LOGD("Creating string value object: val-len=%zu", strlen(val));
        string_obj = g_new0(struct bt_value_string, 1);
        if (!string_obj) {
@@ -725,6 +743,8 @@ end:
 
 struct bt_value *bt_value_string_create(void)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return bt_value_string_create_init("");
 }
 
@@ -732,6 +752,8 @@ struct bt_value *bt_value_array_create(void)
 {
        struct bt_value_array *array_obj;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        BT_LOGD_STR("Creating empty array value object.");
        array_obj = g_new0(struct bt_value_array, 1);
        if (!array_obj) {
@@ -761,6 +783,8 @@ struct bt_value *bt_value_map_create(void)
 {
        struct bt_value_map *map_obj;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        BT_LOGD_STR("Creating empty map value object.");
        map_obj = g_new0(struct bt_value_map, 1);
        if (!map_obj) {
@@ -872,6 +896,7 @@ const char *bt_value_string_get(const struct bt_value *string_obj)
 enum bt_value_string_set_status bt_value_string_set(
                struct bt_value *string_obj, const char *val)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        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_VALUE_HOT(string_obj, "Value object");
@@ -915,6 +940,7 @@ enum bt_value_array_append_element_status bt_value_array_append_element(
        struct bt_value_array *typed_array_obj =
                BT_VALUE_TO_ARRAY(array_obj);
 
+       BT_ASSERT_PRE_NO_ERROR();
        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);
@@ -933,6 +959,8 @@ bt_value_array_append_bool_element(struct bt_value *array_obj, bt_bool val)
        enum bt_value_array_append_element_status ret;
        struct bt_value *bool_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        bool_obj = bt_value_bool_create_init(val);
        ret = bt_value_array_append_element(array_obj,
                (void *) bool_obj);
@@ -947,6 +975,8 @@ bt_value_array_append_unsigned_integer_element(struct bt_value *array_obj,
        enum bt_value_array_append_element_status ret;
        struct bt_value *integer_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        integer_obj = bt_value_integer_unsigned_create_init(val);
        ret = bt_value_array_append_element(array_obj,
                (void *) integer_obj);
@@ -961,6 +991,8 @@ bt_value_array_append_signed_integer_element(struct bt_value *array_obj,
        enum bt_value_array_append_element_status ret;
        struct bt_value *integer_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        integer_obj = bt_value_integer_signed_create_init(val);
        ret = bt_value_array_append_element(array_obj,
                (void *) integer_obj);
@@ -974,6 +1006,8 @@ bt_value_array_append_real_element(struct bt_value *array_obj, double val)
        enum bt_value_array_append_element_status ret;
        struct bt_value *real_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        real_obj = bt_value_real_create_init(val);
        ret = bt_value_array_append_element(array_obj,
                (void *) real_obj);
@@ -988,6 +1022,8 @@ bt_value_array_append_string_element(struct bt_value *array_obj,
        enum bt_value_array_append_element_status ret;
        struct bt_value *string_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        string_obj = bt_value_string_create_init(val);
        ret = bt_value_array_append_element(array_obj,
                (void *) string_obj);
@@ -1002,6 +1038,8 @@ bt_value_array_append_empty_array_element(struct bt_value *array_obj,
        enum bt_value_array_append_element_status ret;
        struct bt_value *empty_array_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        empty_array_obj = bt_value_array_create();
        ret = bt_value_array_append_element(array_obj,
                (void *) empty_array_obj);
@@ -1021,6 +1059,8 @@ bt_value_array_append_empty_map_element(struct bt_value *array_obj,
        enum bt_value_array_append_element_status ret;
        struct bt_value *map_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        map_obj = bt_value_map_create();
        ret = bt_value_array_append_element(array_obj,
                (void *) map_obj);
@@ -1040,6 +1080,7 @@ bt_value_array_set_element_by_index(struct bt_value *array_obj, uint64_t index,
        struct bt_value_array *typed_array_obj =
                BT_VALUE_TO_ARRAY(array_obj);
 
+       BT_ASSERT_PRE_NO_ERROR();
        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);
@@ -1090,6 +1131,7 @@ enum bt_value_map_insert_entry_status bt_value_map_insert_entry(
                struct bt_value *map_obj, const char *key,
                struct bt_value *element_obj)
 {
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(map_obj, "Map value object");
        BT_ASSERT_PRE_NON_NULL(key, "Key");
        BT_ASSERT_PRE_NON_NULL(element_obj, "Element value object");
@@ -1110,6 +1152,8 @@ enum bt_value_map_insert_entry_status bt_value_map_insert_bool_entry(
        enum bt_value_map_insert_entry_status ret;
        struct bt_value *bool_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        bool_obj = bt_value_bool_create_init(val);
        ret = bt_value_map_insert_entry(map_obj, key,
                (void *) bool_obj);
@@ -1124,6 +1168,8 @@ bt_value_map_insert_unsigned_integer_entry(struct bt_value *map_obj,
        enum bt_value_map_insert_entry_status ret;
        struct bt_value *integer_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        integer_obj = bt_value_integer_unsigned_create_init(val);
        ret = bt_value_map_insert_entry(map_obj, key,
                (void *) integer_obj);
@@ -1138,6 +1184,8 @@ bt_value_map_insert_signed_integer_entry(struct bt_value *map_obj,
        enum bt_value_map_insert_entry_status ret;
        struct bt_value *integer_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        integer_obj = bt_value_integer_signed_create_init(val);
        ret = bt_value_map_insert_entry(map_obj, key,
                (void *) integer_obj);
@@ -1151,6 +1199,8 @@ enum bt_value_map_insert_entry_status bt_value_map_insert_real_entry(
        enum bt_value_map_insert_entry_status ret;
        struct bt_value *real_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        real_obj = bt_value_real_create_init(val);
        ret = bt_value_map_insert_entry(map_obj, key,
                (void *) real_obj);
@@ -1165,6 +1215,8 @@ enum bt_value_map_insert_entry_status bt_value_map_insert_string_entry(
        enum bt_value_map_insert_entry_status ret;
        struct bt_value *string_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        string_obj = bt_value_string_create_init(val);
        ret = bt_value_map_insert_entry(map_obj, key,
                (void *) string_obj);
@@ -1180,6 +1232,8 @@ bt_value_map_insert_empty_array_entry(
        enum bt_value_map_insert_entry_status ret;
        struct bt_value *array_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        array_obj = bt_value_array_create();
        ret = bt_value_map_insert_entry(map_obj, key,
                (void *) array_obj);
@@ -1199,6 +1253,8 @@ bt_value_map_insert_empty_map_entry(struct bt_value *map_obj, const char *key,
        enum bt_value_map_insert_entry_status ret;
        struct bt_value *empty_map_obj = NULL;
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        empty_map_obj = bt_value_map_create();
        ret = bt_value_map_insert_entry(map_obj, key,
                (void *) empty_map_obj);
@@ -1220,6 +1276,8 @@ enum bt_value_map_foreach_entry_status bt_value_map_foreach_entry(
        GHashTableIter iter;
        struct bt_value_map *typed_map_obj = BT_VALUE_TO_MAP(map_obj);
 
+       BT_ASSERT_PRE_NO_ERROR();
+
        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);
@@ -1244,6 +1302,8 @@ enum bt_value_map_foreach_entry_const_status bt_value_map_foreach_entry_const(
                const struct bt_value *map_obj,
                bt_value_map_foreach_entry_const_func func, void *data)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        return (int) bt_value_map_foreach_entry((void *) map_obj,
                (bt_value_map_foreach_entry_func) func, data);
 }
@@ -1305,6 +1365,7 @@ enum bt_value_map_extend_status bt_value_map_extend(
                .status = BT_FUNC_STATUS_OK,
        };
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(base_map_obj, "Base value object");
        BT_ASSERT_PRE_DEV_VALUE_HOT(base_map_obj, "Base value object");
        BT_ASSERT_PRE_NON_NULL(extension_obj, "Extension value object");
@@ -1334,6 +1395,7 @@ enum bt_value_copy_status bt_value_copy(const struct bt_value *object,
 {
        enum bt_value_copy_status status = BT_FUNC_STATUS_OK;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(object, "Value object");
        BT_ASSERT_PRE_NON_NULL(copy_obj, "Value object copy (output)");
        BT_LOGD("Copying value object: addr=%p", object);
This page took 0.05384 seconds and 4 git commands to generate.