lib: remove clock class priority map, use default clock value
[babeltrace.git] / plugins / ctf / common / metadata / visitor-generate-ir.c
index f5fab1520f1c062e9b737cf4936d590924bb4e77..743b61b1a58f788f8ebb5867a61ed3cc900b3fd5 100644 (file)
 #include <stdbool.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include <assert.h>
+#include <babeltrace/assert-internal.h>
 #include <glib.h>
 #include <inttypes.h>
 #include <errno.h>
+#include <babeltrace/common-internal.h>
 #include <babeltrace/compat/uuid-internal.h>
 #include <babeltrace/endian-internal.h>
 #include <babeltrace/babeltrace.h>
-#include <babeltrace/ctf-ir/field-types-internal.h>
 
 #include "scanner.h"
 #include "parser.h"
@@ -278,7 +278,7 @@ GQuark get_prefixed_named_quark(char prefix, const char *name)
 {
        GQuark qname = 0;
 
-       assert(name);
+       BT_ASSERT(name);
 
        /* Prefix character + original string + '\0' */
        char *prname = g_new(char, strlen(name) + 2);
@@ -314,8 +314,8 @@ struct bt_field_type *ctx_decl_scope_lookup_prefix_alias(
        _BT_FIELD_TYPE_INIT(decl);
        struct ctx_decl_scope *cur_scope = scope;
 
-       assert(scope);
-       assert(name);
+       BT_ASSERT(scope);
+       BT_ASSERT(name);
        qname = get_prefixed_named_quark(prefix, name);
        if (!qname) {
                goto error;
@@ -425,9 +425,9 @@ int ctx_decl_scope_register_prefix_alias(struct ctx_decl_scope *scope,
        GQuark qname = 0;
        _BT_FIELD_TYPE_INIT(edecl);
 
-       assert(scope);
-       assert(name);
-       assert(decl);
+       BT_ASSERT(scope);
+       BT_ASSERT(name);
+       BT_ASSERT(decl);
        qname = get_prefixed_named_quark(prefix, name);
        if (!qname) {
                ret = -ENOMEM;
@@ -571,7 +571,7 @@ struct ctx *ctx_create(struct bt_trace *trace,
        struct ctx *ctx = NULL;
        struct ctx_decl_scope *scope = NULL;
 
-       assert(decoder_config);
+       BT_ASSERT(decoder_config);
 
        ctx = g_new0(struct ctx, 1);
        if (!ctx) {
@@ -627,7 +627,7 @@ int ctx_push_scope(struct ctx *ctx)
        int ret = 0;
        struct ctx_decl_scope *new_scope;
 
-       assert(ctx);
+       BT_ASSERT(ctx);
        new_scope = ctx_decl_scope_create(ctx->current_scope);
        if (!new_scope) {
                BT_LOGE_STR("Cannot create declaration scope.");
@@ -646,7 +646,7 @@ void ctx_pop_scope(struct ctx *ctx)
 {
        struct ctx_decl_scope *parent_scope = NULL;
 
-       assert(ctx);
+       BT_ASSERT(ctx);
 
        if (!ctx->current_scope) {
                goto end;
@@ -675,7 +675,7 @@ char *remove_underscores_from_field_ref(const char *field_ref)
                UNDERSCORE_REMOVE_STATE_DO_NOT_REMOVE_NEXT_UNDERSCORE,
        } state = UNDERSCORE_REMOVE_STATE_REMOVE_NEXT_UNDERSCORE;
 
-       assert(field_ref);
+       BT_ASSERT(field_ref);
        ret = calloc(strlen(field_ref) + 1, 1);
        if (!ret) {
                BT_LOGE("Failed to allocate a string: size=%zu",
@@ -746,7 +746,7 @@ char *concatenate_unary_strings(struct bt_list_head *head)
        struct ctf_node *node;
 
        str = g_string_new(NULL);
-       assert(str);
+       BT_ASSERT(str);
 
        bt_list_for_each_entry(node, head, siblings) {
                char *src_string;
@@ -876,6 +876,8 @@ int get_unary_unsigned(struct bt_list_head *head, uint64_t *value)
        int ret = 0;
        struct ctf_node *node;
 
+       *value = 0;
+
        if (bt_list_empty(head)) {
                ret = -1;
                goto end;
@@ -1350,19 +1352,19 @@ int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list,
                                ret = bt_field_type_integer_set_base(
                                        nested_decl,
                                        BT_INTEGER_BASE_HEXADECIMAL);
-                               assert(ret == 0);
+                               BT_ASSERT(ret == 0);
                        }
                } else {
                        ret = visit_type_specifier_list(ctx,
                                type_specifier_list, &nested_decl);
                        if (ret) {
-                               assert(!nested_decl);
+                               BT_ASSERT(!nested_decl);
                                goto error;
                        }
                }
        }
 
-       assert(nested_decl);
+       BT_ASSERT(nested_decl);
 
        if (!node_type_declarator) {
                BT_MOVE(*field_decl, nested_decl);
@@ -1471,9 +1473,9 @@ int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list,
                        goto error;
                }
 
-               assert(!nested_decl);
-               assert(decl);
-               assert(!*field_decl);
+               BT_ASSERT(!nested_decl);
+               BT_ASSERT(decl);
+               BT_ASSERT(!*field_decl);
 
                /*
                 * At this point, we found the next nested declaration.
@@ -1489,18 +1491,18 @@ int visit_type_declarator(struct ctx *ctx, struct ctf_node *type_specifier_list,
                        &outer_field_decl, decl);
                decl = NULL;
                if (ret) {
-                       assert(!outer_field_decl);
+                       BT_ASSERT(!outer_field_decl);
                        ret = -EINVAL;
                        goto error;
                }
 
-               assert(outer_field_decl);
+               BT_ASSERT(outer_field_decl);
                BT_MOVE(*field_decl, outer_field_decl);
        }
 
 end:
        BT_PUT(nested_decl);
-       assert(*field_decl);
+       BT_ASSERT(*field_decl);
 
        return 0;
 
@@ -1530,13 +1532,13 @@ int visit_struct_decl_field(struct ctx *ctx,
                ret = visit_type_declarator(ctx, type_specifier_list,
                        &qfield_name, iter, &field_decl, NULL);
                if (ret) {
-                       assert(!field_decl);
+                       BT_ASSERT(!field_decl);
                        _BT_LOGE_NODE(type_specifier_list,
                                "Cannot visit type declarator: ret=%d", ret);
                        goto error;
                }
 
-               assert(field_decl);
+               BT_ASSERT(field_decl);
                field_name = g_quark_to_string(qfield_name);
 
                /* Check if field with same name already exists */
@@ -1592,13 +1594,13 @@ int visit_variant_decl_field(struct ctx *ctx,
                ret = visit_type_declarator(ctx, type_specifier_list,
                        &qfield_name, iter, &field_decl, NULL);
                if (ret) {
-                       assert(!field_decl);
+                       BT_ASSERT(!field_decl);
                        _BT_LOGE_NODE(type_specifier_list,
                                "Cannot visit type declarator: ret=%d", ret);
                        goto error;
                }
 
-               assert(field_decl);
+               BT_ASSERT(field_decl);
                field_name = g_quark_to_string(qfield_name);
 
                /* Check if field with same name already exists */
@@ -1703,7 +1705,7 @@ int visit_typealias(struct ctx *ctx, struct ctf_node *target,
                target->u.typealias_target.type_specifier_list,
                &qdummy_field_name, node, &type_decl, NULL);
        if (ret) {
-               assert(!type_decl);
+               BT_ASSERT(!type_decl);
                _BT_LOGE_NODE(node,
                        "Cannot visit type declarator: ret=%d", ret);
                goto end;
@@ -2101,8 +2103,8 @@ int visit_variant_decl(struct ctx *ctx, const char *name,
                BT_MOVE(*variant_decl, untagged_variant_decl);
        }
 
-       assert(!untagged_variant_decl);
-       assert(*variant_decl);
+       BT_ASSERT(!untagged_variant_decl);
+       BT_ASSERT(*variant_decl);
 
        return 0;
 
@@ -2122,6 +2124,7 @@ int visit_enum_decl_entry(struct ctx *ctx, struct ctf_node *enumerator,
        struct ctf_node *iter;
        int64_t start = 0, end = 0;
        const char *label = enumerator->u.enumerator.id;
+       const char *effective_label = label;
        struct bt_list_head *values = &enumerator->u.enumerator.values;
 
        bt_list_for_each_entry(iter, values, siblings) {
@@ -2181,12 +2184,24 @@ int visit_enum_decl_entry(struct ctx *ctx, struct ctf_node *enumerator,
 
        *last = end + 1;
 
+       if (label[0] == '_') {
+               /*
+                * Strip the first underscore of any enumeration field
+                * type's label in case this enumeration FT is used as
+                * a variant FT tag later. The variant FT choice names
+                * could also start with `_`, in which case the prefix
+                * is removed, and it the resulting choice name needs to
+                * match tag labels.
+                */
+               effective_label = &label[1];
+       }
+
        if (is_signed) {
-               ret = bt_ctf_field_type_enumeration_add_mapping(enum_decl, label,
-                       start, end);
+               ret = bt_field_type_enumeration_signed_add_mapping(enum_decl,
+                       effective_label, start, end);
        } else {
-               ret = bt_field_type_enumeration_add_mapping_unsigned(enum_decl,
-                       label, (uint64_t) start, (uint64_t) end);
+               ret = bt_field_type_enumeration_unsigned_add_mapping(enum_decl,
+                       effective_label, (uint64_t) start, (uint64_t) end);
        }
        if (ret) {
                _BT_LOGE_NODE(enumerator,
@@ -2276,18 +2291,18 @@ int visit_enum_decl(struct ctx *ctx, const char *name,
                        ret = visit_type_declarator(ctx, container_type,
                                &qdummy_id, NULL, &integer_decl, NULL);
                        if (ret) {
-                               assert(!integer_decl);
+                               BT_ASSERT(!integer_decl);
                                ret = -EINVAL;
                                goto error;
                        }
                }
 
-               assert(integer_decl);
+               BT_ASSERT(integer_decl);
 
                if (!bt_field_type_is_integer(integer_decl)) {
                        BT_LOGE("Container field type for enumeration field type is not an integer field type: "
                                "ft-id=%s",
-                               bt_field_type_id_string(
+                               bt_common_field_type_id_string(
                                        bt_field_type_get_type_id(integer_decl)));
                        ret = -EINVAL;
                        goto error;
@@ -3106,7 +3121,7 @@ int visit_type_specifier_list(struct ctx *ctx,
                ret = visit_integer_decl(ctx, &node->u.integer.expressions,
                        decl);
                if (ret) {
-                       assert(!*decl);
+                       BT_ASSERT(!*decl);
                        goto error;
                }
                break;
@@ -3114,7 +3129,7 @@ int visit_type_specifier_list(struct ctx *ctx,
                ret = visit_floating_point_number_decl(ctx,
                        &node->u.floating_point.expressions, decl);
                if (ret) {
-                       assert(!*decl);
+                       BT_ASSERT(!*decl);
                        goto error;
                }
                break;
@@ -3122,7 +3137,7 @@ int visit_type_specifier_list(struct ctx *ctx,
                ret = visit_string_decl(ctx,
                        &node->u.string.expressions, decl);
                if (ret) {
-                       assert(!*decl);
+                       BT_ASSERT(!*decl);
                        goto error;
                }
                break;
@@ -3132,7 +3147,7 @@ int visit_type_specifier_list(struct ctx *ctx,
                        node->u._struct.has_body,
                        &node->u._struct.min_align, decl);
                if (ret) {
-                       assert(!*decl);
+                       BT_ASSERT(!*decl);
                        goto error;
                }
                break;
@@ -3142,7 +3157,7 @@ int visit_type_specifier_list(struct ctx *ctx,
                        &node->u.variant.declaration_list,
                        node->u.variant.has_body, decl);
                if (ret) {
-                       assert(!*decl);
+                       BT_ASSERT(!*decl);
                        goto error;
                }
                break;
@@ -3152,7 +3167,7 @@ int visit_type_specifier_list(struct ctx *ctx,
                        &node->u._enum.enumerator_list,
                        node->u._enum.has_body, decl);
                if (ret) {
-                       assert(!*decl);
+                       BT_ASSERT(!*decl);
                        goto error;
                }
                break;
@@ -3175,7 +3190,7 @@ int visit_type_specifier_list(struct ctx *ctx,
                        _BT_LOGE_NODE(first,
                                "Cannot visit type specifier: ret=%d",
                                ret);
-                       assert(!*decl);
+                       BT_ASSERT(!*decl);
                        goto error;
                }
                break;
@@ -3187,7 +3202,7 @@ int visit_type_specifier_list(struct ctx *ctx,
                goto error;
        }
 
-       assert(*decl);
+       BT_ASSERT(*decl);
 
        return 0;
 
@@ -3245,7 +3260,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
 
                        _SET(set, _EVENT_NAME_SET);
                } else if (!strcmp(left, "id")) {
-                       int64_t id;
+                       int64_t id = -1;
 
                        if (_IS_SET(set, _EVENT_ID_SET)) {
                                _BT_LOGE_DUP_ATTR(node, "id",
@@ -3314,8 +3329,8 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
                                goto error;
                        }
 
-                       assert(decl);
-                       ret = bt_event_class_set_context_type(
+                       BT_ASSERT(decl);
+                       ret = bt_event_class_set_context_field_type(
                                event_class, decl);
                        BT_PUT(decl);
                        if (ret) {
@@ -3344,8 +3359,8 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
                                goto error;
                        }
 
-                       assert(decl);
-                       ret = bt_event_class_set_payload_type(
+                       BT_ASSERT(decl);
+                       ret = bt_event_class_set_payload_field_type(
                                event_class, decl);
                        BT_PUT(decl);
                        if (ret) {
@@ -3552,7 +3567,7 @@ int reset_event_decl_types(struct ctx *ctx,
        int ret = 0;
 
        /* Context type. */
-       ret = bt_event_class_set_context_type(event_class, NULL);
+       ret = bt_event_class_set_context_field_type(event_class, NULL);
        if (ret) {
                BT_LOGE("Cannot reset initial event class's context field type: "
                        "event-name=\"%s\"",
@@ -3561,7 +3576,7 @@ int reset_event_decl_types(struct ctx *ctx,
        }
 
        /* Event payload. */
-       ret = bt_event_class_set_payload_type(event_class, NULL);
+       ret = bt_event_class_set_payload_field_type(event_class, NULL);
        if (ret) {
                BT_LOGE("Cannot reset initial event class's payload field type: "
                        "event-name=\"%s\"",
@@ -3579,21 +3594,21 @@ int reset_stream_decl_types(struct ctx *ctx,
        int ret = 0;
 
        /* Packet context. */
-       ret = bt_stream_class_set_packet_context_type(stream_class, NULL);
+       ret = bt_stream_class_set_packet_context_field_type(stream_class, NULL);
        if (ret) {
                BT_LOGE_STR("Cannot reset initial stream class's packet context field type.");
                goto end;
        }
 
        /* Event header. */
-       ret = bt_stream_class_set_event_header_type(stream_class, NULL);
+       ret = bt_stream_class_set_event_header_field_type(stream_class, NULL);
        if (ret) {
                BT_LOGE_STR("Cannot reset initial stream class's event header field type.");
                goto end;
        }
 
        /* Event context. */
-       ret = bt_stream_class_set_event_context_type(stream_class, NULL);
+       ret = bt_stream_class_set_event_context_field_type(stream_class, NULL);
        if (ret) {
                BT_LOGE_STR("Cannot reset initial stream class's event context field type.");
                goto end;
@@ -3608,7 +3623,7 @@ struct bt_stream_class *create_reset_stream_class(struct ctx *ctx)
        int ret;
        struct bt_stream_class *stream_class;
 
-       stream_class = bt_stream_class_create_empty(NULL);
+       stream_class = bt_stream_class_create(NULL);
        if (!stream_class) {
                BT_LOGE_STR("Cannot create empty stream class.");
                goto error;
@@ -3746,12 +3761,12 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node)
                                stream_id = *((int64_t *) keys->data);
                                g_list_free(keys);
                        } else {
-                               assert(bt_trace_get_stream_class_count(
+                               BT_ASSERT(bt_trace_get_stream_class_count(
                                        ctx->trace) == 1);
                                stream_class =
                                        bt_trace_get_stream_class_by_index(
                                                ctx->trace, 0);
-                               assert(stream_class);
+                               BT_ASSERT(stream_class);
                                stream_id = bt_stream_class_get_id(
                                        stream_class);
                                BT_PUT(stream_class);
@@ -3765,7 +3780,7 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node)
                }
        }
 
-       assert(stream_id >= 0);
+       BT_ASSERT(stream_id >= 0);
 
        /* We have the stream ID now; get the stream class if found */
        stream_class = g_hash_table_lookup(ctx->stream_classes, &stream_id);
@@ -3782,7 +3797,7 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node)
                }
        }
 
-       assert(stream_class);
+       BT_ASSERT(stream_class);
 
        if (!_IS_SET(&set, _EVENT_ID_SET)) {
                /* Allow only one event without ID per stream */
@@ -3865,7 +3880,7 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx,
        }
 
        clock_class_count = bt_trace_get_clock_class_count(ctx->trace);
-       assert(clock_class_count >= 0);
+       BT_ASSERT(clock_class_count >= 0);
 
        switch (clock_class_count) {
        case 0:
@@ -3896,7 +3911,7 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx,
                 */
                clock_class_to_map_to =
                        bt_trace_get_clock_class_by_index(ctx->trace, 0);
-               assert(clock_class_to_map_to);
+               BT_ASSERT(clock_class_to_map_to);
                break;
        default:
                /*
@@ -3910,7 +3925,7 @@ int auto_map_field_to_trace_clock_class(struct ctx *ctx,
                goto end;
        }
 
-       assert(clock_class_to_map_to);
+       BT_ASSERT(clock_class_to_map_to);
        ret = bt_field_type_integer_set_mapped_clock_class(ft,
                clock_class_to_map_to);
        if (ret) {
@@ -3949,7 +3964,7 @@ int auto_map_fields_to_trace_clock_class(struct ctx *ctx,
                count = bt_field_type_variant_get_field_count(root_ft);
        }
 
-       assert(count >= 0);
+       BT_ASSERT(count >= 0);
 
        for (i = 0; i < count; i++) {
                _BT_FIELD_TYPE_INIT(ft);
@@ -3963,7 +3978,7 @@ int auto_map_fields_to_trace_clock_class(struct ctx *ctx,
                                root_ft, &name, &ft, i);
                }
 
-               assert(ret == 0);
+               BT_ASSERT(ret == 0);
 
                if (strcmp(name, field_name) == 0) {
                        ret = auto_map_field_to_trace_clock_class(ctx, ft);
@@ -4083,7 +4098,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node,
                                goto error;
                        }
 
-                       assert(decl);
+                       BT_ASSERT(decl);
                        ret = auto_map_fields_to_trace_clock_class(ctx,
                                decl, "timestamp");
                        if (ret) {
@@ -4092,7 +4107,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node,
                                goto error;
                        }
 
-                       ret = bt_stream_class_set_event_header_type(
+                       ret = bt_stream_class_set_event_header_field_type(
                                stream_class, decl);
                        BT_PUT(decl);
                        if (ret) {
@@ -4121,9 +4136,9 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node,
                                goto error;
                        }
 
-                       assert(decl);
+                       BT_ASSERT(decl);
 
-                       ret = bt_stream_class_set_event_context_type(
+                       ret = bt_stream_class_set_event_context_field_type(
                                stream_class, decl);
                        BT_PUT(decl);
                        if (ret) {
@@ -4152,7 +4167,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node,
                                goto error;
                        }
 
-                       assert(decl);
+                       BT_ASSERT(decl);
                        ret = auto_map_fields_to_trace_clock_class(ctx,
                                decl, "timestamp_begin");
                        if (ret) {
@@ -4169,7 +4184,7 @@ int visit_stream_decl_entry(struct ctx *ctx, struct ctf_node *node,
                                goto error;
                        }
 
-                       ret = bt_stream_class_set_packet_context_type(
+                       ret = bt_stream_class_set_packet_context_field_type(
                                stream_class, decl);
                        BT_PUT(decl);
                        if (ret) {
@@ -4253,7 +4268,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node)
                _BT_FIELD_TYPE_INIT(packet_header_decl);
 
                packet_header_decl =
-                       bt_trace_get_packet_header_type(ctx->trace);
+                       bt_trace_get_packet_header_field_type(ctx->trace);
                if (!packet_header_decl) {
                        _BT_LOGE_NODE(node,
                                "Stream class has a `id` attribute, "
@@ -4292,7 +4307,7 @@ int visit_stream_decl(struct ctx *ctx, struct ctf_node *node)
 
                /* Automatic ID: 0 */
                ret = bt_stream_class_set_id(stream_class, 0);
-               assert(ret == 0);
+               BT_ASSERT(ret == 0);
        }
 
        id = bt_stream_class_get_id(stream_class);
@@ -4460,8 +4475,8 @@ int visit_trace_decl_entry(struct ctx *ctx, struct ctf_node *node, int *set)
                                goto error;
                        }
 
-                       assert(packet_header_decl);
-                       ret = bt_trace_set_packet_header_type(ctx->trace,
+                       BT_ASSERT(packet_header_decl);
+                       ret = bt_trace_set_packet_header_field_type(ctx->trace,
                                packet_header_decl);
                        BT_PUT(packet_header_decl);
                        if (ret) {
@@ -4860,7 +4875,7 @@ int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node,
                g_free(right);
                _SET(set, _CLOCK_DESCRIPTION_SET);
        } else if (!strcmp(left, "freq")) {
-               uint64_t freq;
+               uint64_t freq = -1ULL;
 
                if (_IS_SET(set, _CLOCK_FREQ_SET)) {
                        _BT_LOGE_DUP_ATTR(entry_node, "freq", "clock class");
@@ -5109,7 +5124,7 @@ int visit_clock_decl(struct ctx *ctx, struct ctf_node *clock_node)
        }
 
        clock_class_name = bt_clock_class_get_name(clock);
-       assert(clock_class_name);
+       BT_ASSERT(clock_class_name);
        if (ctx->is_lttng && strcmp(clock_class_name, "monotonic") == 0) {
                /*
                 * Old versions of LTTng forgot to set its clock class
@@ -5189,7 +5204,7 @@ int visit_root_decl(struct ctx *ctx, struct ctf_node *root_decl_node)
                        _BT_LOGE_NODE(root_decl_node,
                                "Cannot visit root scope's field type: "
                                "ret=%d", ret);
-                       assert(!decl);
+                       BT_ASSERT(!decl);
                        goto end;
                }
 
@@ -5215,7 +5230,7 @@ int set_trace_name(struct ctx *ctx)
        int ret = 0;
        struct bt_value *value = NULL;
 
-       assert(bt_trace_get_stream_class_count(ctx->trace) == 0);
+       BT_ASSERT(bt_trace_get_stream_class_count(ctx->trace) == 0);
        name = g_string_new(NULL);
        if (!name) {
                BT_LOGE_STR("Failed to allocate a GString.");
@@ -5229,11 +5244,11 @@ int set_trace_name(struct ctx *ctx)
         */
        value = bt_trace_get_environment_field_value_by_name(ctx->trace,
                "hostname");
-       if (bt_value_is_string(value)) {
+       if (value && bt_value_is_string(value)) {
                const char *hostname;
 
                ret = bt_value_string_get(value, &hostname);
-               assert(ret == 0);
+               BT_ASSERT(ret == 0);
                g_string_append(name, hostname);
 
                if (ctx->trace_name_suffix) {
@@ -5323,7 +5338,7 @@ struct ctf_visitor_generate_ir *ctf_visitor_generate_ir_create(
        }
 
        /* Set packet header to NULL to override the default one */
-       ret = bt_trace_set_packet_header_type(trace, NULL);
+       ret = bt_trace_set_packet_header_field_type(trace, NULL);
        if (ret) {
                BT_LOGE_STR("Cannot reset initial trace's packet header field type.");
                goto error;
@@ -5360,8 +5375,8 @@ struct bt_trace *ctf_visitor_generate_ir_get_trace(
 {
        struct ctx *ctx = (void *) visitor;
 
-       assert(ctx);
-       assert(ctx->trace);
+       BT_ASSERT(ctx);
+       BT_ASSERT(ctx->trace);
        return bt_get(ctx->trace);
 }
 
@@ -5414,9 +5429,9 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor,
                        }
                }
 
-               assert(ctx->trace_bo == BT_BYTE_ORDER_LITTLE_ENDIAN ||
+               BT_ASSERT(ctx->trace_bo == BT_BYTE_ORDER_LITTLE_ENDIAN ||
                        ctx->trace_bo == BT_BYTE_ORDER_BIG_ENDIAN);
-               assert(ctx->current_scope &&
+               BT_ASSERT(ctx->current_scope &&
                        ctx->current_scope->parent_scope == NULL);
 
                /* Environment */
@@ -5430,7 +5445,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor,
                        }
                }
 
-               assert(ctx->current_scope &&
+               BT_ASSERT(ctx->current_scope &&
                        ctx->current_scope->parent_scope == NULL);
 
                /*
@@ -5446,7 +5461,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor,
                        }
                }
 
-               assert(ctx->current_scope &&
+               BT_ASSERT(ctx->current_scope &&
                        ctx->current_scope->parent_scope == NULL);
 
                /*
@@ -5464,7 +5479,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor,
                        }
                }
 
-               assert(ctx->current_scope &&
+               BT_ASSERT(ctx->current_scope &&
                        ctx->current_scope->parent_scope == NULL);
 
                /* Callsite blocks are not supported */
@@ -5473,7 +5488,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor,
                                "\"callsite\" blocks are not supported as of this version.");
                }
 
-               assert(ctx->current_scope &&
+               BT_ASSERT(ctx->current_scope &&
                        ctx->current_scope->parent_scope == NULL);
 
                /* Trace */
@@ -5487,7 +5502,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor,
                        }
                }
 
-               assert(ctx->current_scope &&
+               BT_ASSERT(ctx->current_scope &&
                        ctx->current_scope->parent_scope == NULL);
 
                /* Streams */
@@ -5501,7 +5516,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor,
                        }
                }
 
-               assert(ctx->current_scope &&
+               BT_ASSERT(ctx->current_scope &&
                        ctx->current_scope->parent_scope == NULL);
 
                /* Events */
@@ -5515,7 +5530,7 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor,
                        }
                }
 
-               assert(ctx->current_scope &&
+               BT_ASSERT(ctx->current_scope &&
                        ctx->current_scope->parent_scope == NULL);
                break;
        }
This page took 0.039925 seconds and 4 git commands to generate.