Tag official API for module export (#2235)

* functions
 * classes
 * UDLs
 * other declarations

Export everything in namespace 'fmt' from core.h and format.h
This commit is contained in:
Daniela Engert
2021-04-16 20:04:55 +02:00
committed by GitHub
parent d8910af80d
commit f4bbc54cc4
9 changed files with 73 additions and 1 deletions

View File

@@ -204,6 +204,16 @@
FMT_INLINE_NAMESPACE v7 {
#endif
#ifndef FMT_MODULE_EXPORT
# define FMT_MODULE_EXPORT
#endif
#ifndef FMT_MODULE_EXPORT_BEGIN
# define FMT_MODULE_EXPORT_BEGIN
#endif
#ifndef FMT_MODULE_EXPORT_END
# define FMT_MODULE_EXPORT_END
#endif
#if !defined(FMT_HEADER_ONLY) && defined(_WIN32)
# define FMT_CLASS_API FMT_MSC_WARNING(suppress : 4275)
# ifdef FMT_EXPORT
@@ -370,6 +380,8 @@ namespace internal = detail; // DEPRECATED
compiled with a different ``-std`` option than the client code (which is not
recommended).
*/
FMT_MODULE_EXPORT_BEGIN
template <typename Char> class basic_string_view {
private:
const Char* data_;
@@ -523,6 +535,7 @@ constexpr basic_string_view<typename S::char_type> to_string_view(const S& s) {
return s;
}
FMT_MODULE_EXPORT_END
namespace detail {
void to_string_view(...);
using fmt::v7::to_string_view;
@@ -560,6 +573,7 @@ struct error_handler {
FMT_NORETURN FMT_API void on_error(const char* message);
};
} // namespace detail
FMT_MODULE_EXPORT_BEGIN
/** String's character type. */
template <typename S> using char_t = typename detail::char_t_impl<S>::type;
@@ -668,6 +682,7 @@ template <typename T> struct is_contiguous : std::false_type {};
template <typename Char>
struct is_contiguous<std::basic_string<Char>> : std::true_type {};
FMT_MODULE_EXPORT_END
namespace detail {
// Extracts a reference to the container from back_insert_iterator.
@@ -1285,6 +1300,7 @@ enum { max_packed_args = 62 / packed_arg_bits };
enum : unsigned long long { is_unpacked_bit = 1ULL << 63 };
enum : unsigned long long { has_named_args_bit = 1ULL << 62 };
} // namespace detail
FMT_MODULE_EXPORT_BEGIN
// A formatting argument. It is a trivially copyable/constructible type to
// allow storage in basic_memory_buffer.
@@ -1394,6 +1410,7 @@ FMT_CONSTEXPR_DECL FMT_INLINE auto visit_format_arg(
return vis(monostate());
}
FMT_MODULE_EXPORT_END
namespace detail {
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 500
@@ -1480,6 +1497,7 @@ inline basic_format_arg<Context> make_arg(const T& value) {
return make_arg<Context>(value);
}
} // namespace detail
FMT_MODULE_EXPORT_BEGIN
// Formatting context.
template <typename OutputIt, typename Char> class basic_format_context {
@@ -1536,10 +1554,14 @@ using buffer_context =
using format_context = buffer_context<char>;
using wformat_context = buffer_context<wchar_t>;
FMT_MODULE_EXPORT_END
// Workaround an alias issue: https://stackoverflow.com/q/62767544/471164.
#define FMT_BUFFER_CONTEXT(Char) \
basic_format_context<detail::buffer_appender<Char>, Char>
FMT_MODULE_EXPORT_BEGIN
template <typename T, typename Char = char>
using is_formattable = bool_constant<!std::is_same<
decltype(detail::arg_mapper<buffer_context<Char>>().map(std::declval<T>())),
@@ -1782,6 +1804,7 @@ struct wformat_args : basic_format_args<wformat_context> {
};
#endif
FMT_MODULE_EXPORT_END
namespace detail {
template <typename Char, FMT_ENABLE_IF(!std::is_same<Char, char>::value)>
@@ -1806,6 +1829,7 @@ FMT_API void vprint_mojibake(std::FILE*, string_view, format_args);
inline void vprint_mojibake(std::FILE*, string_view, format_args) {}
#endif
} // namespace detail
FMT_MODULE_EXPORT_BEGIN
/** Formats a string and writes the output to ``out``. */
// GCC 8 and earlier cannot handle std::back_insert_iterator<Container> with
@@ -1954,6 +1978,8 @@ inline void print(const S& format_str, Args&&... args) {
: detail::vprint_mojibake(stdout, to_string_view(format_str),
vargs);
}
FMT_MODULE_EXPORT_END
FMT_GCC_PRAGMA("GCC pop_options")
FMT_END_NAMESPACE