From 172b031a50d6d9bd95a12fc7116c6e6f3b07ac3d Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Sat, 17 Apr 2021 21:39:57 +0700 Subject: [PATCH 1/9] Suppressing clang complain "forward declaration" Clang complains about "forward declaration of template entity" of all basic_data<>'s members that do not have definitions in `format.h` ``` C:/Users/User/AppData/Roaming/fmt-master/include\fmt/format.h:956:25: warning: instantiation of variable 'fmt::detail::basic_data<>::powers_of_10_64' required here, but no definition is available [-Wundefined-var-template] static const uint64_t powers_of_10_64[]; ^ C:/Users/User/AppData/Roaming/fmt-master/include\fmt/format.h:956:25: note: forward declaration of template entity is here C:/Users/User/AppData/Roaming/fmt-master/include\fmt/format.h:956:25: note: add an explicit instantiation declaration to suppress this warning if 'fmt::detail::basic_data<>::powers_of_10_64' is explicitly instantiated in another translation unit ``` --- include/fmt/format.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/fmt/format.h b/include/fmt/format.h index cbb0a766d496..270f118a373a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3887,6 +3887,29 @@ extern template int snprintf_float(long double value, int precision, float_specs specs, buffer& buf); +extern template const uint64_t basic_data::powers_of_10_64[]; +extern template const uint32_t basic_data::zero_or_powers_of_10_32_new[]; +extern template const uint64_t basic_data::zero_or_powers_of_10_64_new[]; +extern template const uint64_t basic_data::grisu_pow10_significands[]; +extern template const int16_t basic_data::grisu_pow10_exponents[]; +extern template const divtest_table_entry basic_data::divtest_table_for_pow5_32[]; +extern template const divtest_table_entry basic_data::divtest_table_for_pow5_64[]; +extern template const uint64_t basic_data::dragonbox_pow10_significands_64[]; +extern template const uint128_wrapper basic_data::dragonbox_pow10_significands_128[]; +#if !FMT_USE_FULL_CACHE_DRAGONBOX +extern template const uint64_t basic_data::powers_of_5_64[]; +extern template const uint32_t basic_data::dragonbox_pow10_recovery_errors[]; +#endif +// GCC generates slightly better code for pairs than chars. +extern template const basic_data::digit_pair basic_data::digits[]; +extern template const char basic_data::foreground_color[]; +extern template const char basic_data::background_color[]; +extern template const char basic_data::reset_color[5]; +extern template const wchar_t basic_data::wreset_color[5]; +extern template const char basic_data::signs[]; +// DEPRECATED! These are for ABI compatibility. +extern template const uint32_t basic_data::zero_or_powers_of_10_32[]; +extern template const uint64_t basic_data::zero_or_powers_of_10_64[]; } // namespace detail #endif From dd5e6dcc31fbf16bf3535c3356e5aef5708420ef Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Sat, 17 Apr 2021 21:47:58 +0700 Subject: [PATCH 2/9] Add FMT_API --- include/fmt/format.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 270f118a373a..11257bdf189a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3887,29 +3887,29 @@ extern template int snprintf_float(long double value, int precision, float_specs specs, buffer& buf); -extern template const uint64_t basic_data::powers_of_10_64[]; -extern template const uint32_t basic_data::zero_or_powers_of_10_32_new[]; -extern template const uint64_t basic_data::zero_or_powers_of_10_64_new[]; -extern template const uint64_t basic_data::grisu_pow10_significands[]; -extern template const int16_t basic_data::grisu_pow10_exponents[]; -extern template const divtest_table_entry basic_data::divtest_table_for_pow5_32[]; -extern template const divtest_table_entry basic_data::divtest_table_for_pow5_64[]; -extern template const uint64_t basic_data::dragonbox_pow10_significands_64[]; -extern template const uint128_wrapper basic_data::dragonbox_pow10_significands_128[]; +extern template FMT_API const uint64_t basic_data::powers_of_10_64[]; +extern template FMT_API const uint32_t basic_data::zero_or_powers_of_10_32_new[]; +extern template FMT_API const uint64_t basic_data::zero_or_powers_of_10_64_new[]; +extern template FMT_API const uint64_t basic_data::grisu_pow10_significands[]; +extern template FMT_API const int16_t basic_data::grisu_pow10_exponents[]; +extern template FMT_API const divtest_table_entry basic_data::divtest_table_for_pow5_32[]; +extern template FMT_API const divtest_table_entry basic_data::divtest_table_for_pow5_64[]; +extern template FMT_API const uint64_t basic_data::dragonbox_pow10_significands_64[]; +extern template FMT_API const uint128_wrapper basic_data::dragonbox_pow10_significands_128[]; #if !FMT_USE_FULL_CACHE_DRAGONBOX -extern template const uint64_t basic_data::powers_of_5_64[]; -extern template const uint32_t basic_data::dragonbox_pow10_recovery_errors[]; +extern template FMT_API const uint64_t basic_data::powers_of_5_64[]; +extern template FMT_API const uint32_t basic_data::dragonbox_pow10_recovery_errors[]; #endif // GCC generates slightly better code for pairs than chars. -extern template const basic_data::digit_pair basic_data::digits[]; -extern template const char basic_data::foreground_color[]; -extern template const char basic_data::background_color[]; -extern template const char basic_data::reset_color[5]; -extern template const wchar_t basic_data::wreset_color[5]; -extern template const char basic_data::signs[]; +extern template FMT_API const basic_data::digit_pair basic_data::digits[]; +extern template FMT_API const char basic_data::foreground_color[]; +extern template FMT_API const char basic_data::background_color[]; +extern template FMT_API const char basic_data::reset_color[5]; +extern template FMT_API const wchar_t basic_data::wreset_color[5]; +extern template FMT_API const char basic_data::signs[]; // DEPRECATED! These are for ABI compatibility. -extern template const uint32_t basic_data::zero_or_powers_of_10_32[]; -extern template const uint64_t basic_data::zero_or_powers_of_10_64[]; +extern template FMT_API const uint32_t basic_data::zero_or_powers_of_10_32[]; +extern template FMT_API const uint64_t basic_data::zero_or_powers_of_10_64[]; } // namespace detail #endif From abb5eb42d99bd3901125278781b450d4ed977559 Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Sat, 17 Apr 2021 21:56:55 +0700 Subject: [PATCH 3/9] Remove FMT_API Remove FMT_API. Try hiding the extern template's members declaration from msvc instead. --- include/fmt/format.h | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 11257bdf189a..3d340ea85aa0 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3887,29 +3887,31 @@ extern template int snprintf_float(long double value, int precision, float_specs specs, buffer& buf); -extern template FMT_API const uint64_t basic_data::powers_of_10_64[]; -extern template FMT_API const uint32_t basic_data::zero_or_powers_of_10_32_new[]; -extern template FMT_API const uint64_t basic_data::zero_or_powers_of_10_64_new[]; -extern template FMT_API const uint64_t basic_data::grisu_pow10_significands[]; -extern template FMT_API const int16_t basic_data::grisu_pow10_exponents[]; -extern template FMT_API const divtest_table_entry basic_data::divtest_table_for_pow5_32[]; -extern template FMT_API const divtest_table_entry basic_data::divtest_table_for_pow5_64[]; -extern template FMT_API const uint64_t basic_data::dragonbox_pow10_significands_64[]; -extern template FMT_API const uint128_wrapper basic_data::dragonbox_pow10_significands_128[]; -#if !FMT_USE_FULL_CACHE_DRAGONBOX -extern template FMT_API const uint64_t basic_data::powers_of_5_64[]; -extern template FMT_API const uint32_t basic_data::dragonbox_pow10_recovery_errors[]; -#endif +#ifndef _MSC_VER +extern template const uint64_t basic_data::powers_of_10_64[]; +extern template const uint32_t basic_data::zero_or_powers_of_10_32_new[]; +extern template const uint64_t basic_data::zero_or_powers_of_10_64_new[]; +extern template const uint64_t basic_data::grisu_pow10_significands[]; +extern template const int16_t basic_data::grisu_pow10_exponents[]; +extern template const divtest_table_entry basic_data::divtest_table_for_pow5_32[]; +extern template const divtest_table_entry basic_data::divtest_table_for_pow5_64[]; +extern template const uint64_t basic_data::dragonbox_pow10_significands_64[]; +extern template const uint128_wrapper basic_data::dragonbox_pow10_significands_128[]; +# if !FMT_USE_FULL_CACHE_DRAGONBOX +extern template const uint64_t basic_data::powers_of_5_64[]; +extern template const uint32_t basic_data::dragonbox_pow10_recovery_errors[]; +# endif // GCC generates slightly better code for pairs than chars. -extern template FMT_API const basic_data::digit_pair basic_data::digits[]; -extern template FMT_API const char basic_data::foreground_color[]; -extern template FMT_API const char basic_data::background_color[]; -extern template FMT_API const char basic_data::reset_color[5]; -extern template FMT_API const wchar_t basic_data::wreset_color[5]; -extern template FMT_API const char basic_data::signs[]; +extern template const basic_data::digit_pair basic_data::digits[]; +extern template const char basic_data::foreground_color[]; +extern template const char basic_data::background_color[]; +extern template const char basic_data::reset_color[5]; +extern template const wchar_t basic_data::wreset_color[5]; +extern template const char basic_data::signs[]; // DEPRECATED! These are for ABI compatibility. -extern template FMT_API const uint32_t basic_data::zero_or_powers_of_10_32[]; -extern template FMT_API const uint64_t basic_data::zero_or_powers_of_10_64[]; +extern template const uint32_t basic_data::zero_or_powers_of_10_32[]; +extern template const uint64_t basic_data::zero_or_powers_of_10_64[]; +#endif // #ifndef _MSC_VER } // namespace detail #endif From 4b8ea7dc44f46e6f879104546d1890d00750588c Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Sun, 18 Apr 2021 12:11:55 +0700 Subject: [PATCH 4/9] Added FMT_INSTANTIATION_DECL_API - Added FMT_INSTANTIATION_DECL_API - Added non-msvc filter - Added msvc non-export filter --- include/fmt/format.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 3d340ea85aa0..d21c4b6a8ebf 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3887,31 +3887,31 @@ extern template int snprintf_float(long double value, int precision, float_specs specs, buffer& buf); -#ifndef _MSC_VER -extern template const uint64_t basic_data::powers_of_10_64[]; -extern template const uint32_t basic_data::zero_or_powers_of_10_32_new[]; -extern template const uint64_t basic_data::zero_or_powers_of_10_64_new[]; -extern template const uint64_t basic_data::grisu_pow10_significands[]; -extern template const int16_t basic_data::grisu_pow10_exponents[]; -extern template const divtest_table_entry basic_data::divtest_table_for_pow5_32[]; -extern template const divtest_table_entry basic_data::divtest_table_for_pow5_64[]; -extern template const uint64_t basic_data::dragonbox_pow10_significands_64[]; -extern template const uint128_wrapper basic_data::dragonbox_pow10_significands_128[]; +#if !defined(FMT_EXPORTED) || !defined(_MSC_VER) +extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::powers_of_10_64[]; +extern template FMT_INSTANTIATION_DECL_API const uint32_t basic_data::zero_or_powers_of_10_32_new[]; +extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::zero_or_powers_of_10_64_new[]; +extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::grisu_pow10_significands[]; +extern template FMT_INSTANTIATION_DECL_API const int16_t basic_data::grisu_pow10_exponents[]; +extern template FMT_INSTANTIATION_DECL_API const divtest_table_entry basic_data::divtest_table_for_pow5_32[]; +extern template FMT_INSTANTIATION_DECL_API const divtest_table_entry basic_data::divtest_table_for_pow5_64[]; +extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::dragonbox_pow10_significands_64[]; +extern template FMT_INSTANTIATION_DECL_API const uint128_wrapper basic_data::dragonbox_pow10_significands_128[]; # if !FMT_USE_FULL_CACHE_DRAGONBOX -extern template const uint64_t basic_data::powers_of_5_64[]; -extern template const uint32_t basic_data::dragonbox_pow10_recovery_errors[]; +extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::powers_of_5_64[]; +extern template FMT_INSTANTIATION_DECL_API const uint32_t basic_data::dragonbox_pow10_recovery_errors[]; # endif // GCC generates slightly better code for pairs than chars. -extern template const basic_data::digit_pair basic_data::digits[]; -extern template const char basic_data::foreground_color[]; -extern template const char basic_data::background_color[]; -extern template const char basic_data::reset_color[5]; -extern template const wchar_t basic_data::wreset_color[5]; -extern template const char basic_data::signs[]; +extern template FMT_INSTANTIATION_DECL_API const basic_data::digit_pair basic_data::digits[]; +extern template FMT_INSTANTIATION_DECL_API const char basic_data::foreground_color[]; +extern template FMT_INSTANTIATION_DECL_API const char basic_data::background_color[]; +extern template FMT_INSTANTIATION_DECL_API const char basic_data::reset_color[5]; +extern template FMT_INSTANTIATION_DECL_API const wchar_t basic_data::wreset_color[5]; +extern template FMT_INSTANTIATION_DECL_API const char basic_data::signs[]; // DEPRECATED! These are for ABI compatibility. -extern template const uint32_t basic_data::zero_or_powers_of_10_32[]; -extern template const uint64_t basic_data::zero_or_powers_of_10_64[]; -#endif // #ifndef _MSC_VER +extern template FMT_INSTANTIATION_DECL_API const uint32_t basic_data::zero_or_powers_of_10_32[]; +extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::zero_or_powers_of_10_64[]; +#endif // #if !defined(FMT_EXPORTED) || !defined(MSC_VER_) } // namespace detail #endif From 95d2a3989c7c37cff8188fe014f92e82ab55776b Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Sun, 18 Apr 2021 12:27:24 +0700 Subject: [PATCH 5/9] Added FMT_INSTANTIATION_DEF_API Added FMT_INSTANTIATION_DEF_API in definition in format-inl.h --- include/fmt/format-inl.h | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index c6fb6e1257f6..9ca0eccddc61 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -223,7 +223,7 @@ template <> FMT_FUNC int count_digits<4>(detail::fallback_uintptr n) { return i >= 0 ? i * char_digits + count_digits<4, unsigned>(n.value[i]) : 1; } -template +template FMT_INSTANTIATION_DEF_API const typename basic_data::digit_pair basic_data::digits[] = { {'0', '0'}, {'0', '1'}, {'0', '2'}, {'0', '3'}, {'0', '4'}, {'0', '5'}, {'0', '6'}, {'0', '7'}, {'0', '8'}, {'0', '9'}, {'1', '0'}, {'1', '1'}, @@ -248,31 +248,31 @@ const typename basic_data::digit_pair basic_data::digits[] = { (factor)*1000000, (factor)*10000000, (factor)*100000000, \ (factor)*1000000000 -template +template FMT_INSTANTIATION_DEF_API const uint64_t basic_data::powers_of_10_64[] = { 1, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL), 10000000000000000000ULL}; -template +template FMT_INSTANTIATION_DEF_API const uint32_t basic_data::zero_or_powers_of_10_32[] = {0, FMT_POWERS_OF_10(1)}; -template +template FMT_INSTANTIATION_DEF_API const uint64_t basic_data::zero_or_powers_of_10_64[] = { 0, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL), 10000000000000000000ULL}; -template +template FMT_INSTANTIATION_DEF_API const uint32_t basic_data::zero_or_powers_of_10_32_new[] = { 0, 0, FMT_POWERS_OF_10(1)}; -template +template FMT_INSTANTIATION_DEF_API const uint64_t basic_data::zero_or_powers_of_10_64_new[] = { 0, 0, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL), 10000000000000000000ULL}; // Normalized 64-bit significands of pow(10, k), for k = -348, -340, ..., 340. // These are generated by support/compute-powers.py. -template +template FMT_INSTANTIATION_DEF_API const uint64_t basic_data::grisu_pow10_significands[] = { 0xfa8fd5a0081c0288, 0xbaaee17fa23ebf76, 0x8b16fb203055ac76, 0xcf42894a5dce35ea, 0x9a6bb0aa55653b2d, 0xe61acf033d1a45df, @@ -307,7 +307,7 @@ const uint64_t basic_data::grisu_pow10_significands[] = { // Binary exponents of pow(10, k), for k = -348, -340, ..., 340, corresponding // to significands above. -template +template FMT_INSTANTIATION_DEF_API const int16_t basic_data::grisu_pow10_exponents[] = { -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, -954, -927, -901, -874, -847, -821, -794, -768, -741, -715, -688, -661, @@ -318,7 +318,7 @@ const int16_t basic_data::grisu_pow10_exponents[] = { 534, 561, 588, 614, 641, 667, 694, 720, 747, 774, 800, 827, 853, 880, 907, 933, 960, 986, 1013, 1039, 1066}; -template +template FMT_INSTANTIATION_DEF_API const divtest_table_entry basic_data::divtest_table_for_pow5_32[] = {{0x00000001, 0xffffffff}, {0xcccccccd, 0x33333333}, {0xc28f5c29, 0x0a3d70a3}, {0x26e978d5, 0x020c49ba}, @@ -327,7 +327,7 @@ const divtest_table_entry basic_data::divtest_table_for_pow5_32[] = {0x22e90e21, 0x00002af3}, {0x3a2e9c6d, 0x00000897}, {0x3ed61f49, 0x000001b7}}; -template +template FMT_INSTANTIATION_DEF_API const divtest_table_entry basic_data::divtest_table_for_pow5_64[] = {{0x0000000000000001, 0xffffffffffffffff}, {0xcccccccccccccccd, 0x3333333333333333}, @@ -354,7 +354,7 @@ const divtest_table_entry basic_data::divtest_table_for_pow5_64[] = {0x502e79bf1b6f4f79, 0x0000000000001e39}, {0xdcd618596be30fe5, 0x000000000000060b}}; -template +template FMT_INSTANTIATION_DEF_API const uint64_t basic_data::dragonbox_pow10_significands_64[] = { 0x81ceb32c4b43fcf5, 0xa2425ff75e14fc32, 0xcad2f7f5359a3b3f, 0xfd87b5f28300ca0e, 0x9e74d1b791e07e49, 0xc612062576589ddb, @@ -383,7 +383,7 @@ const uint64_t basic_data::dragonbox_pow10_significands_64[] = { 0x92efd1b8d0cf37be, 0xb7abc627050305ad, 0xe596b7b0c643c719, 0x8f7e32ce7bea5c6f, 0xb35dbf821ae4f38b, 0xe0352f62a19e306e}; -template +template FMT_INSTANTIATION_DEF_API const uint128_wrapper basic_data::dragonbox_pow10_significands_128[] = { #if FMT_USE_FULL_CACHE_DRAGONBOX {0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b}, @@ -1045,7 +1045,7 @@ const uint64_t basic_data::powers_of_5_64[] = { 0x0001b1ae4d6e2ef5, 0x000878678326eac9, 0x002a5a058fc295ed, 0x00d3c21bcecceda1, 0x0422ca8b0a00a425, 0x14adf4b7320334b9}; -template +template FMT_INSTANTIATION_DEF_API const uint32_t basic_data::dragonbox_pow10_recovery_errors[] = { 0x50001400, 0x54044100, 0x54014555, 0x55954415, 0x54115555, 0x00000001, 0x50000000, 0x00104000, 0x54010004, 0x05004001, 0x55555544, 0x41545555, @@ -1056,19 +1056,19 @@ const uint32_t basic_data::dragonbox_pow10_recovery_errors[] = { 0x69514555, 0x05151109, 0x00155555}; #endif -template +template FMT_INSTANTIATION_DEF_API const char basic_data::foreground_color[] = "\x1b[38;2;"; -template +template FMT_INSTANTIATION_DEF_API const char basic_data::background_color[] = "\x1b[48;2;"; -template const char basic_data::reset_color[] = "\x1b[0m"; -template const wchar_t basic_data::wreset_color[] = L"\x1b[0m"; -template const char basic_data::signs[] = {0, '-', '+', ' '}; +template FMT_INSTANTIATION_DEF_API const char basic_data::reset_color[] = "\x1b[0m"; +template FMT_INSTANTIATION_DEF_API const wchar_t basic_data::wreset_color[] = L"\x1b[0m"; +template FMT_INSTANTIATION_DEF_API const char basic_data::signs[] = {0, '-', '+', ' '}; #if __cplusplus < 201703L -template constexpr const char basic_data::hex_digits[]; -template constexpr const unsigned basic_data::prefixes[]; -template constexpr const char basic_data::left_padding_shifts[]; -template +template FMT_INSTANTIATION_DEF_API constexpr const char basic_data::hex_digits[]; +template FMT_INSTANTIATION_DEF_API constexpr const unsigned basic_data::prefixes[]; +template FMT_INSTANTIATION_DEF_API constexpr const char basic_data::left_padding_shifts[]; +template FMT_INSTANTIATION_DEF_API constexpr const char basic_data::right_padding_shifts[]; #endif From 4de960fa1eddd9b60b203dda3060cf5d3418b0a4 Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Sun, 18 Apr 2021 12:54:59 +0700 Subject: [PATCH 6/9] Hide instantiation declarations from msvc --- include/fmt/format.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index d21c4b6a8ebf..4dc3f0e22aad 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3887,7 +3887,7 @@ extern template int snprintf_float(long double value, int precision, float_specs specs, buffer& buf); -#if !defined(FMT_EXPORTED) || !defined(_MSC_VER) +#ifndef MSC_VER_ extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::powers_of_10_64[]; extern template FMT_INSTANTIATION_DECL_API const uint32_t basic_data::zero_or_powers_of_10_32_new[]; extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::zero_or_powers_of_10_64_new[]; @@ -3911,7 +3911,7 @@ extern template FMT_INSTANTIATION_DECL_API const char basic_data::signs[]; // DEPRECATED! These are for ABI compatibility. extern template FMT_INSTANTIATION_DECL_API const uint32_t basic_data::zero_or_powers_of_10_32[]; extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::zero_or_powers_of_10_64[]; -#endif // #if !defined(FMT_EXPORTED) || !defined(MSC_VER_) +#endif // #ifndef MSC_VER_ } // namespace detail #endif From beb41d4f377e31b912cc8fea1031108046a0ba39 Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Sun, 18 Apr 2021 13:09:27 +0700 Subject: [PATCH 7/9] Remove FMT_INSTANTIATION_DEF_API. --- include/fmt/format-inl.h | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/include/fmt/format-inl.h b/include/fmt/format-inl.h index 9ca0eccddc61..c6fb6e1257f6 100644 --- a/include/fmt/format-inl.h +++ b/include/fmt/format-inl.h @@ -223,7 +223,7 @@ template <> FMT_FUNC int count_digits<4>(detail::fallback_uintptr n) { return i >= 0 ? i * char_digits + count_digits<4, unsigned>(n.value[i]) : 1; } -template FMT_INSTANTIATION_DEF_API +template const typename basic_data::digit_pair basic_data::digits[] = { {'0', '0'}, {'0', '1'}, {'0', '2'}, {'0', '3'}, {'0', '4'}, {'0', '5'}, {'0', '6'}, {'0', '7'}, {'0', '8'}, {'0', '9'}, {'1', '0'}, {'1', '1'}, @@ -248,31 +248,31 @@ const typename basic_data::digit_pair basic_data::digits[] = { (factor)*1000000, (factor)*10000000, (factor)*100000000, \ (factor)*1000000000 -template FMT_INSTANTIATION_DEF_API +template const uint64_t basic_data::powers_of_10_64[] = { 1, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL), 10000000000000000000ULL}; -template FMT_INSTANTIATION_DEF_API +template const uint32_t basic_data::zero_or_powers_of_10_32[] = {0, FMT_POWERS_OF_10(1)}; -template FMT_INSTANTIATION_DEF_API +template const uint64_t basic_data::zero_or_powers_of_10_64[] = { 0, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL), 10000000000000000000ULL}; -template FMT_INSTANTIATION_DEF_API +template const uint32_t basic_data::zero_or_powers_of_10_32_new[] = { 0, 0, FMT_POWERS_OF_10(1)}; -template FMT_INSTANTIATION_DEF_API +template const uint64_t basic_data::zero_or_powers_of_10_64_new[] = { 0, 0, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL), 10000000000000000000ULL}; // Normalized 64-bit significands of pow(10, k), for k = -348, -340, ..., 340. // These are generated by support/compute-powers.py. -template FMT_INSTANTIATION_DEF_API +template const uint64_t basic_data::grisu_pow10_significands[] = { 0xfa8fd5a0081c0288, 0xbaaee17fa23ebf76, 0x8b16fb203055ac76, 0xcf42894a5dce35ea, 0x9a6bb0aa55653b2d, 0xe61acf033d1a45df, @@ -307,7 +307,7 @@ const uint64_t basic_data::grisu_pow10_significands[] = { // Binary exponents of pow(10, k), for k = -348, -340, ..., 340, corresponding // to significands above. -template FMT_INSTANTIATION_DEF_API +template const int16_t basic_data::grisu_pow10_exponents[] = { -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, -954, -927, -901, -874, -847, -821, -794, -768, -741, -715, -688, -661, @@ -318,7 +318,7 @@ const int16_t basic_data::grisu_pow10_exponents[] = { 534, 561, 588, 614, 641, 667, 694, 720, 747, 774, 800, 827, 853, 880, 907, 933, 960, 986, 1013, 1039, 1066}; -template FMT_INSTANTIATION_DEF_API +template const divtest_table_entry basic_data::divtest_table_for_pow5_32[] = {{0x00000001, 0xffffffff}, {0xcccccccd, 0x33333333}, {0xc28f5c29, 0x0a3d70a3}, {0x26e978d5, 0x020c49ba}, @@ -327,7 +327,7 @@ const divtest_table_entry basic_data::divtest_table_for_pow5_32[] = {0x22e90e21, 0x00002af3}, {0x3a2e9c6d, 0x00000897}, {0x3ed61f49, 0x000001b7}}; -template FMT_INSTANTIATION_DEF_API +template const divtest_table_entry basic_data::divtest_table_for_pow5_64[] = {{0x0000000000000001, 0xffffffffffffffff}, {0xcccccccccccccccd, 0x3333333333333333}, @@ -354,7 +354,7 @@ const divtest_table_entry basic_data::divtest_table_for_pow5_64[] = {0x502e79bf1b6f4f79, 0x0000000000001e39}, {0xdcd618596be30fe5, 0x000000000000060b}}; -template FMT_INSTANTIATION_DEF_API +template const uint64_t basic_data::dragonbox_pow10_significands_64[] = { 0x81ceb32c4b43fcf5, 0xa2425ff75e14fc32, 0xcad2f7f5359a3b3f, 0xfd87b5f28300ca0e, 0x9e74d1b791e07e49, 0xc612062576589ddb, @@ -383,7 +383,7 @@ const uint64_t basic_data::dragonbox_pow10_significands_64[] = { 0x92efd1b8d0cf37be, 0xb7abc627050305ad, 0xe596b7b0c643c719, 0x8f7e32ce7bea5c6f, 0xb35dbf821ae4f38b, 0xe0352f62a19e306e}; -template FMT_INSTANTIATION_DEF_API +template const uint128_wrapper basic_data::dragonbox_pow10_significands_128[] = { #if FMT_USE_FULL_CACHE_DRAGONBOX {0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b}, @@ -1045,7 +1045,7 @@ const uint64_t basic_data::powers_of_5_64[] = { 0x0001b1ae4d6e2ef5, 0x000878678326eac9, 0x002a5a058fc295ed, 0x00d3c21bcecceda1, 0x0422ca8b0a00a425, 0x14adf4b7320334b9}; -template FMT_INSTANTIATION_DEF_API +template const uint32_t basic_data::dragonbox_pow10_recovery_errors[] = { 0x50001400, 0x54044100, 0x54014555, 0x55954415, 0x54115555, 0x00000001, 0x50000000, 0x00104000, 0x54010004, 0x05004001, 0x55555544, 0x41545555, @@ -1056,19 +1056,19 @@ const uint32_t basic_data::dragonbox_pow10_recovery_errors[] = { 0x69514555, 0x05151109, 0x00155555}; #endif -template FMT_INSTANTIATION_DEF_API +template const char basic_data::foreground_color[] = "\x1b[38;2;"; -template FMT_INSTANTIATION_DEF_API +template const char basic_data::background_color[] = "\x1b[48;2;"; -template FMT_INSTANTIATION_DEF_API const char basic_data::reset_color[] = "\x1b[0m"; -template FMT_INSTANTIATION_DEF_API const wchar_t basic_data::wreset_color[] = L"\x1b[0m"; -template FMT_INSTANTIATION_DEF_API const char basic_data::signs[] = {0, '-', '+', ' '}; +template const char basic_data::reset_color[] = "\x1b[0m"; +template const wchar_t basic_data::wreset_color[] = L"\x1b[0m"; +template const char basic_data::signs[] = {0, '-', '+', ' '}; #if __cplusplus < 201703L -template FMT_INSTANTIATION_DEF_API constexpr const char basic_data::hex_digits[]; -template FMT_INSTANTIATION_DEF_API constexpr const unsigned basic_data::prefixes[]; -template FMT_INSTANTIATION_DEF_API constexpr const char basic_data::left_padding_shifts[]; -template FMT_INSTANTIATION_DEF_API +template constexpr const char basic_data::hex_digits[]; +template constexpr const unsigned basic_data::prefixes[]; +template constexpr const char basic_data::left_padding_shifts[]; +template constexpr const char basic_data::right_padding_shifts[]; #endif From 2f888187111b2d9c2c7e3db07711aa1c4af115cc Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Sun, 18 Apr 2021 13:18:37 +0700 Subject: [PATCH 8/9] Fixing misspelled MSC_VER_ --- include/fmt/format.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 4dc3f0e22aad..3b975a34e85a 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3887,7 +3887,7 @@ extern template int snprintf_float(long double value, int precision, float_specs specs, buffer& buf); -#ifndef MSC_VER_ +#ifndef _MSC_VER extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::powers_of_10_64[]; extern template FMT_INSTANTIATION_DECL_API const uint32_t basic_data::zero_or_powers_of_10_32_new[]; extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::zero_or_powers_of_10_64_new[]; From 638061e2c8e21982497a7ba7a395181923cd0468 Mon Sep 17 00:00:00 2001 From: denchat <19730041+denchat@users.noreply.github.com> Date: Mon, 19 Apr 2021 10:22:23 +0700 Subject: [PATCH 9/9] Remove redundant FMT_INSTANTIATION_DECL_API --- include/fmt/format.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 3b975a34e85a..182283cb588f 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3888,29 +3888,29 @@ extern template int snprintf_float(long double value, float_specs specs, buffer& buf); #ifndef _MSC_VER -extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::powers_of_10_64[]; -extern template FMT_INSTANTIATION_DECL_API const uint32_t basic_data::zero_or_powers_of_10_32_new[]; -extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::zero_or_powers_of_10_64_new[]; -extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::grisu_pow10_significands[]; -extern template FMT_INSTANTIATION_DECL_API const int16_t basic_data::grisu_pow10_exponents[]; -extern template FMT_INSTANTIATION_DECL_API const divtest_table_entry basic_data::divtest_table_for_pow5_32[]; -extern template FMT_INSTANTIATION_DECL_API const divtest_table_entry basic_data::divtest_table_for_pow5_64[]; -extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::dragonbox_pow10_significands_64[]; -extern template FMT_INSTANTIATION_DECL_API const uint128_wrapper basic_data::dragonbox_pow10_significands_128[]; +extern template const uint64_t basic_data::powers_of_10_64[]; +extern template const uint32_t basic_data::zero_or_powers_of_10_32_new[]; +extern template const uint64_t basic_data::zero_or_powers_of_10_64_new[]; +extern template const uint64_t basic_data::grisu_pow10_significands[]; +extern template const int16_t basic_data::grisu_pow10_exponents[]; +extern template const divtest_table_entry basic_data::divtest_table_for_pow5_32[]; +extern template const divtest_table_entry basic_data::divtest_table_for_pow5_64[]; +extern template const uint64_t basic_data::dragonbox_pow10_significands_64[]; +extern template const uint128_wrapper basic_data::dragonbox_pow10_significands_128[]; # if !FMT_USE_FULL_CACHE_DRAGONBOX -extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::powers_of_5_64[]; -extern template FMT_INSTANTIATION_DECL_API const uint32_t basic_data::dragonbox_pow10_recovery_errors[]; +extern template const uint64_t basic_data::powers_of_5_64[]; +extern template const uint32_t basic_data::dragonbox_pow10_recovery_errors[]; # endif // GCC generates slightly better code for pairs than chars. -extern template FMT_INSTANTIATION_DECL_API const basic_data::digit_pair basic_data::digits[]; -extern template FMT_INSTANTIATION_DECL_API const char basic_data::foreground_color[]; -extern template FMT_INSTANTIATION_DECL_API const char basic_data::background_color[]; -extern template FMT_INSTANTIATION_DECL_API const char basic_data::reset_color[5]; -extern template FMT_INSTANTIATION_DECL_API const wchar_t basic_data::wreset_color[5]; -extern template FMT_INSTANTIATION_DECL_API const char basic_data::signs[]; +extern template const basic_data::digit_pair basic_data::digits[]; +extern template const char basic_data::foreground_color[]; +extern template const char basic_data::background_color[]; +extern template const char basic_data::reset_color[5]; +extern template const wchar_t basic_data::wreset_color[5]; +extern template const char basic_data::signs[]; // DEPRECATED! These are for ABI compatibility. -extern template FMT_INSTANTIATION_DECL_API const uint32_t basic_data::zero_or_powers_of_10_32[]; -extern template FMT_INSTANTIATION_DECL_API const uint64_t basic_data::zero_or_powers_of_10_64[]; +extern template const uint32_t basic_data::zero_or_powers_of_10_32[]; +extern template const uint64_t basic_data::zero_or_powers_of_10_64[]; #endif // #ifndef MSC_VER_ } // namespace detail #endif