Delete whole FMT_USE_EXTERN_TEMPLATES block and its condition

1. Remove whole `FMT_USE_EXTERN_TEMPLATES` block
(trailing `FMT_UDL_TEMPLATE` block)
````
#ifndef FMT_USE_EXTERN_TEMPLATES
#  ifndef FMT_HEADER_ONLY
#    define FMT_USE_EXTERN_TEMPLATES                           \
      ((FMT_CLANG_VERSION >= 209 && __cplusplus >= 201103L) || \
       (FMT_GCC_VERSION >= 303 && FMT_HAS_GXX_CXX11))
#  else
#    define FMT_USE_EXTERN_TEMPLATES 0
#  endif
#endif
````

2. Delete `FMT_USE_EXTERN_TEMPLATES` condition, only condition, that trailing basic_data class template definition.
````
#if FMT_USE_EXTERN_TEMPLATES
extern template struct basic_data<void>;
#endif
````

3. Replace `FMT_API` with new `FMT_EXTERN_TEMPLATE_API` added in `core.h` for sake of extern template of `basic_data<void>`
This commit is contained in:
denchat 2019-05-02 13:43:14 +07:00 committed by GitHub
parent 4f919b83c2
commit c6e6bfee4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -159,36 +159,6 @@ FMT_END_NAMESPACE
# define FMT_UDL_TEMPLATE 0 # define FMT_UDL_TEMPLATE 0
#endif #endif
#ifndef FMT_USE_EXTERN_TEMPLATES
# ifndef FMT_HEADER_ONLY
# define FMT_USE_EXTERN_TEMPLATES \
((FMT_CLANG_VERSION >= 209 && __cplusplus >= 201103L) || \
(FMT_GCC_VERSION >= 303 && FMT_HAS_GXX_CXX11))
# else
# define FMT_USE_EXTERN_TEMPLATES 0
# endif
#endif
#if FMT_USE_EXTERN_TEMPLATES
# if !defined(FMT_HEADER_ONLY) && defined(_WIN32)
# ifdef FMT_EXPORT
// When DLL exporting an "explicit class template instantiation declaration",
// we should not designate __declspec(dllexport) at both
// - class template definition
// - explicit class template instantiation declaration.
//
// (Instead, designate __declspec(dllexport) somewhere else
// and only at a single point where we have
// the "explicit class template instantiation definition.")
# define FMT_EXTERN_TEMPLATE_HEADER_FILE_API
# endif
# endif
#endif
#ifndef FMT_EXTERN_TEMPLATE_HEADER_FILE_API
// In other cases, we can just follow FMT_API there.
# define FMT_EXTERN_TEMPLATE_HEADER_FILE_API FMT_API
#endif
#if FMT_HAS_GXX_CXX11 || FMT_HAS_FEATURE(cxx_trailing_return) || \ #if FMT_HAS_GXX_CXX11 || FMT_HAS_FEATURE(cxx_trailing_return) || \
FMT_MSC_VER >= 1600 FMT_MSC_VER >= 1600
# define FMT_USE_TRAILING_RETURN 1 # define FMT_USE_TRAILING_RETURN 1
@ -732,7 +702,7 @@ template <typename T> struct int_traits {
// Static data is placed in this class template to allow header-only // Static data is placed in this class template to allow header-only
// configuration. // configuration.
template <typename T = void> struct FMT_EXTERN_TEMPLATE_HEADER_FILE_API basic_data { template <typename T = void> struct FMT_EXTERN_TEMPLATE_API basic_data {
static const uint64_t POWERS_OF_10_64[]; static const uint64_t POWERS_OF_10_64[];
static const uint32_t ZERO_OR_POWERS_OF_10_32[]; static const uint32_t ZERO_OR_POWERS_OF_10_32[];
static const uint64_t ZERO_OR_POWERS_OF_10_64[]; static const uint64_t ZERO_OR_POWERS_OF_10_64[];
@ -746,9 +716,7 @@ template <typename T = void> struct FMT_EXTERN_TEMPLATE_HEADER_FILE_API basic_da
static const wchar_t WRESET_COLOR[5]; static const wchar_t WRESET_COLOR[5];
}; };
#if FMT_USE_EXTERN_TEMPLATES
extern template struct basic_data<void>; extern template struct basic_data<void>;
#endif
// This is a struct rather than a typedef to avoid shadowing warnings in gcc. // This is a struct rather than a typedef to avoid shadowing warnings in gcc.
struct data : basic_data<> {}; struct data : basic_data<> {};