From 635126419d99d2cdb69ea74f5d96449b2cc8ef52 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Tue, 30 Apr 2019 11:15:27 -0400 Subject: [PATCH] Fix: maybe-uninitialized warning in bt_ctf_stream_flush() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit GCC warning: In file included from ../../include/babeltrace/ctf-writer/fields-internal.h:41:0, from ../../include/babeltrace/ctf-writer/field-wrapper-internal.h:26, from ../../include/babeltrace/ctf-writer/event-internal.h:37, from stream.c:32: stream.c: In function ‘bt_ctf_stream_flush’: ../../include/babeltrace/ctfser-internal.h:568:36: error: ‘packet_context_offset_bits’ may be used uninitialized in this function [-Werror=maybe-uninitialized] ctfser->offset_in_cur_packet_bits = offset_bits; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ stream.c:1608:11: note: ‘packet_context_offset_bits’ was declared here uint64_t packet_context_offset_bits; Signed-off-by: Francis Deslauriers Change-Id: Ia7457b1a444290ba1a71459bfaf707812227899c Reviewed-on: https://review.lttng.org/c/babeltrace/+/1029 Reviewed-by: Philippe Proulx --- lib/ctf-writer/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ctf-writer/stream.c b/lib/ctf-writer/stream.c index 3546facd..8912b011 100644 --- a/lib/ctf-writer/stream.c +++ b/lib/ctf-writer/stream.c @@ -1605,7 +1605,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) { int ret = 0; size_t i; - uint64_t packet_context_offset_bits; + uint64_t packet_context_offset_bits = 0; struct bt_ctf_trace *trace; enum bt_ctf_byte_order native_byte_order; bool has_packet_size = false; -- 2.34.1