tap-driver.sh: flush stdout after each test result
[babeltrace.git] / plugins / ctf / common / metadata / visitor-generate-ir.c
index 27345fd287a63ff33d85987d0531f4d96ab7e656..90074233361cc41c832676e41beca7a26e48b7da 100644 (file)
 #include <stdbool.h>
 #include <stdlib.h>
 #include <ctype.h>
-#include <babeltrace/assert-internal.h>
+#include <babeltrace2/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 <babeltrace2/common-internal.h>
+#include <babeltrace2/compat/uuid-internal.h>
+#include <babeltrace2/endian-internal.h>
+#include <babeltrace2/babeltrace.h>
 
 #include "scanner.h"
 #include "parser.h"
@@ -193,6 +193,7 @@ struct ctx_decl_scope {
  * Visitor context (private).
  */
 struct ctx {
+       bt_self_component_source *self_comp;
        /* Trace IR trace class being filled (owned by this) */
        bt_trace_class *trace_class;
 
@@ -590,6 +591,7 @@ struct ctx *ctx_create(bt_self_component_source *self_comp,
                        BT_LOGE_STR("Cannot create empty trace class.");
                        goto error;
                }
+               ctx->self_comp = self_comp;
        }
 
        ctx->ctf_tc = ctf_trace_class_create();
@@ -3202,7 +3204,7 @@ int visit_event_decl_entry(struct ctx *ctx, struct ctf_node *node,
                         * Only read "stream_id" if get_unary_unsigned()
                         * succeeded.
                         */
-                       if (ret || (!ret && *stream_id < 0)) {
+                       if (ret) {
                                _BT_LOGE_NODE(node,
                                        "Unexpected unary expression for event class's `stream_id` attribute.");
                                ret = -EINVAL;
@@ -3484,7 +3486,6 @@ int visit_event_decl(struct ctx *ctx, struct ctf_node *node)
                        stream_class->id = stream_id;
                        g_ptr_array_add(ctx->ctf_tc->stream_classes,
                                stream_class);
-                       stream_class = stream_class;
                        break;
                case 1:
                        /* Single stream class: get its ID */
@@ -5017,6 +5018,13 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor,
                goto end;
        }
 
+       /* Update stream class configuration */
+       ret = ctf_trace_class_update_stream_class_config(ctx->ctf_tc);
+       if (ret) {
+               ret = -EINVAL;
+               goto end;
+       }
+
        /* Update text arrays and sequences */
        ret = ctf_trace_class_update_text_array_sequence(ctx->ctf_tc);
        if (ret) {
@@ -5060,9 +5068,17 @@ int ctf_visitor_generate_ir_visit_node(struct ctf_visitor_generate_ir *visitor,
                goto end;
        }
 
+       /*
+        * If there are fields which are not related to the CTF format
+        * itself in the packet header and in event header field
+        * classes, warn about it because they are never translated.
+        */
+       ctf_trace_class_warn_meaningless_header_fields(ctx->ctf_tc);
+
        if (ctx->trace_class) {
                /* Copy new CTF metadata -> new IR metadata */
-               ret = ctf_trace_class_translate(ctx->trace_class, ctx->ctf_tc);
+               ret = ctf_trace_class_translate(ctx->self_comp,
+                               ctx->trace_class, ctx->ctf_tc);
                if (ret) {
                        ret = -EINVAL;
                        goto end;
This page took 0.028563 seconds and 4 git commands to generate.