ctf: silence bogus warnings in create_relative_field_ref()
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 11 Sep 2019 14:54:48 +0000 (10:54 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 Sep 2019 19:26:07 +0000 (15:26 -0400)
gcc 9.1.0 warns that struct_fc and var_fc may be used uninitialized.
The code flow doesn't allow this to happen, but this warning is
annoying/scary and easily fixed by initializing both variables to
NULL.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I554affb70275f60eff08134f80b33bc4cefbc91f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2027
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/ctf/fs-sink/translate-trace-ir-to-ctf-ir.c

index 535325d1e8c84b5821b2798022ac812bc4b0571f..5e5a2c5426f5eecf6711c94d105848d6db0c01af 100644 (file)
@@ -370,8 +370,8 @@ int create_relative_field_ref(struct ctx *ctx,
        /* Find target field class having this name in current context */
        for (si = ctx->cur_path->len - 1; si >= 0; si--) {
                struct fs_sink_ctf_field_class *fc;
-               struct fs_sink_ctf_field_class_struct *struct_fc;
-               struct fs_sink_ctf_field_class_variant *var_fc;
+               struct fs_sink_ctf_field_class_struct *struct_fc = NULL;
+               struct fs_sink_ctf_field_class_variant *var_fc = NULL;
                struct fs_sink_ctf_named_field_class *named_fc;
                uint64_t len;
 
This page took 0.025425 seconds and 4 git commands to generate.