diff --git a/3rdparty/fmt/ChangeLog.md b/3rdparty/fmt/ChangeLog.md
index 56baba39e2..b91b6f62b6 100644
--- a/3rdparty/fmt/ChangeLog.md
+++ b/3rdparty/fmt/ChangeLog.md
@@ -1,3 +1,176 @@
+# 12.0.0 - 2025-09-17
+
+- Optimized the default floating point formatting
+ (https://github.com/fmtlib/fmt/issues/3675,
+ https://github.com/fmtlib/fmt/issues/4516). In particular, formatting a
+ `double` with format string compilation into a stack allocated buffer is
+ more than 60% faster in version 12.0 compared to 11.2 according to
+ [dtoa-benchmark](https://github.com/fmtlib/dtoa-benchmark):
+
+ ```
+ Function Time (ns) Speedup
+ fmt11 34.471 1.00x
+ fmt12 21.000 1.64x
+ ```
+
+
+
+- Added `constexpr` support to `fmt::format`. For example:
+
+ ```c++
+ #include
+
+ using namespace fmt::literals;
+ std::string s = fmt::format(""_cf, 42);
+ ```
+
+ now works at compile time provided that `std::string` supports `constexpr`
+ (https://github.com/fmtlib/fmt/issues/3403,
+ https://github.com/fmtlib/fmt/pull/4456). Thanks @msvetkin.
+
+- Added `FMT_STATIC_FORMAT` that allows formatting into a string of the exact
+ required size at compile time.
+
+ For example:
+
+ ```c++
+ #include
+
+ constexpr auto s = FMT_STATIC_FORMAT("{}", 42);
+ ```
+
+ compiles to just
+
+ ```s
+ __ZL1s:
+ .asciiz "42"
+ ```
+
+ It can be accessed as a C string with `s.c_str()` or as a string view with
+ `s.str()`.
+
+- Improved C++20 module support
+ (https://github.com/fmtlib/fmt/pull/4451,
+ https://github.com/fmtlib/fmt/pull/4459,
+ https://github.com/fmtlib/fmt/pull/4476,
+ https://github.com/fmtlib/fmt/pull/4488,
+ https://github.com/fmtlib/fmt/issues/4491,
+ https://github.com/fmtlib/fmt/pull/4495).
+ Thanks @arBmind, @tkhyn, @Mishura4, @anonymouspc and @autoantwort.
+
+- Switched to using estimated display width in precision. For example:
+
+ ```c++
+ fmt::print("|{:.4}|\n|1234|\n", "🐱🐱🐱");
+ ```
+
+ prints
+
+ 
+
+ because `🐱` has an estimated width of 2
+ (https://github.com/fmtlib/fmt/issues/4272,
+ https://github.com/fmtlib/fmt/pull/4443,
+ https://github.com/fmtlib/fmt/pull/4475).
+ Thanks @nikhilreddydev and @localspook.
+
+- Fix interaction between debug presentation, precision, and width for strings
+ (https://github.com/fmtlib/fmt/pull/4478). Thanks @localspook.
+
+- Implemented allocator propagation on `basic_memory_buffer` move
+ (https://github.com/fmtlib/fmt/issues/4487,
+ https://github.com/fmtlib/fmt/pull/4490). Thanks @toprakmurat.
+
+- Fixed an ambiguity between `std::reference_wrapper` and `format_as`
+ formatters (https://github.com/fmtlib/fmt/issues/4424,
+ https://github.com/fmtlib/fmt/pull/4434). Thanks @jeremy-rifkin.
+
+- Removed the following deprecated APIs:
+
+ - `has_formatter`: use `is_formattable` instead,
+ - `basic_format_args::parse_context_type`,
+ `basic_format_args::formatter_type` and similar aliases in context types,
+ - wide stream overload of `fmt::printf`,
+ - wide stream overloads of `fmt::print` that take text styles,
+ - `is_*char` traits,
+ - `fmt::localtime`.
+
+- Deprecated wide overloads of `fmt::fprintf` and `fmt::sprintf`.
+
+- Improved diagnostics for the incorrect usage of `fmt::ptr`
+ (https://github.com/fmtlib/fmt/pull/4453). Thanks @TobiSchluter.
+
+- Made handling of ANSI escape sequences more efficient
+ (https://github.com/fmtlib/fmt/pull/4511,
+ https://github.com/fmtlib/fmt/pull/4528).
+ Thanks @localspook and @Anas-Hamdane.
+
+- Fixed a buffer overflow on all emphasis flags set
+ (https://github.com/fmtlib/fmt/pull/4498). Thanks @dominicpoeschko.
+
+- Fixed an integer overflow for precision close to the max `int` value.
+
+- Fixed compatibility with WASI (https://github.com/fmtlib/fmt/issues/4496,
+ https://github.com/fmtlib/fmt/pull/4497). Thanks @whitequark.
+
+- Fixed `back_insert_iterator` detection, preventing a fallback on slower path
+ that handles arbitrary iterators (https://github.com/fmtlib/fmt/issues/4454).
+
+- Fixed handling of invalid glibc `FILE` buffers
+ (https://github.com/fmtlib/fmt/issues/4469).
+
+- Added `wchar_t` support to the `std::byte` formatter
+ (https://github.com/fmtlib/fmt/issues/4479,
+ https://github.com/fmtlib/fmt/pull/4480). Thanks @phprus.
+
+- Changed component prefix from `fmt-` to `fmt_` for compatibility with
+ NSIS/CPack on Windows, e.g. `fmt-doc` changed to `fmt_doc`
+ (https://github.com/fmtlib/fmt/issues/4441,
+ https://github.com/fmtlib/fmt/pull/4442). Thanks @n-stein.
+
+- Added the `FMT_CUSTOM_ASSERT_FAIL` macro to simplify providing a custom
+ `fmt::assert_fail` implementation (https://github.com/fmtlib/fmt/pull/4505).
+ Thanks @HazardyKnusperkeks.
+
+- Switched to `FMT_THROW` on reporting format errors so that it can be
+ overriden by users when exceptions are disabled
+ (https://github.com/fmtlib/fmt/pull/4521). Thanks @HazardyKnusperkeks.
+
+- Improved master project detection and disabled install targets when using
+ {fmt} as a subproject by default (https://github.com/fmtlib/fmt/pull/4536).
+ Thanks @crueter.
+
+- Made various code improvements
+ (https://github.com/fmtlib/fmt/pull/4445,
+ https://github.com/fmtlib/fmt/pull/4448,
+ https://github.com/fmtlib/fmt/pull/4473,
+ https://github.com/fmtlib/fmt/pull/4522).
+ Thanks @localspook, @tchaikov and @way4sahil.
+
+- Added Conan instructions to the docs
+ (https://github.com/fmtlib/fmt/pull/4537). Thanks @uilianries.
+
+- Removed Bazel files to avoid issues with downstream packaging
+ (https://github.com/fmtlib/fmt/pull/4530). Thanks @mering.
+
+- Added more entries for generated files to `.gitignore`
+ (https://github.com/fmtlib/fmt/pull/4355,
+ https://github.com/fmtlib/fmt/pull/4512).
+ Thanks @dinomight and @localspook.
+
+- Fixed various warnings and compilation issues
+ (https://github.com/fmtlib/fmt/pull/4447,
+ https://github.com/fmtlib/fmt/issues/4470,
+ https://github.com/fmtlib/fmt/pull/4474,
+ https://github.com/fmtlib/fmt/pull/4477,
+ https://github.com/fmtlib/fmt/pull/4471,
+ https://github.com/fmtlib/fmt/pull/4483,
+ https://github.com/fmtlib/fmt/pull/4515,
+ https://github.com/fmtlib/fmt/issues/4533,
+ https://github.com/fmtlib/fmt/pull/4534).
+ Thanks @dodomorandi, @localspook, @remyjette, @Tomek-Stolarczyk, @Mishura4,
+ @mattiasljungstrom and @FatihBAKIR.
+
# 11.2.0 - 2025-05-03
- Added the `s` specifier for `std::error_code`. It allows formatting an error
@@ -56,17 +229,18 @@
https://github.com/fmtlib/fmt/pull/4361). Thanks @dinomight.
- Added error reporting for duplicate named arguments
- (https://github.com/fmtlib/fmt/pull/4367). Thanks @dinomight.
+ (https://github.com/fmtlib/fmt/issues/4282,
+ https://github.com/fmtlib/fmt/pull/4367). Thanks @dinomight.
- Fixed formatting of `long` with `FMT_BUILTIN_TYPES=0`
(https://github.com/fmtlib/fmt/issues/4375,
https://github.com/fmtlib/fmt/issues/4394).
- Optimized `text_style` using bit packing
- (https://github.com/fmtlib/fmt/pull/4363). Thanks @LocalSpook.
+ (https://github.com/fmtlib/fmt/pull/4363). Thanks @localspook.
- Added support for incomplete types (https://github.com/fmtlib/fmt/issues/3180,
- https://github.com/fmtlib/fmt/pull/4383). Thanks @LocalSpook.
+ https://github.com/fmtlib/fmt/pull/4383). Thanks @localspook.
- Fixed a flush issue in `fmt::print` when using libstdc++
(https://github.com/fmtlib/fmt/issues/4398).
@@ -107,13 +281,14 @@
`float` (https://github.com/fmtlib/fmt/issues/3649).
- Moved `is_compiled_string` to the public API
- (https://github.com/fmtlib/fmt/issues/4342). Thanks @SwooshyCueb.
+ (https://github.com/fmtlib/fmt/issues/4335,
+ https://github.com/fmtlib/fmt/issues/4342). Thanks @SwooshyCueb.
- Simplified implementation of `operator""_cf`
- (https://github.com/fmtlib/fmt/pull/4349). Thanks @LocalSpook.
+ (https://github.com/fmtlib/fmt/pull/4349). Thanks @localspook.
- Fixed `__builtin_strlen` detection (https://github.com/fmtlib/fmt/pull/4329).
- Thanks @LocalSpook.
+ Thanks @localspook.
- Fixed handling of BMI paths with the Ninja generator
(https://github.com/fmtlib/fmt/pull/4344). Thanks @tkhyn.
diff --git a/3rdparty/fmt/README.md b/3rdparty/fmt/README.md
index 638ec52276..612c10c55b 100644
--- a/3rdparty/fmt/README.md
+++ b/3rdparty/fmt/README.md
@@ -4,8 +4,9 @@
[](https://github.com/fmtlib/fmt/actions?query=workflow%3Amacos)
[](https://github.com/fmtlib/fmt/actions?query=workflow%3Awindows)
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?\%0Acolspec=ID%20Type%20Component%20Status%20Proj%20Reported%20Owner%20\%0ASummary&q=proj%3Dfmt&can=1)
-[](https://stackoverflow.com/questions/tagged/fmt)
+[](https://www.bestpractices.dev/projects/8880)
[](https://securityscorecards.dev/viewer/?uri=github.com/fmtlib/fmt)
+[](https://stackoverflow.com/questions/tagged/fmt)
**{fmt}** is an open-source formatting library providing a fast and safe
alternative to C stdio and C++ iostreams.
diff --git a/3rdparty/fmt/include/fmt/args.h b/3rdparty/fmt/include/fmt/args.h
index 3ff4788074..5e5f40f9eb 100644
--- a/3rdparty/fmt/include/fmt/args.h
+++ b/3rdparty/fmt/include/fmt/args.h
@@ -71,7 +71,7 @@ class dynamic_arg_list {
* It can be implicitly converted into `fmt::basic_format_args` for passing
* into type-erased formatting functions such as `fmt::vformat`.
*/
-template class dynamic_format_arg_store {
+FMT_EXPORT template class dynamic_format_arg_store {
private:
using char_type = typename Context::char_type;
@@ -212,7 +212,7 @@ template class dynamic_format_arg_store {
}
/// Returns the number of elements in the store.
- size_t size() const noexcept { return data_.size(); }
+ auto size() const noexcept -> size_t { return data_.size(); }
};
FMT_END_NAMESPACE
diff --git a/3rdparty/fmt/include/fmt/base.h b/3rdparty/fmt/include/fmt/base.h
index 87b3fd7cb4..42e192aca6 100644
--- a/3rdparty/fmt/include/fmt/base.h
+++ b/3rdparty/fmt/include/fmt/base.h
@@ -21,7 +21,7 @@
#endif
// The fmt library version in the form major * 10000 + minor * 100 + patch.
-#define FMT_VERSION 110200
+#define FMT_VERSION 120000
// Detect compiler versions.
#if defined(__clang__) && !defined(__ibmxl__)
@@ -201,14 +201,6 @@
# define FMT_NODISCARD
#endif
-#ifdef FMT_DEPRECATED
-// Use the provided definition.
-#elif FMT_HAS_CPP14_ATTRIBUTE(deprecated)
-# define FMT_DEPRECATED [[deprecated]]
-#else
-# define FMT_DEPRECATED /* deprecated */
-#endif
-
#if FMT_GCC_VERSION || FMT_CLANG_VERSION
# define FMT_VISIBILITY(value) __attribute__((visibility(value)))
#else
@@ -260,7 +252,7 @@ FMT_PRAGMA_CLANG(diagnostic push)
#ifndef FMT_BEGIN_NAMESPACE
# define FMT_BEGIN_NAMESPACE \
namespace fmt { \
- inline namespace v11 {
+ inline namespace v12 {
# define FMT_END_NAMESPACE \
} \
}
@@ -356,6 +348,9 @@ template constexpr auto max_of(T a, T b) -> T {
return a > b ? a : b;
}
+FMT_NORETURN FMT_API void assert_fail(const char* file, int line,
+ const char* message);
+
namespace detail {
// Suppresses "unused variable" warnings with the method described in
// https://herbsutter.com/2009/10/18/mailbag-shutting-up-compiler-warnings/.
@@ -396,7 +391,7 @@ FMT_NORETURN FMT_API void assert_fail(const char* file, int line,
# define FMT_ASSERT(condition, message) \
((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \
? (void)0 \
- : fmt::detail::assert_fail(__FILE__, __LINE__, (message)))
+ : ::fmt::assert_fail(__FILE__, __LINE__, (message)))
#endif
#ifdef FMT_USE_INT128
@@ -463,12 +458,13 @@ enum { use_utf8 = !FMT_WIN32 || is_utf8_enabled };
static_assert(!FMT_UNICODE || use_utf8,
"Unicode support requires compiling with /utf-8");
-template constexpr const char* narrow(const T*) { return nullptr; }
-constexpr FMT_ALWAYS_INLINE const char* narrow(const char* s) { return s; }
+template constexpr auto narrow(T*) -> char* { return nullptr; }
+constexpr FMT_ALWAYS_INLINE auto narrow(const char* s) -> const char* {
+ return s;
+}
template
-FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n)
- -> int {
+FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, size_t n) -> int {
if (!is_constant_evaluated() && sizeof(Char) == 1) return memcmp(s1, s2, n);
for (; n != 0; ++s1, ++s2, --n) {
if (*s1 < *s2) return -1;
@@ -540,7 +536,7 @@ template class basic_string_view {
FMT_CONSTEXPR20 basic_string_view(const Char* s) : data_(s) {
#if FMT_HAS_BUILTIN(__builtin_strlen) || FMT_GCC_VERSION || FMT_CLANG_VERSION
if (std::is_same::value && !detail::is_constant_evaluated()) {
- size_ = __builtin_strlen(detail::narrow(s)); // strlen is not costexpr.
+ size_ = __builtin_strlen(detail::narrow(s)); // strlen is not constexpr.
return;
}
#endif
@@ -616,19 +612,6 @@ template class basic_string_view {
using string_view = basic_string_view;
-// DEPRECATED! Will be merged with is_char and moved to detail.
-template struct is_xchar : std::false_type {};
-template <> struct is_xchar : std::true_type {};
-template <> struct is_xchar : std::true_type {};
-template <> struct is_xchar : std::true_type {};
-#ifdef __cpp_char8_t
-template <> struct is_xchar : std::true_type {};
-#endif
-
-// Specifies if `T` is a character (code unit) type.
-template struct is_char : is_xchar {};
-template <> struct is_char : std::true_type {};
-
template class basic_appender;
using appender = basic_appender;
@@ -781,7 +764,7 @@ class basic_specs {
(static_cast(p) << precision_shift);
}
- constexpr bool dynamic() const {
+ constexpr auto dynamic() const -> bool {
return (data_ & (width_mask | precision_mask)) != 0;
}
@@ -921,14 +904,47 @@ template class parse_context {
FMT_CONSTEXPR void check_dynamic_spec(int arg_id);
};
+#ifndef FMT_USE_LOCALE
+# define FMT_USE_LOCALE (FMT_OPTIMIZE_SIZE <= 1)
+#endif
+
+// A type-erased reference to std::locale to avoid the heavy include.
+class locale_ref {
+#if FMT_USE_LOCALE
+ private:
+ const void* locale_; // A type-erased pointer to std::locale.
+
+ public:
+ constexpr locale_ref() : locale_(nullptr) {}
+
+ template
+ locale_ref(const Locale& loc);
+
+ inline explicit operator bool() const noexcept { return locale_ != nullptr; }
+#endif // FMT_USE_LOCALE
+
+ public:
+ template auto get() const -> Locale;
+};
+
FMT_END_EXPORT
namespace detail {
+// Specifies if `T` is a code unit type.
+template struct is_code_unit : std::false_type {};
+template <> struct is_code_unit : std::true_type {};
+template <> struct is_code_unit : std::true_type {};
+template <> struct is_code_unit : std::true_type {};
+template <> struct is_code_unit : std::true_type {};
+#ifdef __cpp_char8_t
+template <> struct is_code_unit : bool_constant {};
+#endif
+
// Constructs fmt::basic_string_view from types implicitly convertible
// to it, deducing Char. Explicitly convertible types such as the ones returned
// from FMT_STRING are intentionally excluded.
-template ::value)>
+template ::value)>
constexpr auto to_string_view(const Char* s) -> basic_string_view {
return s;
}
@@ -1057,11 +1073,11 @@ template constexpr auto count() -> int {
return (B1 ? 1 : 0) + count();
}
-template constexpr auto count_named_args() -> int {
- return count::value...>();
+template constexpr auto count_named_args() -> int {
+ return count::value...>();
}
-template constexpr auto count_static_named_args() -> int {
- return count::value...>();
+template constexpr auto count_static_named_args() -> int {
+ return count::value...>();
}
template struct named_arg_info {
@@ -1069,7 +1085,7 @@ template struct named_arg_info {
int id;
};
-// named_args is non-const to suppress a bogus -Wmaybe-uninitalized in gcc 13.
+// named_args is non-const to suppress a bogus -Wmaybe-uninitialized in gcc 13.
template
FMT_CONSTEXPR void check_for_duplicate(named_arg_info* named_args,
int named_arg_index,
@@ -1173,7 +1189,7 @@ template struct type_mapper {
static auto map(ubitint)
-> conditional_t;
- template ::value)>
+ template ::value)>
static auto map(T) -> conditional_t<
std::is_same::value || std::is_same::value, Char, void>;
@@ -1679,12 +1695,12 @@ template struct arg_pack {};
template
class format_string_checker {
private:
- type types_[max_of(1, NUM_ARGS)];
- named_arg_info named_args_[max_of(1, NUM_NAMED_ARGS)];
+ type types_[max_of(1, NUM_ARGS)];
+ named_arg_info named_args_[max_of(1, NUM_NAMED_ARGS)];
compile_parse_context context_;
using parse_func = auto (*)(parse_context&) -> const Char*;
- parse_func parse_funcs_[max_of(1, NUM_ARGS)];
+ parse_func parse_funcs_[max_of(1, NUM_ARGS)];
public:
template
@@ -2033,6 +2049,17 @@ struct has_back_insert_iterator_container_append<
.append(std::declval(),
std::declval()))>> : std::true_type {};
+template
+struct has_back_insert_iterator_container_insert_at_end : std::false_type {};
+
+template
+struct has_back_insert_iterator_container_insert_at_end<
+ OutputIt, InputIt,
+ void_t())
+ .insert(get_container(std::declval()).end(),
+ std::declval(),
+ std::declval()))>> : std::true_type {};
+
// An optimized version of std::copy with the output value type (T).
template ::value&&
@@ -2047,6 +2074,8 @@ FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end, OutputIt out)
template ::value &&
!has_back_insert_iterator_container_append<
+ OutputIt, InputIt>::value &&
+ has_back_insert_iterator_container_insert_at_end<
OutputIt, InputIt>::value)>
FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end, OutputIt out)
-> OutputIt {
@@ -2056,7 +2085,11 @@ FMT_CONSTEXPR20 auto copy(InputIt begin, InputIt end, OutputIt out)
}
template ::value)>
+ FMT_ENABLE_IF(!(is_back_insert_iterator::value &&
+ (has_back_insert_iterator_container_append<
+ OutputIt, InputIt>::value ||
+ has_back_insert_iterator_container_insert_at_end<
+ OutputIt, InputIt>::value)))>
FMT_CONSTEXPR auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt {
while (begin != end) *out++ = static_cast(*begin++);
return out;
@@ -2176,7 +2209,7 @@ template class value {
static_assert(N <= 64, "unsupported _BitInt");
}
- template ::value)>
+ template ::value)>
constexpr FMT_INLINE value(T x FMT_BUILTIN) : char_value(x) {
static_assert(
std::is_same::value || std::is_same::value,
@@ -2252,7 +2285,7 @@ template class value {
custom.value = const_cast(&x);
#endif
}
- custom.format = format_custom>;
+ custom.format = format_custom;
}
template ())>
@@ -2263,10 +2296,10 @@ template class value {
}
// Formats an argument of a custom type, such as a user-defined class.
- template
+ template
static void format_custom(void* arg, parse_context& parse_ctx,
Context& ctx) {
- auto f = Formatter();
+ auto f = formatter();
parse_ctx.advance_to(f.parse(parse_ctx));
using qualified_type =
conditional_t(), const T, T>;
@@ -2293,35 +2326,14 @@ struct is_output_iterator<
enable_if_t&>()++),
T>::value>> : std::true_type {};
-#ifndef FMT_USE_LOCALE
-# define FMT_USE_LOCALE (FMT_OPTIMIZE_SIZE <= 1)
-#endif
-
-// A type-erased reference to an std::locale to avoid a heavy include.
-class locale_ref {
-#if FMT_USE_LOCALE
- private:
- const void* locale_; // A type-erased pointer to std::locale.
-
- public:
- constexpr locale_ref() : locale_(nullptr) {}
- template locale_ref(const Locale& loc);
-
- inline explicit operator bool() const noexcept { return locale_ != nullptr; }
-#endif // FMT_USE_LOCALE
-
- public:
- template auto get() const -> Locale;
-};
-
template constexpr auto encode_types() -> unsigned long long {
return 0;
}
-template
+template
constexpr auto encode_types() -> unsigned long long {
- return static_cast(stored_type_constant::value) |
- (encode_types() << packed_arg_bits);
+ return static_cast(stored_type_constant::value) |
+ (encode_types() << packed_arg_bits);
}
template
@@ -2338,8 +2350,9 @@ template
struct named_arg_store {
// args_[0].named_args points to named_args to avoid bloating format_args.
- arg_t args[1 + NUM_ARGS];
- named_arg_info named_args[NUM_NAMED_ARGS];
+ arg_t args[1u + NUM_ARGS];
+ named_arg_info
+ named_args[static_cast(NUM_NAMED_ARGS)];
template
FMT_CONSTEXPR FMT_ALWAYS_INLINE named_arg_store(T&... values)
@@ -2358,8 +2371,8 @@ struct named_arg_store {
}
named_arg_store(const named_arg_store& rhs) = delete;
- named_arg_store& operator=(const named_arg_store& rhs) = delete;
- named_arg_store& operator=(named_arg_store&& rhs) = delete;
+ auto operator=(const named_arg_store& rhs) -> named_arg_store& = delete;
+ auto operator=(named_arg_store&& rhs) -> named_arg_store& = delete;
operator const arg_t*() const { return args + 1; }
};
@@ -2372,7 +2385,7 @@ struct format_arg_store {
// +1 to workaround a bug in gcc 7.5 that causes duplicated-branches warning.
using type =
conditional_t[max_of(1, NUM_ARGS)],
+ arg_t[max_of(1, NUM_ARGS)],
named_arg_store>;
type args;
};
@@ -2656,22 +2669,17 @@ class context {
private:
appender out_;
format_args args_;
- FMT_NO_UNIQUE_ADDRESS detail::locale_ref loc_;
+ FMT_NO_UNIQUE_ADDRESS locale_ref loc_;
public:
- /// The character type for the output.
- using char_type = char;
-
+ using char_type = char; ///< The character type for the output.
using iterator = appender;
using format_arg = basic_format_arg;
- using parse_context_type FMT_DEPRECATED = parse_context<>;
- template using formatter_type FMT_DEPRECATED = formatter;
enum { builtin_types = FMT_BUILTIN_TYPES };
/// Constructs a `context` object. References to the arguments are stored
/// in the object so make sure they have appropriate lifetimes.
- FMT_CONSTEXPR context(iterator out, format_args args,
- detail::locale_ref loc = {})
+ FMT_CONSTEXPR context(iterator out, format_args args, locale_ref loc = {})
: out_(out), args_(args), loc_(loc) {}
context(context&&) = default;
context(const context&) = delete;
@@ -2692,7 +2700,7 @@ class context {
// Advances the begin iterator to `it`.
FMT_CONSTEXPR void advance_to(iterator) {}
- FMT_CONSTEXPR auto locale() const -> detail::locale_ref { return loc_; }
+ FMT_CONSTEXPR auto locale() const -> locale_ref { return loc_; }
};
template struct runtime_format_string {
@@ -2779,9 +2787,6 @@ template
concept formattable = is_formattable, Char>::value;
#endif
-template
-using has_formatter FMT_DEPRECATED = std::is_constructible>;
-
// A formatter specialization for natively supported types.
template
struct formatter fmt, T&&... args) {
return fmt::println(stdout, fmt, static_cast(args)...);
}
-FMT_END_EXPORT
FMT_PRAGMA_CLANG(diagnostic pop)
FMT_PRAGMA_GCC(pop_options)
+FMT_END_EXPORT
FMT_END_NAMESPACE
#ifdef FMT_HEADER_ONLY
diff --git a/3rdparty/fmt/include/fmt/chrono.h b/3rdparty/fmt/include/fmt/chrono.h
index e0c81589ea..a788d3ecf4 100644
--- a/3rdparty/fmt/include/fmt/chrono.h
+++ b/3rdparty/fmt/include/fmt/chrono.h
@@ -38,6 +38,7 @@ FMT_BEGIN_NAMESPACE
// Copyright Paul Dreik 2019
namespace safe_duration_cast {
+// DEPRECATED!
template ::value &&
std::numeric_limits::is_signed ==
@@ -161,17 +162,6 @@ auto safe_duration_cast(std::chrono::duration from,
int& ec) -> To {
using From = std::chrono::duration;
ec = 0;
- if (std::isnan(from.count())) {
- // nan in, gives nan out. easy.
- return To{std::numeric_limits::quiet_NaN()};
- }
- // maybe we should also check if from is denormal, and decide what to do about
- // it.
-
- // +-inf should be preserved.
- if (std::isinf(from.count())) {
- return To{from.count()};
- }
// the basic idea is that we need to convert from count() in the from type
// to count() in the To type, by multiplying it with this:
@@ -282,8 +272,6 @@ namespace detail {
#define FMT_NOMACRO
template struct null {};
-inline auto localtime_r FMT_NOMACRO(...) -> null<> { return null<>(); }
-inline auto localtime_s(...) -> null<> { return null<>(); }
inline auto gmtime_r(...) -> null<> { return null<>(); }
inline auto gmtime_s(...) -> null<> { return null<>(); }
@@ -326,7 +314,7 @@ inline auto get_classic_locale() -> const std::locale& {
}
template struct codecvt_result {
- static constexpr const size_t max_size = 32;
+ static constexpr size_t max_size = 32;
CodeUnit buf[max_size];
CodeUnit* end;
};
@@ -443,11 +431,7 @@ auto duration_cast(std::chrono::duration from) -> To {
using common_rep = typename std::common_type::type;
-
- int ec = 0;
- auto count = safe_duration_cast::lossless_integral_conversion(
- from.count(), ec);
- if (ec) throw_duration_error();
+ common_rep count = from.count(); // This conversion is lossless.
// Multiply from.count() by factor and check for overflow.
if (const_check(factor::num != 1)) {
@@ -458,6 +442,7 @@ auto duration_cast(std::chrono::duration from) -> To {
count *= factor::num;
}
if (const_check(factor::den != 1)) count /= factor::den;
+ int ec = 0;
auto to =
To(safe_duration_cast::lossless_integral_conversion(
count, ec));
@@ -471,6 +456,8 @@ template ::value)>
auto duration_cast(std::chrono::duration from) -> To {
#if FMT_SAFE_DURATION_CAST
+ // Preserve infinity and NaN.
+ if (!isfinite(from.count())) return static_cast(from.count());
// Throwing version of safe_duration_cast is only available for
// integer to integer or float to float casts.
int ec;
@@ -487,7 +474,7 @@ template ::value)>
auto duration_cast(std::chrono::duration from) -> To {
- // Mixed integer <-> float cast is not supported by safe_duration_cast.
+ // Mixed integer <-> float cast is not supported by safe duration_cast.
return std::chrono::duration_cast(from);
}
@@ -501,86 +488,10 @@ auto to_time_t(sys_time time_point) -> std::time_t {
.count();
}
-namespace tz {
-
-// DEPRECATED!
-struct time_zone {
- template
- auto to_sys(LocalTime) -> sys_time {
- return {};
- }
-};
-template auto current_zone(T...) -> time_zone* {
- return nullptr;
-}
-
-template void _tzset(T...) {}
-} // namespace tz
-
-// DEPRECATED!
-inline void tzset_once() {
- static bool init = []() {
- using namespace tz;
- _tzset();
- return false;
- }();
- ignore_unused(init);
-}
} // namespace detail
FMT_BEGIN_EXPORT
-/**
- * Converts given time since epoch as `std::time_t` value into calendar time,
- * expressed in local time. Unlike `std::localtime`, this function is
- * thread-safe on most platforms.
- */
-FMT_DEPRECATED inline auto localtime(std::time_t time) -> std::tm {
- struct dispatcher {
- std::time_t time_;
- std::tm tm_;
-
- inline dispatcher(std::time_t t) : time_(t) {}
-
- inline auto run() -> bool {
- using namespace fmt::detail;
- return handle(localtime_r(&time_, &tm_));
- }
-
- inline auto handle(std::tm* tm) -> bool { return tm != nullptr; }
-
- inline auto handle(detail::null<>) -> bool {
- using namespace fmt::detail;
- return fallback(localtime_s(&tm_, &time_));
- }
-
- inline auto fallback(int res) -> bool { return res == 0; }
-
-#if !FMT_MSC_VERSION
- inline auto fallback(detail::null<>) -> bool {
- using namespace fmt::detail;
- std::tm* tm = std::localtime(&time_);
- if (tm) tm_ = *tm;
- return tm != nullptr;
- }
-#endif
- };
- dispatcher lt(time);
- // Too big time values may be unsupported.
- if (!lt.run()) FMT_THROW(format_error("time_t value out of range"));
- return lt.tm_;
-}
-
-#if FMT_USE_LOCAL_TIME
-template
-FMT_DEPRECATED auto localtime(std::chrono::local_time time)
- -> std::tm {
- using namespace std::chrono;
- using namespace detail::tz;
- return localtime(detail::to_time_t(current_zone()->to_sys(time)));
-}
-#endif
-
/**
* Converts given time since epoch as `std::time_t` value into calendar time,
* expressed in Coordinated Universal Time (UTC). Unlike `std::gmtime`, this
@@ -652,7 +563,7 @@ inline void write_digit2_separated(char* buf, unsigned a, unsigned b,
// Add ASCII '0' to each digit byte and insert separators.
digits |= 0x3030003030003030 | (usep << 16) | (usep << 40);
- constexpr const size_t len = 8;
+ constexpr size_t len = 8;
if (const_check(is_big_endian())) {
char tmp[len];
std::memcpy(tmp, &digits, len);
@@ -1000,16 +911,16 @@ template
struct has_tm_zone> : std::true_type {};
template ::value)>
-bool set_tm_zone(T& time, char* tz) {
+auto set_tm_zone(T& time, char* tz) -> bool {
time.tm_zone = tz;
return true;
}
template ::value)>
-bool set_tm_zone(T&, char*) {
+auto set_tm_zone(T&, char*) -> bool {
return false;
}
-inline char* utc() {
+inline auto utc() -> char* {
static char tz[] = "UTC";
return tz;
}
@@ -2230,7 +2141,7 @@ template struct formatter {
detail::handle_dynamic_spec(specs.dynamic_width(), specs.width, width_ref_,
ctx);
- auto loc_ref = specs.localized() ? ctx.locale() : detail::locale_ref();
+ auto loc_ref = specs.localized() ? ctx.locale() : locale_ref();
detail::get_locale loc(static_cast(loc_ref), loc_ref);
auto w = detail::tm_writer, Char, Duration>(
loc, out, tm, subsecs);
diff --git a/3rdparty/fmt/include/fmt/color.h b/3rdparty/fmt/include/fmt/color.h
index 638f15b43f..b69c148863 100644
--- a/3rdparty/fmt/include/fmt/color.h
+++ b/3rdparty/fmt/include/fmt/color.h
@@ -375,19 +375,17 @@ template struct ansi_color_escape {
// 10 more.
if (is_background) value += 10u;
- size_t index = 0;
- buffer[index++] = static_cast('\x1b');
- buffer[index++] = static_cast('[');
+ buffer[size++] = static_cast('\x1b');
+ buffer[size++] = static_cast('[');
if (value >= 100u) {
- buffer[index++] = static_cast('1');
+ buffer[size++] = static_cast('1');
value %= 100u;
}
- buffer[index++] = static_cast('0' + value / 10u);
- buffer[index++] = static_cast('0' + value % 10u);
+ buffer[size++] = static_cast('0' + value / 10u);
+ buffer[size++] = static_cast('0' + value % 10u);
- buffer[index++] = static_cast('m');
- buffer[index++] = static_cast('\0');
+ buffer[size++] = static_cast('m');
return;
}
@@ -398,7 +396,7 @@ template struct ansi_color_escape {
to_esc(color.r, buffer + 7, ';');
to_esc(color.g, buffer + 11, ';');
to_esc(color.b, buffer + 15, 'm');
- buffer[19] = static_cast(0);
+ size = 19;
}
FMT_CONSTEXPR ansi_color_escape(emphasis em) noexcept {
uint8_t em_codes[num_emphases] = {};
@@ -411,26 +409,28 @@ template struct ansi_color_escape {
if (has_emphasis(em, emphasis::conceal)) em_codes[6] = 8;
if (has_emphasis(em, emphasis::strikethrough)) em_codes[7] = 9;
- size_t index = 0;
+ buffer[size++] = static_cast('\x1b');
+ buffer[size++] = static_cast('[');
+
for (size_t i = 0; i < num_emphases; ++i) {
if (!em_codes[i]) continue;
- buffer[index++] = static_cast('\x1b');
- buffer[index++] = static_cast('[');
- buffer[index++] = static_cast('0' + em_codes[i]);
- buffer[index++] = static_cast('m');
+ buffer[size++] = static_cast('0' + em_codes[i]);
+ buffer[size++] = static_cast(';');
}
- buffer[index++] = static_cast(0);
+
+ buffer[size - 1] = static_cast('m');
}
FMT_CONSTEXPR operator const Char*() const noexcept { return buffer; }
FMT_CONSTEXPR auto begin() const noexcept -> const Char* { return buffer; }
- FMT_CONSTEXPR20 auto end() const noexcept -> const Char* {
- return buffer + basic_string_view(buffer).size();
+ FMT_CONSTEXPR auto end() const noexcept -> const Char* {
+ return buffer + size;
}
private:
static constexpr size_t num_emphases = 8;
- Char buffer[7u + 3u * num_emphases + 1u];
+ Char buffer[7u + 4u * num_emphases];
+ size_t size = 0;
static FMT_CONSTEXPR void to_esc(uint8_t c, Char* out,
char delimiter) noexcept {
diff --git a/3rdparty/fmt/include/fmt/compile.h b/3rdparty/fmt/include/fmt/compile.h
index 08d9427ff2..f711ba41ee 100644
--- a/3rdparty/fmt/include/fmt/compile.h
+++ b/3rdparty/fmt/include/fmt/compile.h
@@ -22,8 +22,6 @@ FMT_EXPORT class compiled_string {};
template
struct is_compiled_string : std::is_base_of {};
-namespace detail {
-
/**
* Converts a string literal `s` into a format string that will be parsed at
* compile time and converted into efficient formatting code. Requires C++17
@@ -41,18 +39,40 @@ namespace detail {
# define FMT_COMPILE(s) FMT_STRING(s)
#endif
+/**
+ * Converts a string literal into a format string that will be parsed at
+ * compile time and converted into efficient formatting code. Requires support
+ * for class types in constant template parameters (a C++20 feature).
+ *
+ * **Example**:
+ *
+ * // Converts 42 into std::string using the most efficient method and no
+ * // runtime format string processing.
+ * using namespace fmt::literals;
+ * std::string s = fmt::format("{}"_cf, 42);
+ */
+#if FMT_USE_NONTYPE_TEMPLATE_ARGS
+inline namespace literals {
+template constexpr auto operator""_cf() {
+ return FMT_COMPILE(Str.data);
+}
+} // namespace literals
+#endif
+
+namespace detail {
+
template
-auto first(const T& value, const Tail&...) -> const T& {
+constexpr auto first(const T& value, const Tail&...) -> const T& {
return value;
}
#if defined(__cpp_if_constexpr) && defined(__cpp_return_type_deduction)
-template struct type_list {};
+template struct type_list {};
// Returns a reference to the argument at index N from [first, rest...].
template
-constexpr const auto& get([[maybe_unused]] const T& first,
- [[maybe_unused]] const Args&... rest) {
+constexpr auto get([[maybe_unused]] const T& first,
+ [[maybe_unused]] const Args&... rest) -> const auto& {
static_assert(N < 1 + sizeof...(Args), "index is out of bounds");
if constexpr (N == 0)
return first;
@@ -84,8 +104,8 @@ FMT_CONSTEXPR auto get_arg_index_by_name(basic_string_view name) -> int {
}
template
-constexpr int get_arg_index_by_name(basic_string_view name,
- type_list) {
+constexpr auto get_arg_index_by_name(basic_string_view name,
+ type_list) -> int {
return get_arg_index_by_name(name);
}
@@ -105,8 +125,8 @@ template struct text {
basic_string_view data;
using char_type = Char;
- template
- constexpr OutputIt format(OutputIt out, const Args&...) const {
+ template
+ constexpr auto format(OutputIt out, const T&...) const -> OutputIt {
return write(out, data);
}
};
@@ -115,8 +135,8 @@ template
struct is_compiled_format> : std::true_type {};
template
-constexpr text make_text(basic_string_view s, size_t pos,
- size_t size) {
+constexpr auto make_text(basic_string_view s, size_t pos, size_t size)
+ -> text {
return {{&s[pos], size}};
}
@@ -124,8 +144,8 @@ template struct code_unit {
Char value;
using char_type = Char;
- template
- constexpr OutputIt format(OutputIt out, const Args&...) const {
+ template
+ constexpr auto format(OutputIt out, const T&...) const -> OutputIt {
*out++ = value;
return out;
}
@@ -133,7 +153,7 @@ template struct code_unit {
// This ensures that the argument type is convertible to `const T&`.
template
-constexpr const T& get_arg_checked(const Args&... args) {
+constexpr auto get_arg_checked(const Args&... args) -> const T& {
const auto& arg = detail::get(args...);
if constexpr (detail::is_named_arg>()) {
return arg.value;
@@ -146,13 +166,13 @@ template
struct is_compiled_format> : std::true_type {};
// A replacement field that refers to argument N.
-template struct field {
+template struct field {
using char_type = Char;
- template
- constexpr OutputIt format(OutputIt out, const Args&... args) const {
- const T& arg = get_arg_checked(args...);
- if constexpr (std::is_convertible>::value) {
+ template
+ constexpr auto format(OutputIt out, const T&... args) const -> OutputIt {
+ const V& arg = get_arg_checked(args...);
+ if constexpr (std::is_convertible>::value) {
auto s = basic_string_view(arg);
return copy(s.begin(), s.end(), out);
} else {
@@ -170,10 +190,10 @@ template struct runtime_named_field {
basic_string_view name;
template
- constexpr static bool try_format_argument(
+ constexpr static auto try_format_argument(
OutputIt& out,
// [[maybe_unused]] due to unused-but-set-parameter warning in GCC 7,8,9
- [[maybe_unused]] basic_string_view arg_name, const T& arg) {
+ [[maybe_unused]] basic_string_view arg_name, const T& arg) -> bool {
if constexpr (is_named_arg::type>::value) {
if (arg_name == arg.name) {
out = write(out, arg.value);
@@ -183,8 +203,8 @@ template struct runtime_named_field {
return false;
}
- template
- constexpr OutputIt format(OutputIt out, const Args&... args) const {
+ template
+ constexpr auto format(OutputIt out, const T&... args) const -> OutputIt {
bool found = (try_format_argument(out, name, args) || ...);
if (!found) {
FMT_THROW(format_error("argument with specified name is not found"));
@@ -197,17 +217,17 @@ template