From b2d2d3920b9e8fcdb30c91b13ef8c273fdf7b5a4 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Tue, 12 Dec 2023 14:47:15 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=20Fix=20assumptions=20of=20Unicode?= =?UTF-8?q?=20for=20Clang-on-Windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit — 💡 MSVC fixed this linker errors (at some point); should check for newer versions and just use the char32_t-based version properly. --- include/fmt/chrono.h | 2 +- include/fmt/core.h | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index bed584b6..9ad6d843 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -362,7 +362,7 @@ auto write_encoded_tm_str(OutputIt out, string_view in, const std::locale& loc) if (detail::is_utf8() && loc != get_classic_locale()) { // char16_t and char32_t codecvts are broken in MSVC (linkage errors) and // gcc-4. -#if FMT_MSC_VERSION != 0 || \ +#if FMT_MSC_VERSION < 1932 || \ (defined(__GLIBCXX__) && !defined(_GLIBCXX_USE_DUAL_ABI)) // The _GLIBCXX_USE_DUAL_ABI macro is always defined in libstdc++ from gcc-5 // and newer. diff --git a/include/fmt/core.h b/include/fmt/core.h index d7ca348e..50ca0b3a 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -233,7 +233,13 @@ #endif #ifndef FMT_UNICODE -# define FMT_UNICODE !FMT_MSC_VERSION +# if FMT_CLANG_VERSION +# define FMT_UNICODE 1 +# elif defined(_MSVC_EXECUTION_CHARACTER_SET) && (_MSVC_EXECUTION_CHARACTER_SET == 65001) +# define FMT_UNICODE 1 +# else +# define FMT_UNICODE !FMT_MSC_VERSION +# endif #endif #ifndef FMT_CONSTEVAL