Fix missing symbols exposing for fmt data

This commit is contained in:
Wojtek Figat
2021-07-09 22:22:18 +02:00
parent e95010b1b2
commit c6e320b4aa
3 changed files with 10 additions and 37 deletions

View File

@@ -112,40 +112,34 @@ template <> FMT_FUNC int count_digits<4>(internal::fallback_uintptr n) {
return i >= 0 ? i * char_digits + count_digits<4, unsigned>(n.value[i]) : 1;
}
template <typename T>
const char basic_data<T>::digits[] =
const char basic_data::digits[] =
"0001020304050607080910111213141516171819"
"2021222324252627282930313233343536373839"
"4041424344454647484950515253545556575859"
"6061626364656667686970717273747576777879"
"8081828384858687888990919293949596979899";
template <typename T>
const char basic_data<T>::hex_digits[] = "0123456789abcdef";
const char basic_data::hex_digits[] = "0123456789abcdef";
#define FMT_POWERS_OF_10(factor) \
factor * 10, (factor)*100, (factor)*1000, (factor)*10000, (factor)*100000, \
(factor)*1000000, (factor)*10000000, (factor)*100000000, \
(factor)*1000000000
template <typename T>
const uint64_t basic_data<T>::powers_of_10_64[] = {
const uint64_t basic_data::powers_of_10_64[] = {
1, FMT_POWERS_OF_10(1), FMT_POWERS_OF_10(1000000000ULL),
10000000000000000000ULL};
template <typename T>
const uint32_t basic_data<T>::zero_or_powers_of_10_32[] = {0,
const uint32_t basic_data::zero_or_powers_of_10_32[] = {0,
FMT_POWERS_OF_10(1)};
template <typename T>
const uint64_t basic_data<T>::zero_or_powers_of_10_64[] = {
const uint64_t basic_data::zero_or_powers_of_10_64[] = {
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 <typename T>
const uint64_t basic_data<T>::pow10_significands[] = {
const uint64_t basic_data::pow10_significands[] = {
0xfa8fd5a0081c0288, 0xbaaee17fa23ebf76, 0x8b16fb203055ac76,
0xcf42894a5dce35ea, 0x9a6bb0aa55653b2d, 0xe61acf033d1a45df,
0xab70fe17c79ac6ca, 0xff77b1fcbebcdc4f, 0xbe5691ef416bd60c,
@@ -179,8 +173,7 @@ const uint64_t basic_data<T>::pow10_significands[] = {
// Binary exponents of pow(10, k), for k = -348, -340, ..., 340, corresponding
// to significands above.
template <typename T>
const int16_t basic_data<T>::pow10_exponents[] = {
const int16_t basic_data::pow10_exponents[] = {
-1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, -954,
-927, -901, -874, -847, -821, -794, -768, -741, -715, -688, -661,
-635, -608, -582, -555, -529, -502, -475, -449, -422, -396, -369,
@@ -190,13 +183,7 @@ const int16_t basic_data<T>::pow10_exponents[] = {
534, 561, 588, 614, 641, 667, 694, 720, 747, 774, 800,
827, 853, 880, 907, 933, 960, 986, 1013, 1039, 1066};
template <typename T>
const char basic_data<T>::foreground_color[] = "\x1b[38;2;";
template <typename T>
const char basic_data<T>::background_color[] = "\x1b[48;2;";
template <typename T> const char basic_data<T>::reset_color[] = "\x1b[0m";
template <typename T> const wchar_t basic_data<T>::wreset_color[] = L"\x1b[0m";
template <typename T> const char basic_data<T>::signs[] = {0, '-', '+', ' '};
const char basic_data::signs[] = {0, '-', '+', ' '};
template <typename T> struct bits {
static FMT_CONSTEXPR_DECL const int value =

View File

@@ -121,13 +121,6 @@ template FMT_API char* internal::sprintf_format(long double,
internal::buffer<char>&,
sprintf_specs);
template struct FMT_INSTANTIATION_DEF_API internal::basic_data<void>;
// Workaround a bug in MSVC2013 that prevents instantiation of format_float.
int (*instantiate_format_float)(double, int, internal::float_specs,
internal::buffer<char>&) =
internal::format_float;
#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
template FMT_API internal::locale_ref::locale_ref(const std::locale& loc);
template FMT_API std::locale internal::locale_ref::get<std::locale>() const;

View File

@@ -587,7 +587,7 @@ using uint32_or_64_or_128_t = conditional_t<
conditional_t<std::numeric_limits<T>::digits <= 64, uint64_t, uint128_t>>;
// Static data is placed in this class template for the header-only config.
template <typename T = void> struct FMT_EXTERN_TEMPLATE_API basic_data {
struct FMT_API basic_data {
static const uint64_t powers_of_10_64[];
static const uint32_t zero_or_powers_of_10_32[];
static const uint64_t zero_or_powers_of_10_64[];
@@ -595,17 +595,10 @@ template <typename T = void> struct FMT_EXTERN_TEMPLATE_API basic_data {
static const int16_t pow10_exponents[];
static const char digits[];
static const char hex_digits[];
static const char foreground_color[];
static const char background_color[];
static const char reset_color[5];
static const wchar_t wreset_color[5];
static const char signs[];
};
FMT_EXTERN template struct basic_data<void>;
// This is a struct rather than an alias to avoid shadowing warnings in gcc.
struct data : basic_data<> {};
typedef basic_data data;
#ifdef FMT_BUILTIN_CLZLL
// Returns the number of decimal digits in n. Leading zeros are not counted