From 563cbb6c212f170e8c9d969f23aa998e504ff975 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 31 Oct 2020 07:51:39 -0700 Subject: [PATCH] Add a macro to workaround clang/gcc ABI incompatibility on ARM --- include/fmt/core.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 4278f0e1..a962f375 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -1929,7 +1929,14 @@ template class basic_format_args { } }; -/** An alias to ``basic_format_args``. */ +#ifdef FMT_ARM_ABI_COMPATIBILITY +/** An alias to ``basic_format_args``. */ +// Separate types would result in shorter symbols but break ABI compatibility +// between clang and gcc on ARM (#1919). +using format_args = basic_format_args; +using wformat_args = basic_format_args; +#else +// DEPRECATED! These are kept for ABI compatibility. // It is a separate type rather than an alias to make symbols readable. struct format_args : basic_format_args { template @@ -1938,6 +1945,7 @@ struct format_args : basic_format_args { struct wformat_args : basic_format_args { using basic_format_args::basic_format_args; }; +#endif namespace detail { @@ -1969,10 +1977,9 @@ inline void vprint_mojibake(std::FILE*, string_view, format_args) {} // vformat_to(...) overload, so SFINAE on iterator type instead. template , bool enable = detail::is_output_iterator::value> -auto vformat_to( - OutputIt out, const S& format_str, - basic_format_args>> args) -> - typename std::enable_if::type { +auto vformat_to(OutputIt out, const S& format_str, + basic_format_args>> args) + -> typename std::enable_if::type { decltype(detail::get_buffer(out)) buf(detail::get_buffer_init(out)); detail::vformat_to(buf, to_string_view(format_str), args); return detail::get_iterator(buf); @@ -2025,8 +2032,8 @@ inline format_to_n_result vformat_to_n( */ template >::value> -inline auto format_to_n(OutputIt out, size_t n, - const S& format_str, const Args&... args) -> +inline auto format_to_n(OutputIt out, size_t n, const S& format_str, + const Args&... args) -> typename std::enable_if>::type { const auto& vargs = fmt::make_args_checked(format_str, args...); return vformat_to_n(out, n, to_string_view(format_str), vargs);