Skip to content

Commit

Permalink
Fix clang warning about ignoring __declspec(dllexport) on basic_data<…
Browse files Browse the repository at this point in the history
…void> template instantitation definition (#2220)
  • Loading branch information
denchat authored Apr 12, 2021
1 parent aec5043 commit 42eccac
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@
#ifndef FMT_EXTERN_TEMPLATE_API
# define FMT_EXTERN_TEMPLATE_API
#endif
#ifndef FMT_INSTANTIATION_DEF_API
# define FMT_INSTANTIATION_DEF_API FMT_API
#ifndef FMT_INSTANTIATION_DECL_API
# define FMT_INSTANTIATION_DECL_API FMT_API
#endif

#ifndef FMT_HEADER_ONLY
Expand Down
4 changes: 1 addition & 3 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -995,9 +995,7 @@ FMT_INLINE uint16_t bsr2log10(int bsr) {
return data[bsr];
}

#ifndef FMT_EXPORTED
FMT_EXTERN template struct basic_data<void>;
#endif
FMT_EXTERN template struct FMT_INSTANTIATION_DECL_API basic_data<void>;

// This is a struct rather than an alias to avoid shadowing warnings in gcc.
struct data : basic_data<> {};
Expand Down
4 changes: 3 additions & 1 deletion src/format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ vformat_to(buffer<char>&, string_view,
type_identity_t<char>>>);
} // namespace detail

template struct FMT_INSTANTIATION_DEF_API detail::basic_data<void>;
// Clang doesn't allow dllexport on template instantiation definitions (LLVM
// D61118).
template struct detail::basic_data<void>;

// Workaround a bug in MSVC2013 that prevents instantiation of format_float.
int (*instantiate_format_float)(double, int, detail::float_specs,
Expand Down

0 comments on commit 42eccac

Please sign in to comment.