GCC 8.3.0 emits the following warning:
translate-trace-ir-to-ctf-ir.c:935:16: warning: ‘var_fc’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
named_fc =
fs_sink_ctf_field_class_variant_borrow_option_by_index(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var_fc, i);
I don't think this "condition" is reachable, but it is, in principle
possible. Initializing var_fc to NULL silences this warning.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I1fd8951778e8b3705974324e1cd5d87892c2e418
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1251
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
uint64_t i;
uint64_t len;
struct fs_sink_ctf_field_class_struct *struct_fc;
- struct fs_sink_ctf_field_class_variant *var_fc;
+ struct fs_sink_ctf_field_class_variant *var_fc = NULL;
struct fs_sink_ctf_named_field_class *named_fc;
if (fc_type == FS_SINK_CTF_FIELD_CLASS_TYPE_STRUCT) {