src.ctf.fs: make set_trace_name use bt2::Trace
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 29 Jan 2024 17:05:23 +0000 (17:05 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Apr 2024 17:57:53 +0000 (13:57 -0400)
commit68c9714499bece2e9762471e84119f2d9e93791c
tree533afff511fd0ce79a09b189e69aaf23591661e9
parent6954b97e32145f8bc34cea22c4ce4fd17abbcb96
src.ctf.fs: make set_trace_name use bt2::Trace

Add an out-of-class `operator+=` to append a `bt2c::CStringView` to an
`std::string`.  Without it, I get:

      CXX      plugins/ctf/fs-src/fs.lo
    /home/simark/src/babeltrace/src/plugins/ctf/fs-src/fs.cpp: In function 'void set_trace_name(bt2::Trace, const char*)':
    /home/simark/src/babeltrace/src/plugins/ctf/fs-src/fs.cpp:598:14: error: ambiguous overload for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'bt2::CommonStringValue<const bt_value>::Value' {aka 'bt2c::CStringView'})
      598 |         name += val->asString().value();
          |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /usr/include/c++/13.2.1/string:54,
                     from /usr/include/c++/13.2.1/bits/locale_classes.h:40,
                     from /usr/include/c++/13.2.1/bits/ios_base.h:41,
                     from /usr/include/c++/13.2.1/ios:44,
                     from /usr/include/c++/13.2.1/istream:40,
                     from /usr/include/c++/13.2.1/sstream:40,
                     from /home/simark/src/babeltrace/src/plugins/ctf/fs-src/fs.cpp:10:
    /usr/include/c++/13.2.1/bits/basic_string.h:1354:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
     1354 |       operator+=(const basic_string& __str)
          |       ^~~~~~~~
    /usr/include/c++/13.2.1/bits/basic_string.h:1364:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
     1364 |       operator+=(const _CharT* __s)
          |       ^~~~~~~~

Change-Id: I3f47878658a431f81a129fc9e644efe50608e7ce
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8418
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12354
Tested-by: jenkins <jenkins@lttng.org>
src/cpp-common/bt2c/c-string-view.hpp
src/plugins/ctf/fs-src/fs.cpp
This page took 0.024362 seconds and 4 git commands to generate.