From: Jérémie Galarneau Date: Tue, 6 Jun 2023 15:20:06 +0000 (-0400) Subject: fmtlib: backport upstream fixes to suppress bogus gcc 13.1 warnings X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=commitdiff_plain;h=ca496d870cc9a991c1c79c7db9d213845b181420 fmtlib: backport upstream fixes to suppress bogus gcc 13.1 warnings gcc 13.1 erroneously warns of dangling references when using our custom formatters. This was reported to both fmtlib and gcc and fixes have been provided, but are not released yet. This change backports two fixes from the master branch to our vendored version: https://github.com/fmtlib/fmt/commit/f61f15cc5b11582d50d02ba0514c5344f7b2600e https://github.com/fmtlib/fmt/commit/ef55d4f52ec527668a8e910a56ea79d9b939dbc2 For more information on the issue, see: https://github.com/fmtlib/fmt/issues/3415 https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=6b927b1297e66e26e62e722bf15c921dcbbd25b9 Signed-off-by: Jérémie Galarneau Change-Id: I30bbbbe5e0aa2729e50228acdb528ee060d9df23 --- diff --git a/src/vendor/fmt/core.h b/src/vendor/fmt/core.h index bed8b40d3..2eff064cd 100644 --- a/src/vendor/fmt/core.h +++ b/src/vendor/fmt/core.h @@ -1732,32 +1732,27 @@ constexpr auto encode_types() -> unsigned long long { template FMT_CONSTEXPR FMT_INLINE auto make_value(T&& val) -> value { - const auto& arg = arg_mapper().map(FMT_FORWARD(val)); + using arg_type = remove_cvref_t().map(val))>; constexpr bool formattable_char = - !std::is_same::value; + !std::is_same::value; static_assert(formattable_char, "Mixing character types is disallowed."); - constexpr bool formattable_const = - !std::is_same::value; - static_assert(formattable_const, "Cannot format a const argument."); - // Formatting of arbitrary pointers is disallowed. If you want to output // a pointer cast it to "void *" or "const void *". In particular, this // forbids formatting of "[const] volatile char *" which is printed as bool // by iostreams. constexpr bool formattable_pointer = - !std::is_same::value; + !std::is_same::value; static_assert(formattable_pointer, "Formatting of non-void pointers is disallowed."); - constexpr bool formattable = - !std::is_same::value; + constexpr bool formattable = !std::is_same::value; static_assert( formattable, "Cannot format an argument. To make type T formattable provide a " "formatter specialization: https://fmt.dev/latest/api.html#udt"); - return {arg}; + return {arg_mapper().map(val)}; } template