tests/utils/utils.sh: bt_diff(): validate that both files exist
Otherwise bt_diff() returns 0 (happy) with a nonexistent file.
This change reveals that `tests/plugins/src.ctf.fs/field/test-field.sh`
passes, but for the wrong reason: run_python() doesn't exist (I replaced
it with bt_run_in_py_env() a while ago), therefore that line doesn't
create any expectation file and bt_diff() returns 0. Change it to
use bt_run_in_py_env().
The use of `GString` is unnecessary for these fields. In fact, I think
it just makes things more complicated for nothing. Change to use
`gchar *`, allocated with `g_strdup()` and freed with `g_free()`.
span-lite: backport fix to avoid -Wundef error in C++20
When building babeltrace as C++20, I get:
CXX clock-correlation-validator/clock-correlation-validator.lo
In file included from /home/smarchi/src/babeltrace/src/cpp-common/bt2s/span.hpp:18, from /home/smarchi/src/babeltrace/src/cpp-common/bt2c/logging.hpp:25, from /home/smarchi/src/babeltrace/src/cpp-common/bt2/component-class-dev.hpp:15, from /home/smarchi/src/babeltrace/src/cpp-common/bt2/component-class.hpp:15, from /home/smarchi/src/babeltrace/src/cpp-common/bt2/error.hpp:20, from /home/smarchi/src/babeltrace/src/cpp-common/bt2/wrap.hpp:15, from /home/smarchi/src/babeltrace/src/clock-correlation-validator/clock-correlation-validator.cpp:9:
/home/smarchi/src/babeltrace/src/cpp-common/vendor/span-lite/span.hpp:43:33: error: "span_HAVE_STRUCT_BINDING" is not defined, evaluates to 0 [-Werror=undef]
43 | #define span_HAVE( feature ) ( span_HAVE_##feature )
| ^~~~~~~~~~
/home/smarchi/src/babeltrace/src/cpp-common/vendor/span-lite/span.hpp:1873:5: note: in expansion of macro 'span_HAVE'
1873 | #if span_HAVE( STRUCT_BINDING )
| ^~~~~~~~~
Backport commit b8921715cd71 ("Guard section for tuple interface to only
use with nonstd::span; fixes #84 (thanks @simark)") from the upstream
repo [1]
cpp-common/bt2c/logging.hpp: change type of `fmt` parameters to `fmt::format_string`
When compiled as C++20, this will enable doing some compile-time checks
of fmt format strings. I don't think there will be a negative impact
when building as C++11.
Even though `fmt::format_string` is lightweight (it consists of just a
string view), I chose to `std::move` it when passing it across
functions, even if it doesn't change anything today. It's not our type,
so it is subject to change without us knowing, perhaps it will gain a
move constructor one day.
cpp-common/bt2c/fmt.hpp: use `wise_enum::string_type` in `EnableIfIsWiseEnum` definition
wise_enum uses `const char *` as the string type for C++11/14 and
`std::string_view` for C++ >= 17. Change `EnableIfIsWiseEnum` to use
`wise_enum::string_type` instead of a hard-coded `const char *`, to make
compilation in C++17 possible.