From: Michael Jeanson Date: Mon, 20 Mar 2023 19:05:04 +0000 (-0400) Subject: Build fix: brace-enclosed initlializer lists error with g++ 4.8 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5e3b23be3e32286f21523711f6c0fdf5b482a554;p=lttng-tools.git Build fix: brace-enclosed initlializer lists error with g++ 4.8 A build error occurs when building using g++ 4.8 : In file included from session.hpp:18:0, from lttng-sessiond.hpp:21, from utils.cpp:10: ../../../src/common/pthread-lock.hpp: In constructor 'lttng::pthread::details::mutex::mutex(pthread_mutex_t&)': ../../../src/common/pthread-lock.hpp:29:61: error: invalid initialization of non-const reference of type 'pthread_mutex_t&' from an rvalue of type '' explicit mutex(pthread_mutex_t& mutex_p) : _mutex{ mutex_p } Use oldstyle initialization of references instead. Change-Id: I2fd756b48fd8e70e30199c86527c025117bfb6ff Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/trace-class.cpp b/src/bin/lttng-sessiond/trace-class.cpp index be0457dca..e5d4b5405 100644 --- a/src/bin/lttng-sessiond/trace-class.cpp +++ b/src/bin/lttng-sessiond/trace-class.cpp @@ -11,7 +11,7 @@ namespace lst = lttng::sessiond::trace; lttng::sessiond::trace::trace_class::trace_class(const struct abi& in_abi, const lttng_uuid& in_trace_uuid) : - abi{ in_abi }, uuid{ in_trace_uuid } + abi(in_abi), uuid(in_trace_uuid) { } diff --git a/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp b/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp index 6136f5fc7..61a0c26e9 100644 --- a/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp +++ b/src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp @@ -139,7 +139,7 @@ public: variant_tsdl_keyword_sanitizer(tsdl::details::type_overrider& type_overrides, type_lookup_function lookup_type) : - _type_overrides{ type_overrides }, _lookup_type(std::move(lookup_type)) + _type_overrides(type_overrides), _lookup_type(std::move(lookup_type)) { } @@ -368,13 +368,13 @@ public: const tsdl::details::type_overrider& type_overrides, const nonstd::optional& in_default_clock_class_name = nonstd::nullopt) : - _indentation_level{ indentation_level }, - _trace_abi{ abi }, + _indentation_level(indentation_level), + _trace_abi(abi), - _default_clock_class_name{ in_default_clock_class_name ? + _default_clock_class_name(in_default_clock_class_name ? in_default_clock_class_name->c_str() : - nullptr }, - _type_overrides{ type_overrides } + nullptr), + _type_overrides(type_overrides) { } @@ -815,7 +815,7 @@ private: tsdl::trace_class_visitor::trace_class_visitor( const lst::abi& trace_abi, tsdl::append_metadata_fragment_function append_metadata_fragment) : - _trace_abi{ trace_abi }, _append_metadata_fragment(std::move(append_metadata_fragment)) + _trace_abi(trace_abi), _append_metadata_fragment(std::move(append_metadata_fragment)) { } diff --git a/src/common/pthread-lock.hpp b/src/common/pthread-lock.hpp index d77218717..b34b45935 100644 --- a/src/common/pthread-lock.hpp +++ b/src/common/pthread-lock.hpp @@ -26,7 +26,7 @@ namespace details { */ class mutex { public: - explicit mutex(pthread_mutex_t& mutex_p) : _mutex{ mutex_p } + explicit mutex(pthread_mutex_t& mutex_p) : _mutex(mutex_p) { } @@ -80,7 +80,7 @@ private: */ class lock_guard { public: - explicit lock_guard(pthread_mutex_t& mutex) : _mutex{ mutex }, _guard(_mutex) + explicit lock_guard(pthread_mutex_t& mutex) : _mutex(mutex), _guard(_mutex) { }