From 3e7a29cc9221f7c595c8fc322328d06e4a0bbd9e Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 2 Jul 2021 11:34:42 -0700 Subject: [PATCH] Workaround clang/gcc incompatibility --- include/fmt/color.h | 2 +- include/fmt/core.h | 8 ++++---- include/fmt/format.h | 11 ++++------- include/fmt/xchar.h | 2 +- src/format.cc | 3 +++ 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/fmt/color.h b/include/fmt/color.h index 7fa5490e..3d5490e8 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -507,7 +507,7 @@ void vformat_to(buffer& buf, const text_style& ts, auto background = detail::make_background_color(ts.get_background()); buf.append(background.begin(), background.end()); } - detail::vformat_to(buf, format_str, args); + detail::vformat_to(buf, format_str, args, {}); if (has_style) detail::reset_color(buf); } diff --git a/include/fmt/core.h b/include/fmt/core.h index 22768ff8..2545137c 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -2734,7 +2734,7 @@ template void vformat_to( buffer& buf, basic_string_view fmt, basic_format_args)> args, - detail::locale_ref loc = {}); + locale_ref loc = {}); FMT_API void vprint_mojibake(std::FILE*, string_view, format_args); #ifndef _WIN32 @@ -2892,7 +2892,7 @@ template OutputIt { using detail::get_buffer; auto&& buf = get_buffer(out); - detail::vformat_to(buf, string_view(fmt), args); + detail::vformat_to(buf, string_view(fmt), args, {}); return detail::get_iterator(buf); } @@ -2929,7 +2929,7 @@ auto vformat_to_n(OutputIt out, size_t n, string_view fmt, format_args args) using buffer = detail::iterator_buffer; auto buf = buffer(out, n); - detail::vformat_to(buf, fmt, args); + detail::vformat_to(buf, fmt, args, {}); return {buf.out(), buf.count()}; } @@ -2951,7 +2951,7 @@ FMT_INLINE auto format_to_n(OutputIt out, size_t n, format_string fmt, template FMT_INLINE auto formatted_size(format_string fmt, T&&... args) -> size_t { auto buf = detail::counting_buffer<>(); - detail::vformat_to(buf, string_view(fmt), fmt::make_format_args(args...)); + detail::vformat_to(buf, string_view(fmt), fmt::make_format_args(args...), {}); return buf.count(); } diff --git a/include/fmt/format.h b/include/fmt/format.h index 0024cf7c..5398a23a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2624,9 +2624,10 @@ auto to_string(const basic_memory_buffer& buf) FMT_BEGIN_DETAIL_NAMESPACE template -void vformat_to(buffer& buf, basic_string_view fmt, - basic_format_args>> args, - locale_ref loc) { +void vformat_to( + buffer& buf, basic_string_view fmt, + basic_format_args)> args, + locale_ref loc) { // workaround for msvc bug regarding name-lookup in module // link names into function scope using detail::arg_formatter; @@ -2706,10 +2707,6 @@ void vformat_to(buffer& buf, basic_string_view fmt, } #ifndef FMT_HEADER_ONLY -extern template void vformat_to(detail::buffer&, string_view, - basic_format_args, - detail::locale_ref); - extern template FMT_API auto thousands_sep_impl(locale_ref) -> thousands_sep_result; extern template FMT_API auto thousands_sep_impl(locale_ref) diff --git a/include/fmt/xchar.h b/include/fmt/xchar.h index 74c69045..a0dd032f 100644 --- a/include/fmt/xchar.h +++ b/include/fmt/xchar.h @@ -142,7 +142,7 @@ FMT_DEPRECATED auto format_to(basic_memory_buffer& buf, const S& format_str, Args&&... args) -> typename buffer_context::iterator { const auto& vargs = fmt::make_args_checked(format_str, args...); - detail::vformat_to(buf, to_string_view(format_str), vargs); + detail::vformat_to(buf, to_string_view(format_str), vargs, {}); return detail::buffer_appender(buf); } diff --git a/src/format.cc b/src/format.cc index 187dcb73..66925b42 100644 --- a/src/format.cc +++ b/src/format.cc @@ -47,6 +47,9 @@ template FMT_API char detail::decimal_point_impl(locale_ref); template FMT_API void detail::buffer::append(const char*, const char*); +// DEPRECATED! +// There is no correspondent extern template in format.h because of +// incompatibility between clang and gcc (#2377). template FMT_API void detail::vformat_to( detail::buffer&, string_view, basic_format_args, detail::locale_ref);