From f7542c5761ffe5ba6078c45b89e83a1afe1f06c2 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 14 Oct 2023 06:52:43 -0700 Subject: [PATCH] Apply clang-format --- include/fmt/core.h | 12 +++++++++--- include/fmt/format-inl.h | 10 +++++----- include/fmt/ostream.h | 4 +++- include/fmt/printf.h | 14 +++++++++----- include/fmt/std.h | 8 +++----- 5 files changed, 29 insertions(+), 19 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index c50822a5..18ebada2 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -265,7 +265,9 @@ template using remove_const_t = typename std::remove_const::type; template using remove_cvref_t = typename std::remove_cv>::type; -template struct type_identity { using type = T; }; +template struct type_identity { + using type = T; +}; template using type_identity_t = typename type_identity::type; template using underlying_t = typename std::underlying_type::type; @@ -1506,7 +1508,9 @@ FMT_CONSTEXPR auto copy_str(R&& rng, OutputIt out) -> OutputIt { #if FMT_GCC_VERSION && FMT_GCC_VERSION < 500 // A workaround for gcc 4.8 to make void_t work in a SFINAE context. -template struct void_t_impl { using type = void; }; +template struct void_t_impl { + using type = void; +}; template using void_t = typename void_t_impl::type; #else template using void_t = void; @@ -2678,7 +2682,9 @@ template struct vformat_args { using type = basic_format_args< basic_format_context>, Char>>; }; -template <> struct vformat_args { using type = format_args; }; +template <> struct vformat_args { + using type = format_args; +}; // Use vformat_args and avoid type_identity to keep symbols short. template diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 1ed7f198..3680794c 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -985,8 +985,7 @@ template <> struct cache_accessor { {0xe0accfa875af45a7, 0x93eb1b80a33b8606}, {0x8c6c01c9498d8b88, 0xbc72f130660533c4}, {0xaf87023b9bf0ee6a, 0xeb8fad7c7f8680b5}, - { 0xdb68c2ca82ed2a05, - 0xa67398db9f6820e2 } + {0xdb68c2ca82ed2a05, 0xa67398db9f6820e2} #else {0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b}, {0xce5d73ff402d98e3, 0xfb0a3d212dc81290}, @@ -1132,7 +1131,7 @@ FMT_INLINE int remove_trailing_zeros(uint32_t& n, int s = 0) noexcept { FMT_ASSERT(n != 0, ""); // Modular inverse of 5 (mod 2^32): (mod_inv_5 * 5) mod 2^32 = 1. constexpr uint32_t mod_inv_5 = 0xcccccccd; - constexpr uint32_t mod_inv_25 = 0xc28f5c29; // = mod_inv_5 * mod_inv_5 + constexpr uint32_t mod_inv_25 = 0xc28f5c29; // = mod_inv_5 * mod_inv_5 while (true) { auto q = rotr(n * mod_inv_25, 2); @@ -1168,7 +1167,7 @@ FMT_INLINE int remove_trailing_zeros(uint64_t& n) noexcept { // If n is not divisible by 10^8, work with n itself. constexpr uint64_t mod_inv_5 = 0xcccccccccccccccd; - constexpr uint64_t mod_inv_25 = 0x8f5c28f5c28f5c29; // = mod_inv_5 * mod_inv_5 + constexpr uint64_t mod_inv_25 = 0x8f5c28f5c28f5c29; // mod_inv_5 * mod_inv_5 int s = 0; while (true) { @@ -1439,7 +1438,8 @@ FMT_FUNC bool write_console(std::FILE* f, string_view text) { auto u16 = utf8_to_utf16(text); auto written = dword(); return WriteConsoleW(reinterpret_cast(_get_osfhandle(fd)), u16.c_str(), - static_cast(u16.size()), &written, nullptr) != 0; + static_cast(u16.size()), &written, + nullptr) != 0; } #endif diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index 7d194227..a5eddcb0 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -89,7 +89,9 @@ void format_value(buffer& buf, const T& value, output.exceptions(std::ios_base::failbit | std::ios_base::badbit); } -template struct streamed_view { const T& value; }; +template struct streamed_view { + const T& value; +}; } // namespace detail diff --git a/include/fmt/printf.h b/include/fmt/printf.h index d82a1350..07e81577 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -16,16 +16,18 @@ FMT_BEGIN_NAMESPACE FMT_BEGIN_EXPORT -template struct printf_formatter { printf_formatter() = delete; }; +template struct printf_formatter { + printf_formatter() = delete; +}; template class basic_printf_context { private: detail::buffer_appender out_; basic_format_args args_; - static_assert( - std::is_same::value || std::is_same::value, - "Unsupported code unit type."); + static_assert(std::is_same::value || + std::is_same::value, + "Unsupported code unit type."); public: using char_type = Char; @@ -106,7 +108,9 @@ struct is_zero_int { template struct make_unsigned_or_bool : std::make_unsigned {}; -template <> struct make_unsigned_or_bool { using type = bool; }; +template <> struct make_unsigned_or_bool { + using type = bool; +}; template class arg_converter { private: diff --git a/include/fmt/std.h b/include/fmt/std.h index 262ad4d2..ff8b7fd3 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -75,8 +75,7 @@ void write_escaped_path(basic_memory_buffer& quoted, } # ifdef _WIN32 -template <> -inline auto get_path_string(const std::filesystem::path& p) { +template <> inline auto get_path_string(const std::filesystem::path& p) { return to_utf8(p.native(), to_utf8_error_policy::replace); } @@ -477,15 +476,14 @@ struct formatter, Char, #ifdef __cpp_lib_atomic_flag_test FMT_EXPORT template -struct formatter - : formatter { +struct formatter : formatter { template auto format(const std::atomic_flag& v, FormatContext& ctx) const -> decltype(ctx.out()) { return formatter::format(v.test(), ctx); } }; -#endif // __cpp_lib_atomic_flag_test +#endif // __cpp_lib_atomic_flag_test FMT_END_NAMESPACE #endif // FMT_STD_H_