Build fix: brace-enclosed initlializer lists error with g++ 4.8
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 20 Mar 2023 19:05:04 +0000 (15:05 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 21 Mar 2023 21:50:42 +0000 (17:50 -0400)
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 '<brace-enclosed initializer list>'
   explicit mutex(pthread_mutex_t& mutex_p) : _mutex{ mutex_p }

Use oldstyle initialization of references instead.

Change-Id: I2fd756b48fd8e70e30199c86527c025117bfb6ff
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/trace-class.cpp
src/bin/lttng-sessiond/tsdl-trace-class-visitor.cpp
src/common/pthread-lock.hpp

index be0457dca60f2753340e279793867f14a7229e9f..e5d4b54054b53b6a91e31c43308c0b2196ce494b 100644 (file)
@@ -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)
 {
 }
 
index 6136f5fc71b77796d4a88307ae13b3e4646debc6..61a0c26e9cfdad939580ae1a7cd113528bb6e218 100644 (file)
@@ -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<std::string>& in_default_clock_class_name =
                                   nonstd::nullopt) :
-               _indentation_level{ indentation_level },
-               _trace_abi{ abi },
+               _indentation_level(indentation_level),
+               _trace_abi(abi),
 
-               _default_clock_class_namein_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))
 {
 }
 
index d772187172f2987409190a3f3f1b8b3f07e03373..b34b45935861ce3f131304d7b908a0eea734bd5e 100644 (file)
@@ -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)
        {
        }
 
This page took 0.027831 seconds and 4 git commands to generate.