From: Michael Jeanson Date: Thu, 18 Nov 2021 22:43:55 +0000 (-0500) Subject: Fix: g++ 4.8 doesn't support non-trivial designated initializers X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7586404633a22e219a7ffd7a0f2624b5bc56e37b;p=lttng-tools.git Fix: g++ 4.8 doesn't support non-trivial designated initializers GCC 4.8 doesn't support initializing a compound literal or an anonymous structure with only empty brackets '{}'. Add members until it stops complaining. Change-Id: I22f05d3f8791e34da2618b0cae282da994c670f3 Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/stream.cpp b/src/bin/lttng-relayd/stream.cpp index 346936d84..b57c061c5 100644 --- a/src/bin/lttng-relayd/stream.cpp +++ b/src/bin/lttng-relayd/stream.cpp @@ -71,7 +71,7 @@ static void stream_complete_rotation(struct relay_stream *stream) } lttng_trace_chunk_put(stream->trace_chunk); stream->trace_chunk = stream->ongoing_rotation.value.next_trace_chunk; - stream->ongoing_rotation = (typeof(stream->ongoing_rotation)) {}; + stream->ongoing_rotation = LTTNG_OPTIONAL_INIT_UNSET; stream->completed_rotation_count++; } diff --git a/src/common/payload-view.cpp b/src/common/payload-view.cpp index b1a44368d..3ea043c8a 100644 --- a/src/common/payload-view.cpp +++ b/src/common/payload-view.cpp @@ -24,7 +24,10 @@ struct lttng_payload_view lttng_payload_view_from_payload( .buffer = lttng_buffer_view_from_dynamic_buffer( &payload->buffer, offset, len), ._fd_handles = payload->_fd_handles, - } : (struct lttng_payload_view) {}; + } : (struct lttng_payload_view) { + .buffer = {}, + ._fd_handles = {} + }; } struct lttng_payload_view lttng_payload_view_from_view( @@ -39,7 +42,10 @@ struct lttng_payload_view lttng_payload_view_from_view( .p_fd_handles_position = view->_iterator.p_fd_handles_position ?: &view->_iterator.fd_handles_position, } - } : (struct lttng_payload_view) {}; + } : (struct lttng_payload_view) { + .buffer = {}, + ._fd_handles = {} + }; } struct lttng_payload_view lttng_payload_view_from_dynamic_buffer( @@ -48,8 +54,12 @@ struct lttng_payload_view lttng_payload_view_from_dynamic_buffer( { return buffer ? (struct lttng_payload_view) { .buffer = lttng_buffer_view_from_dynamic_buffer( - buffer, offset, len) - } : (struct lttng_payload_view) {}; + buffer, offset, len), + ._fd_handles = {} + } : (struct lttng_payload_view) { + .buffer = {}, + ._fd_handles = {} + }; } struct lttng_payload_view lttng_payload_view_from_buffer_view( @@ -58,8 +68,12 @@ struct lttng_payload_view lttng_payload_view_from_buffer_view( { return view ? (struct lttng_payload_view) { .buffer = lttng_buffer_view_from_view( - view, offset, len) - } : (struct lttng_payload_view) {}; + view, offset, len), + ._fd_handles = {} + } : (struct lttng_payload_view) { + .buffer = {}, + ._fd_handles = {} + }; } struct lttng_payload_view lttng_payload_view_init_from_buffer( @@ -67,7 +81,8 @@ struct lttng_payload_view lttng_payload_view_init_from_buffer( { return (struct lttng_payload_view) { .buffer = lttng_buffer_view_init( - src, offset, len) + src, offset, len), + ._fd_handles = {} }; }