From 4af85094dcfc7edd45e2c31cd0c01371f32be2ef Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 18 Jul 2019 00:17:21 -0400 Subject: [PATCH] Fix various "may be used uninitialized" warnings (GCC) Signed-off-by: Philippe Proulx Change-Id: I22634b22121dd32ddfdf1309e10e4f413263572d Reviewed-on: https://review.lttng.org/c/babeltrace/+/1720 Tested-by: jenkins --- src/ctf-writer/stream-class.c | 2 +- src/ctf-writer/trace.c | 2 +- src/lib/graph/iterator.c | 2 +- src/plugins/utils/trimmer/trimmer.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ctf-writer/stream-class.c b/src/ctf-writer/stream-class.c index ffec6655..ac3db47a 100644 --- a/src/ctf-writer/stream-class.c +++ b/src/ctf-writer/stream-class.c @@ -613,7 +613,7 @@ int init_packet_context(struct bt_ctf_stream_class *stream_class) bt_ctf_field_type_structure_create(); struct bt_ctf_field_type *_uint64_t = get_field_type(FIELD_TYPE_ALIAS_UINT64_T); - struct bt_ctf_field_type *ts_begin_end_uint64_t; + struct bt_ctf_field_type *ts_begin_end_uint64_t = NULL; if (!packet_context_type) { BT_LOGE_STR("Cannot create empty structure field type."); diff --git a/src/ctf-writer/trace.c b/src/ctf-writer/trace.c index 56a9a55f..e9a96247 100644 --- a/src/ctf-writer/trace.c +++ b/src/ctf-writer/trace.c @@ -899,7 +899,7 @@ int bt_ctf_trace_common_add_stream_class(struct bt_ctf_trace_common *trace, struct bt_ctf_field_type_common *packet_context_type = NULL; struct bt_ctf_field_type_common *event_header_type = NULL; struct bt_ctf_field_type_common *stream_event_ctx_type = NULL; - int64_t event_class_count; + int64_t event_class_count = 0; struct bt_ctf_trace_common *current_parent_trace = NULL; struct bt_ctf_clock_class *expected_clock_class = bt_ctf_object_get_ref(init_expected_clock_class); diff --git a/src/lib/graph/iterator.c b/src/lib/graph/iterator.c index 3ae59208..a8fe3f15 100644 --- a/src/lib/graph/iterator.c +++ b/src/lib/graph/iterator.c @@ -1450,7 +1450,7 @@ int auto_seek_handle_message( * as we don't know if items were really * discarded within the new time range. */ - uint64_t new_begin_raw_value; + uint64_t new_begin_raw_value = 0; ret = bt_clock_class_clock_value_from_ns_from_origin( msg_disc_items->default_end_cs->clock_class, diff --git a/src/plugins/utils/trimmer/trimmer.c b/src/plugins/utils/trimmer/trimmer.c index 79ceed0a..a6889adf 100644 --- a/src/plugins/utils/trimmer/trimmer.c +++ b/src/plugins/utils/trimmer/trimmer.c @@ -1598,7 +1598,7 @@ bt_component_class_message_iterator_next_method_status handle_message( bt_component_class_message_iterator_next_method_status status; const bt_stream *stream = NULL; int64_t ns_from_origin = INT64_MIN; - bool has_ns_from_origin; + bool has_ns_from_origin = false; int ret; /* Find message's associated stream */ -- 2.34.1