diff options
| author | 2025-05-09 19:55:47 +0100 | |
|---|---|---|
| committer | 2025-05-09 19:55:47 +0100 | |
| commit | c2267cde3c8b404fb922ea5d88caff789e93896c (patch) | |
| tree | 12de05f6775a7046d7b4ab3b99ae25f4a3334bfc | |
| parent | Move the auspex check out of the loop in COMMANDS. (diff) | |
Update fmtlib.
| -rw-r--r-- | vendor/README.md | 2 | ||||
| -rw-r--r-- | vendor/fmt/base.h | 97 | ||||
| -rw-r--r-- | vendor/fmt/color.h | 203 | ||||
| -rw-r--r-- | vendor/fmt/core.h | 5 | ||||
| -rw-r--r-- | vendor/fmt/format-inl.h | 7 | ||||
| -rw-r--r-- | vendor/fmt/format.h | 16 | ||||
| -rw-r--r-- | vendor/update.toml | 2 |
7 files changed, 190 insertions, 142 deletions
diff --git a/vendor/README.md b/vendor/README.md index 3363135a5..d21d0a4c4 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -18,7 +18,7 @@ This directory contains vendored dependencies that are shipped with InspIRCd to **License** — MIT License -**Version** — 11.1.4 +**Version** — 11.2.0 **Website** — [https://github.com/fmtlib/fmt/](https://github.com/fmtlib/fmt/) diff --git a/vendor/fmt/base.h b/vendor/fmt/base.h index b886317d6..87b3fd7cb 100644 --- a/vendor/fmt/base.h +++ b/vendor/fmt/base.h @@ -21,7 +21,7 @@ #endif // The fmt library version in the form major * 10000 + minor * 100 + patch. -#define FMT_VERSION 110104 +#define FMT_VERSION 110200 // Detect compiler versions. #if defined(__clang__) && !defined(__ibmxl__) @@ -209,20 +209,6 @@ # define FMT_DEPRECATED /* deprecated */ #endif -#ifdef FMT_ALWAYS_INLINE -// Use the provided definition. -#elif FMT_GCC_VERSION || FMT_CLANG_VERSION -# define FMT_ALWAYS_INLINE inline __attribute__((always_inline)) -#else -# define FMT_ALWAYS_INLINE inline -#endif -// A version of FMT_ALWAYS_INLINE to prevent code bloat in debug mode. -#ifdef NDEBUG -# define FMT_INLINE FMT_ALWAYS_INLINE -#else -# define FMT_INLINE inline -#endif - #if FMT_GCC_VERSION || FMT_CLANG_VERSION # define FMT_VISIBILITY(value) __attribute__((visibility(value))) #else @@ -249,6 +235,28 @@ # define FMT_MSC_WARNING(...) #endif +// Enable minimal optimizations for more compact code in debug mode. +FMT_PRAGMA_GCC(push_options) +#if !defined(__OPTIMIZE__) && !defined(__CUDACC__) && !defined(FMT_MODULE) +FMT_PRAGMA_GCC(optimize("Og")) +# define FMT_GCC_OPTIMIZED +#endif +FMT_PRAGMA_CLANG(diagnostic push) + +#ifdef FMT_ALWAYS_INLINE +// Use the provided definition. +#elif FMT_GCC_VERSION || FMT_CLANG_VERSION +# define FMT_ALWAYS_INLINE inline __attribute__((always_inline)) +#else +# define FMT_ALWAYS_INLINE inline +#endif +// A version of FMT_ALWAYS_INLINE to prevent code bloat in debug mode. +#if defined(NDEBUG) || defined(FMT_GCC_OPTIMIZED) +# define FMT_INLINE FMT_ALWAYS_INLINE +#else +# define FMT_INLINE inline +#endif + #ifndef FMT_BEGIN_NAMESPACE # define FMT_BEGIN_NAMESPACE \ namespace fmt { \ @@ -297,13 +305,6 @@ using unused = int[]; \ (void)unused { 0, (expr, 0)... } -// Enable minimal optimizations for more compact code in debug mode. -FMT_PRAGMA_GCC(push_options) -#if !defined(__OPTIMIZE__) && !defined(__CUDACC__) && !defined(FMT_MODULE) -FMT_PRAGMA_GCC(optimize("Og")) -#endif -FMT_PRAGMA_CLANG(diagnostic push) - FMT_BEGIN_NAMESPACE // Implementations of enable_if_t and other metafunctions for older systems. @@ -325,8 +326,8 @@ using underlying_t = typename std::underlying_type<T>::type; template <typename T> using decay_t = typename std::decay<T>::type; using nullptr_t = decltype(nullptr); -#if FMT_GCC_VERSION && FMT_GCC_VERSION < 500 -// A workaround for gcc 4.9 to make void_t work in a SFINAE context. +#if (FMT_GCC_VERSION && FMT_GCC_VERSION < 500) || FMT_MSC_VERSION +// A workaround for gcc 4.9 & MSVC v141 to make void_t work in a SFINAE context. template <typename...> struct void_t_impl { using type = void; }; @@ -526,20 +527,20 @@ template <typename Char> class basic_string_view { constexpr basic_string_view() noexcept : data_(nullptr), size_(0) {} - /// Constructs a string reference object from a C string and a size. + /// Constructs a string view object from a C string and a size. constexpr basic_string_view(const Char* s, size_t count) noexcept : data_(s), size_(count) {} constexpr basic_string_view(nullptr_t) = delete; - /// Constructs a string reference object from a C string. + /// Constructs a string view object from a C string. #if FMT_GCC_VERSION FMT_ALWAYS_INLINE #endif 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<Char, char>::value) { - size_ = __builtin_strlen(detail::narrow(s)); + if (std::is_same<Char, char>::value && !detail::is_constant_evaluated()) { + size_ = __builtin_strlen(detail::narrow(s)); // strlen is not costexpr. return; } #endif @@ -548,7 +549,7 @@ template <typename Char> class basic_string_view { size_ = len; } - /// Constructs a string reference from a `std::basic_string` or a + /// Constructs a string view from a `std::basic_string` or a /// `std::basic_string_view` object. template <typename S, FMT_ENABLE_IF(detail::is_std_string_like<S>::value&& std::is_same< @@ -585,7 +586,6 @@ template <typename Char> class basic_string_view { return starts_with(basic_string_view<Char>(s)); } - // Lexicographically compare this string reference to other. FMT_CONSTEXPR auto compare(basic_string_view other) const -> int { int result = detail::compare(data_, other.data_, min_of(size_, other.size_)); @@ -616,7 +616,7 @@ template <typename Char> class basic_string_view { using string_view = basic_string_view<char>; -/// Specifies if `T` is an extended character type. Can be specialized by users. +// DEPRECATED! Will be merged with is_char and moved to detail. template <typename T> struct is_xchar : std::false_type {}; template <> struct is_xchar<wchar_t> : std::true_type {}; template <> struct is_xchar<char16_t> : std::true_type {}; @@ -625,7 +625,7 @@ template <> struct is_xchar<char32_t> : std::true_type {}; template <> struct is_xchar<char8_t> : std::true_type {}; #endif -// DEPRECATED! Will be replaced with an alias to prevent specializations. +// Specifies if `T` is a character (code unit) type. template <typename T> struct is_char : is_xchar<T> {}; template <> struct is_char<char> : std::true_type {}; @@ -1032,6 +1032,11 @@ enum { struct view {}; +template <typename T, typename Enable = std::true_type> +struct is_view : std::false_type {}; +template <typename T> +struct is_view<T, bool_constant<sizeof(T) != 0>> : std::is_base_of<view, T> {}; + template <typename Char, typename T> struct named_arg; template <typename T> struct is_named_arg : std::false_type {}; template <typename T> struct is_static_named_arg : std::false_type {}; @@ -1064,6 +1069,16 @@ template <typename Char> struct named_arg_info { int id; }; +// named_args is non-const to suppress a bogus -Wmaybe-uninitalized in gcc 13. +template <typename Char> +FMT_CONSTEXPR void check_for_duplicate(named_arg_info<Char>* named_args, + int named_arg_index, + basic_string_view<Char> arg_name) { + for (int i = 0; i < named_arg_index; ++i) { + if (named_args[i].name == arg_name) report_error("duplicate named arg"); + } +} + template <typename Char, typename T, FMT_ENABLE_IF(!is_named_arg<T>::value)> void init_named_arg(named_arg_info<Char>*, int& arg_index, int&, const T&) { ++arg_index; @@ -1071,6 +1086,7 @@ void init_named_arg(named_arg_info<Char>*, int& arg_index, int&, const T&) { template <typename Char, typename T, FMT_ENABLE_IF(is_named_arg<T>::value)> void init_named_arg(named_arg_info<Char>* named_args, int& arg_index, int& named_arg_index, const T& arg) { + check_for_duplicate<Char>(named_args, named_arg_index, arg.name); named_args[named_arg_index++] = {arg.name, arg_index++}; } @@ -1084,12 +1100,13 @@ template <typename T, typename Char, FMT_ENABLE_IF(is_static_named_arg<T>::value)> FMT_CONSTEXPR void init_static_named_arg(named_arg_info<Char>* named_args, int& arg_index, int& named_arg_index) { + check_for_duplicate<Char>(named_args, named_arg_index, T::name); named_args[named_arg_index++] = {T::name, arg_index++}; } // To minimize the number of types we need to deal with, long is translated // either to int or to long long depending on its size. -enum { long_short = sizeof(long) == sizeof(int) }; +enum { long_short = sizeof(long) == sizeof(int) && FMT_BUILTIN_TYPES }; using long_type = conditional_t<long_short, int, long long>; using ulong_type = conditional_t<long_short, unsigned, unsigned long long>; @@ -1706,7 +1723,17 @@ class format_string_checker { -> const Char* { context_.advance_to(begin); if (id >= 0 && id < NUM_ARGS) return parse_funcs_[id](context_); - while (begin != end && *begin != '}') ++begin; + + // If id is out of range, it means we do not know the type and cannot parse + // the format at compile time. Instead, skip over content until we finish + // the format spec, accounting for any nested replacements. + for (int bracket_count = 0; + begin != end && (bracket_count > 0 || *begin != '}'); ++begin) { + if (*begin == '{') + ++bracket_count; + else if (*begin == '}') + --bracket_count; + } return begin; } @@ -2703,7 +2730,7 @@ template <typename... T> struct fstring { template <size_t N> FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const char (&s)[N]) : str(s, N - 1) { using namespace detail; - static_assert(count<(std::is_base_of<view, remove_reference_t<T>>::value && + static_assert(count<(is_view<remove_cvref_t<T>>::value && std::is_reference<T>::value)...>() == 0, "passing views as lvalues is disallowed"); if (FMT_USE_CONSTEVAL) parse_format_string<char>(s, checker(s, arg_pack())); diff --git a/vendor/fmt/color.h b/vendor/fmt/color.h index 2faaf3a06..638f15b43 100644 --- a/vendor/fmt/color.h +++ b/vendor/fmt/color.h @@ -190,11 +190,11 @@ enum class emphasis : uint8_t { // rgb is a struct for red, green and blue colors. // Using the name "rgb" makes some editors show the color in a tooltip. struct rgb { - FMT_CONSTEXPR rgb() : r(0), g(0), b(0) {} - FMT_CONSTEXPR rgb(uint8_t r_, uint8_t g_, uint8_t b_) : r(r_), g(g_), b(b_) {} - FMT_CONSTEXPR rgb(uint32_t hex) + constexpr rgb() : r(0), g(0), b(0) {} + constexpr rgb(uint8_t r_, uint8_t g_, uint8_t b_) : r(r_), g(g_), b(b_) {} + constexpr rgb(uint32_t hex) : r((hex >> 16) & 0xFF), g((hex >> 8) & 0xFF), b(hex & 0xFF) {} - FMT_CONSTEXPR rgb(color hex) + constexpr rgb(color hex) : r((uint32_t(hex) >> 16) & 0xFF), g((uint32_t(hex) >> 8) & 0xFF), b(uint32_t(hex) & 0xFF) {} @@ -205,97 +205,135 @@ struct rgb { namespace detail { -// color is a struct of either a rgb color or a terminal color. +// A bit-packed variant of an RGB color, a terminal color, or unset color. +// see text_style for the bit-packing scheme. struct color_type { - FMT_CONSTEXPR color_type() noexcept : is_rgb(), value{} {} - FMT_CONSTEXPR color_type(color rgb_color) noexcept : is_rgb(true), value{} { - value.rgb_color = static_cast<uint32_t>(rgb_color); - } - FMT_CONSTEXPR color_type(rgb rgb_color) noexcept : is_rgb(true), value{} { - value.rgb_color = (static_cast<uint32_t>(rgb_color.r) << 16) | - (static_cast<uint32_t>(rgb_color.g) << 8) | rgb_color.b; + constexpr color_type() noexcept = default; + constexpr color_type(color rgb_color) noexcept + : value_(static_cast<uint32_t>(rgb_color) | (1 << 24)) {} + constexpr color_type(rgb rgb_color) noexcept + : color_type(static_cast<color>( + (static_cast<uint32_t>(rgb_color.r) << 16) | + (static_cast<uint32_t>(rgb_color.g) << 8) | rgb_color.b)) {} + constexpr color_type(terminal_color term_color) noexcept + : value_(static_cast<uint32_t>(term_color) | (3 << 24)) {} + + constexpr auto is_terminal_color() const noexcept -> bool { + return (value_ & (1 << 25)) != 0; } - FMT_CONSTEXPR color_type(terminal_color term_color) noexcept - : is_rgb(), value{} { - value.term_color = static_cast<uint8_t>(term_color); + + constexpr auto value() const noexcept -> uint32_t { + return value_ & 0xFFFFFF; } - bool is_rgb; - union color_union { - uint8_t term_color; - uint32_t rgb_color; - } value; + + constexpr color_type(uint32_t value) noexcept : value_(value) {} + + uint32_t value_ = 0; }; } // namespace detail /// A text style consisting of foreground and background colors and emphasis. class text_style { + // The information is packed as follows: + // ┌──┐ + // │ 0│─┐ + // │..│ ├── foreground color value + // │23│─┘ + // ├──┤ + // │24│─┬── discriminator for the above value. 00 if unset, 01 if it's + // │25│─┘ an RGB color, or 11 if it's a terminal color (10 is unused) + // ├──┤ + // │26│──── overflow bit, always zero (see below) + // ├──┤ + // │27│─┐ + // │..│ │ + // │50│ │ + // ├──┤ │ + // │51│ ├── background color (same format as the foreground color) + // │52│ │ + // ├──┤ │ + // │53│─┘ + // ├──┤ + // │54│─┐ + // │..│ ├── emphases + // │61│─┘ + // ├──┤ + // │62│─┬── unused + // │63│─┘ + // └──┘ + // The overflow bits are there to make operator|= efficient. + // When ORing, we must throw if, for either the foreground or background, + // one style specifies a terminal color and the other specifies any color + // (terminal or RGB); in other words, if one discriminator is 11 and the + // other is 11 or 01. + // + // We do that check by adding the styles. Consider what adding does to each + // possible pair of discriminators: + // 00 + 00 = 000 + // 01 + 00 = 001 + // 11 + 00 = 011 + // 01 + 01 = 010 + // 11 + 01 = 100 (!!) + // 11 + 11 = 110 (!!) + // In the last two cases, the ones we want to catch, the third bit——the + // overflow bit——is set. Bingo. + // + // We must take into account the possible carry bit from the bits + // before the discriminator. The only potentially problematic case is + // 11 + 00 = 011 (a carry bit would make it 100, not good!), but a carry + // bit is impossible in that case, because 00 (unset color) means the + // 24 bits that precede the discriminator are all zero. + // + // This test can be applied to both colors simultaneously. + public: FMT_CONSTEXPR text_style(emphasis em = emphasis()) noexcept - : set_foreground_color(), set_background_color(), ems(em) {} - - FMT_CONSTEXPR auto operator|=(const text_style& rhs) -> text_style& { - if (!set_foreground_color) { - set_foreground_color = rhs.set_foreground_color; - foreground_color = rhs.foreground_color; - } else if (rhs.set_foreground_color) { - if (!foreground_color.is_rgb || !rhs.foreground_color.is_rgb) - report_error("can't OR a terminal color"); - foreground_color.value.rgb_color |= rhs.foreground_color.value.rgb_color; - } + : style_(static_cast<uint64_t>(em) << 54) {} - if (!set_background_color) { - set_background_color = rhs.set_background_color; - background_color = rhs.background_color; - } else if (rhs.set_background_color) { - if (!background_color.is_rgb || !rhs.background_color.is_rgb) - report_error("can't OR a terminal color"); - background_color.value.rgb_color |= rhs.background_color.value.rgb_color; - } - - ems = static_cast<emphasis>(static_cast<uint8_t>(ems) | - static_cast<uint8_t>(rhs.ems)); + FMT_CONSTEXPR auto operator|=(text_style rhs) -> text_style& { + if (((style_ + rhs.style_) & ((1ULL << 26) | (1ULL << 53))) != 0) + report_error("can't OR a terminal color"); + style_ |= rhs.style_; return *this; } - friend FMT_CONSTEXPR auto operator|(text_style lhs, const text_style& rhs) + friend FMT_CONSTEXPR auto operator|(text_style lhs, text_style rhs) -> text_style { return lhs |= rhs; } + FMT_CONSTEXPR auto operator==(text_style rhs) const noexcept -> bool { + return style_ == rhs.style_; + } + + FMT_CONSTEXPR auto operator!=(text_style rhs) const noexcept -> bool { + return !(*this == rhs); + } + FMT_CONSTEXPR auto has_foreground() const noexcept -> bool { - return set_foreground_color; + return (style_ & (1 << 24)) != 0; } FMT_CONSTEXPR auto has_background() const noexcept -> bool { - return set_background_color; + return (style_ & (1ULL << 51)) != 0; } FMT_CONSTEXPR auto has_emphasis() const noexcept -> bool { - return static_cast<uint8_t>(ems) != 0; + return (style_ >> 54) != 0; } FMT_CONSTEXPR auto get_foreground() const noexcept -> detail::color_type { FMT_ASSERT(has_foreground(), "no foreground specified for this style"); - return foreground_color; + return style_ & 0x3FFFFFF; } FMT_CONSTEXPR auto get_background() const noexcept -> detail::color_type { FMT_ASSERT(has_background(), "no background specified for this style"); - return background_color; + return (style_ >> 27) & 0x3FFFFFF; } FMT_CONSTEXPR auto get_emphasis() const noexcept -> emphasis { FMT_ASSERT(has_emphasis(), "no emphasis specified for this style"); - return ems; + return static_cast<emphasis>(style_ >> 54); } private: - FMT_CONSTEXPR text_style(bool is_foreground, - detail::color_type text_color) noexcept - : set_foreground_color(), set_background_color(), ems() { - if (is_foreground) { - foreground_color = text_color; - set_foreground_color = true; - } else { - background_color = text_color; - set_background_color = true; - } - } + FMT_CONSTEXPR text_style(uint64_t style) noexcept : style_(style) {} friend FMT_CONSTEXPR auto fg(detail::color_type foreground) noexcept -> text_style; @@ -303,23 +341,19 @@ class text_style { friend FMT_CONSTEXPR auto bg(detail::color_type background) noexcept -> text_style; - detail::color_type foreground_color; - detail::color_type background_color; - bool set_foreground_color; - bool set_background_color; - emphasis ems; + uint64_t style_ = 0; }; /// Creates a text style from the foreground (text) color. FMT_CONSTEXPR inline auto fg(detail::color_type foreground) noexcept -> text_style { - return text_style(true, foreground); + return foreground.value_; } /// Creates a text style from the background color. FMT_CONSTEXPR inline auto bg(detail::color_type background) noexcept -> text_style { - return text_style(false, background); + return static_cast<uint64_t>(background.value_) << 27; } FMT_CONSTEXPR inline auto operator|(emphasis lhs, emphasis rhs) noexcept @@ -334,9 +368,9 @@ template <typename Char> struct ansi_color_escape { const char* esc) noexcept { // If we have a terminal color, we need to output another escape code // sequence. - if (!text_color.is_rgb) { + if (text_color.is_terminal_color()) { bool is_background = esc == string_view("\x1b[48;2;"); - uint32_t value = text_color.value.term_color; + uint32_t value = text_color.value(); // Background ASCII codes are the same as the foreground ones but with // 10 more. if (is_background) value += 10u; @@ -360,7 +394,7 @@ template <typename Char> struct ansi_color_escape { for (int i = 0; i < 7; i++) { buffer[i] = static_cast<Char>(esc[i]); } - rgb color(text_color.value.rgb_color); + rgb color(text_color.value()); to_esc(color.r, buffer + 7, ';'); to_esc(color.g, buffer + 11, ';'); to_esc(color.b, buffer + 15, 'm'); @@ -441,32 +475,26 @@ template <typename T> struct styled_arg : view { }; template <typename Char> -void vformat_to(buffer<Char>& buf, const text_style& ts, - basic_string_view<Char> fmt, +void vformat_to(buffer<Char>& buf, text_style ts, basic_string_view<Char> fmt, basic_format_args<buffered_context<Char>> args) { - bool has_style = false; if (ts.has_emphasis()) { - has_style = true; auto emphasis = make_emphasis<Char>(ts.get_emphasis()); buf.append(emphasis.begin(), emphasis.end()); } if (ts.has_foreground()) { - has_style = true; auto foreground = make_foreground_color<Char>(ts.get_foreground()); buf.append(foreground.begin(), foreground.end()); } if (ts.has_background()) { - has_style = true; auto background = make_background_color<Char>(ts.get_background()); buf.append(background.begin(), background.end()); } vformat_to(buf, fmt, args); - if (has_style) reset_color<Char>(buf); + if (ts != text_style()) reset_color<Char>(buf); } } // namespace detail -inline void vprint(FILE* f, const text_style& ts, string_view fmt, - format_args args) { +inline void vprint(FILE* f, text_style ts, string_view fmt, format_args args) { auto buf = memory_buffer(); detail::vformat_to(buf, ts, fmt, args); print(f, FMT_STRING("{}"), string_view(buf.begin(), buf.size())); @@ -482,8 +510,7 @@ inline void vprint(FILE* f, const text_style& ts, string_view fmt, * "Elapsed time: {0:.2f} seconds", 1.23); */ template <typename... T> -void print(FILE* f, const text_style& ts, format_string<T...> fmt, - T&&... args) { +void print(FILE* f, text_style ts, format_string<T...> fmt, T&&... args) { vprint(f, ts, fmt.str, vargs<T...>{{args...}}); } @@ -497,11 +524,11 @@ void print(FILE* f, const text_style& ts, format_string<T...> fmt, * "Elapsed time: {0:.2f} seconds", 1.23); */ template <typename... T> -void print(const text_style& ts, format_string<T...> fmt, T&&... args) { +void print(text_style ts, format_string<T...> fmt, T&&... args) { return print(stdout, ts, fmt, std::forward<T>(args)...); } -inline auto vformat(const text_style& ts, string_view fmt, format_args args) +inline auto vformat(text_style ts, string_view fmt, format_args args) -> std::string { auto buf = memory_buffer(); detail::vformat_to(buf, ts, fmt, args); @@ -521,7 +548,7 @@ inline auto vformat(const text_style& ts, string_view fmt, format_args args) * ``` */ template <typename... T> -inline auto format(const text_style& ts, format_string<T...> fmt, T&&... args) +inline auto format(text_style ts, format_string<T...> fmt, T&&... args) -> std::string { return fmt::vformat(ts, fmt.str, vargs<T...>{{args...}}); } @@ -529,8 +556,8 @@ inline auto format(const text_style& ts, format_string<T...> fmt, T&&... args) /// Formats a string with the given text_style and writes the output to `out`. template <typename OutputIt, FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)> -auto vformat_to(OutputIt out, const text_style& ts, string_view fmt, - format_args args) -> OutputIt { +auto vformat_to(OutputIt out, text_style ts, string_view fmt, format_args args) + -> OutputIt { auto&& buf = detail::get_buffer<char>(out); detail::vformat_to(buf, ts, fmt, args); return detail::get_iterator(buf, out); @@ -548,8 +575,8 @@ auto vformat_to(OutputIt out, const text_style& ts, string_view fmt, */ template <typename OutputIt, typename... T, FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, char>::value)> -inline auto format_to(OutputIt out, const text_style& ts, - format_string<T...> fmt, T&&... args) -> OutputIt { +inline auto format_to(OutputIt out, text_style ts, format_string<T...> fmt, + T&&... args) -> OutputIt { return vformat_to(out, ts, fmt.str, vargs<T...>{{args...}}); } diff --git a/vendor/fmt/core.h b/vendor/fmt/core.h deleted file mode 100644 index 8ca735f0c..000000000 --- a/vendor/fmt/core.h +++ /dev/null @@ -1,5 +0,0 @@ -// This file is only provided for compatibility and may be removed in future -// versions. Use fmt/base.h if you don't need fmt::format and fmt/format.h -// otherwise. - -#include "format.h" diff --git a/vendor/fmt/format-inl.h b/vendor/fmt/format-inl.h index a5b79dbe4..a1e016611 100644 --- a/vendor/fmt/format-inl.h +++ b/vendor/fmt/format-inl.h @@ -212,7 +212,7 @@ inline auto floor_log10_pow2_minus_log10_4_over_3(int e) noexcept -> int { return (e * 631305 - 261663) >> 21; } -FMT_INLINE_VARIABLE constexpr struct { +FMT_INLINE_VARIABLE constexpr struct div_small_pow10_infos_struct { uint32_t divisor; int shift_amount; } div_small_pow10_infos[] = {{10, 16}, {100, 16}}; @@ -1097,7 +1097,7 @@ template <> struct cache_accessor<double> { return {r.high(), r.low() == 0}; } - static auto compute_delta(cache_entry_type const& cache, int beta) noexcept + static auto compute_delta(const cache_entry_type& cache, int beta) noexcept -> uint32_t { return static_cast<uint32_t>(cache.high() >> (64 - 1 - beta)); } @@ -1526,9 +1526,8 @@ template <typename F> class glibc_file : public file_base<F> { } void init_buffer() { - if (this->file_->_IO_write_ptr) return; + if (this->file_->_IO_write_ptr < this->file_->_IO_write_end) return; // Force buffer initialization by placing and removing a char in a buffer. - assume(this->file_->_IO_write_ptr >= this->file_->_IO_write_end); putc_unlocked(0, this->file_); --this->file_->_IO_write_ptr; } diff --git a/vendor/fmt/format.h b/vendor/fmt/format.h index 287e71631..50e571442 100644 --- a/vendor/fmt/format.h +++ b/vendor/fmt/format.h @@ -117,6 +117,7 @@ # define FMT_NOINLINE #endif +// GCC 4.9 doesn't support qualified names in specializations. namespace std { template <typename T> struct iterator_traits<fmt::basic_appender<T>> { using iterator_category = output_iterator_tag; @@ -705,7 +706,7 @@ using is_integer = #if defined(FMT_USE_FLOAT128) // Use the provided definition. -#elif FMT_CLANG_VERSION && FMT_HAS_INCLUDE(<quadmath.h>) +#elif FMT_CLANG_VERSION >= 309 && FMT_HAS_INCLUDE(<quadmath.h>) # define FMT_USE_FLOAT128 1 #elif FMT_GCC_VERSION && defined(_GLIBCXX_USE_FLOAT128) && \ !defined(__STRICT_ANSI__) @@ -721,11 +722,10 @@ struct float128 {}; template <typename T> using is_float128 = std::is_same<T, float128>; -template <typename T> -using is_floating_point = - bool_constant<std::is_floating_point<T>::value || is_float128<T>::value>; +template <typename T> struct is_floating_point : std::is_floating_point<T> {}; +template <> struct is_floating_point<float128> : std::true_type {}; -template <typename T, bool = std::is_floating_point<T>::value> +template <typename T, bool = is_floating_point<T>::value> struct is_fast_float : bool_constant<std::numeric_limits<T>::is_iec559 && sizeof(T) <= sizeof(double)> {}; template <typename T> struct is_fast_float<T, false> : std::false_type {}; @@ -1613,7 +1613,7 @@ constexpr auto convert_float(T value) -> convert_float_result<T> { } template <typename Char, typename OutputIt> -FMT_NOINLINE FMT_CONSTEXPR auto fill(OutputIt it, size_t n, +FMT_CONSTEXPR FMT_NOINLINE auto fill(OutputIt it, size_t n, const basic_specs& specs) -> OutputIt { auto fill_size = specs.fill_size(); if (fill_size == 1) return detail::fill_n(it, n, specs.fill_unit<Char>()); @@ -2472,8 +2472,8 @@ template <typename T> struct has_isfinite<T, enable_if_t<sizeof(std::isfinite(T())) != 0>> : std::true_type {}; -template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value&& - has_isfinite<T>::value)> +template <typename T, + FMT_ENABLE_IF(is_floating_point<T>::value&& has_isfinite<T>::value)> FMT_CONSTEXPR20 auto isfinite(T value) -> bool { constexpr T inf = T(std::numeric_limits<double>::infinity()); if (is_constant_evaluated()) diff --git a/vendor/update.toml b/vendor/update.toml index d3d8583ef..fe8e8247a 100644 --- a/vendor/update.toml +++ b/vendor/update.toml @@ -10,7 +10,7 @@ website = "https://www.openwall.com/crypt/" [fmt] author = "Victor Zverovich and fmt contributors" depth = 2 -files = "{include/fmt/{base,color,compile,core,format,format-inl}.h,LICENSE,src/format.cc}" +files = "{include/fmt/{base,color,compile,format,format-inl}.h,LICENSE,src/format.cc}" git = "https://github.com/fmtlib/fmt/" license = "MIT License" |
