Add a disable wchar support option
On MCUs with a static libstdc++ disabling wchar in the standard library can safe a lot of space. This changes tries to autodetect the wchar_t support on gcc systems. But also allows disabling wchar with a compiler flag.
This commit is contained in:
parent
8ad1c12fb4
commit
06627e186a
@ -249,6 +249,7 @@ int CharTraits<char>::format_float(
|
|||||||
FMT_SNPRINTF(buffer, size, format, width, precision, value);
|
FMT_SNPRINTF(buffer, size, format, width, precision, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
template <typename T>
|
template <typename T>
|
||||||
int CharTraits<wchar_t>::format_float(
|
int CharTraits<wchar_t>::format_float(
|
||||||
wchar_t *buffer, std::size_t size, const wchar_t *format,
|
wchar_t *buffer, std::size_t size, const wchar_t *format,
|
||||||
@ -262,6 +263,7 @@ int CharTraits<wchar_t>::format_float(
|
|||||||
FMT_SWPRINTF(buffer, size, format, width, value) :
|
FMT_SWPRINTF(buffer, size, format, width, value) :
|
||||||
FMT_SWPRINTF(buffer, size, format, width, precision, value);
|
FMT_SWPRINTF(buffer, size, format, width, precision, value);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
const char BasicData<T>::DIGITS[] =
|
const char BasicData<T>::DIGITS[] =
|
||||||
|
|||||||
54
fmt/format.h
54
fmt/format.h
@ -109,6 +109,9 @@ typedef __int64 intmax_t;
|
|||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
|
# define FMT_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||||
# define FMT_GCC_EXTENSION __extension__
|
# define FMT_GCC_EXTENSION __extension__
|
||||||
|
# ifndef _GLIBCXX_USE_WCHAR_T
|
||||||
|
# define FMT_DISABLE_WCHAR_T_SUPPORT
|
||||||
|
# endif
|
||||||
# if FMT_GCC_VERSION >= 406
|
# if FMT_GCC_VERSION >= 406
|
||||||
# pragma GCC diagnostic push
|
# pragma GCC diagnostic push
|
||||||
// Disable the warning about "long long" which is sometimes reported even
|
// Disable the warning about "long long" which is sometimes reported even
|
||||||
@ -148,6 +151,10 @@ typedef __int64 intmax_t;
|
|||||||
# pragma clang diagnostic ignored "-Wpadded"
|
# pragma clang diagnostic ignored "-Wpadded"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FMT_DISABLE_WCHAR_T_SUPPORT
|
||||||
|
#define FMT_HAS_WCHAR_T 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC_LIBSTD__
|
#ifdef __GNUC_LIBSTD__
|
||||||
# define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__)
|
# define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__)
|
||||||
#endif
|
#endif
|
||||||
@ -508,7 +515,9 @@ template <typename Char>
|
|||||||
class BasicWriter;
|
class BasicWriter;
|
||||||
|
|
||||||
typedef BasicWriter<char> Writer;
|
typedef BasicWriter<char> Writer;
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
typedef BasicWriter<wchar_t> WWriter;
|
typedef BasicWriter<wchar_t> WWriter;
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
class ArgFormatter;
|
class ArgFormatter;
|
||||||
@ -661,7 +670,9 @@ class BasicStringRef {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef BasicStringRef<char> StringRef;
|
typedef BasicStringRef<char> StringRef;
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
typedef BasicStringRef<wchar_t> WStringRef;
|
typedef BasicStringRef<wchar_t> WStringRef;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
@ -712,7 +723,9 @@ class BasicCStringRef {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef BasicCStringRef<char> CStringRef;
|
typedef BasicCStringRef<char> CStringRef;
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
typedef BasicCStringRef<wchar_t> WCStringRef;
|
typedef BasicCStringRef<wchar_t> WCStringRef;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** A formatting error such as invalid format string. */
|
/** A formatting error such as invalid format string. */
|
||||||
class FMT_API FormatError : public std::runtime_error {
|
class FMT_API FormatError : public std::runtime_error {
|
||||||
@ -977,6 +990,7 @@ extern template int CharTraits<char>::format_float<long double>
|
|||||||
const char* format, unsigned width, int precision, long double value);
|
const char* format, unsigned width, int precision, long double value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
template <>
|
template <>
|
||||||
class CharTraits<wchar_t> : public BasicCharTraits<wchar_t> {
|
class CharTraits<wchar_t> : public BasicCharTraits<wchar_t> {
|
||||||
public:
|
public:
|
||||||
@ -996,6 +1010,7 @@ extern template int CharTraits<wchar_t>::format_float<long double>
|
|||||||
(wchar_t *buffer, std::size_t size,
|
(wchar_t *buffer, std::size_t size,
|
||||||
const wchar_t* format, unsigned width, int precision, long double value);
|
const wchar_t* format, unsigned width, int precision, long double value);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Checks if a number is negative - used to avoid warnings.
|
// Checks if a number is negative - used to avoid warnings.
|
||||||
template <bool IsSigned>
|
template <bool IsSigned>
|
||||||
@ -1219,7 +1234,9 @@ struct Value {
|
|||||||
StringValue<char> string;
|
StringValue<char> string;
|
||||||
StringValue<signed char> sstring;
|
StringValue<signed char> sstring;
|
||||||
StringValue<unsigned char> ustring;
|
StringValue<unsigned char> ustring;
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
StringValue<wchar_t> wstring;
|
StringValue<wchar_t> wstring;
|
||||||
|
#endif
|
||||||
CustomValue custom;
|
CustomValue custom;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1255,11 +1272,13 @@ struct WCharHelper {
|
|||||||
typedef T Unsupported;
|
typedef T Unsupported;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct WCharHelper<T, wchar_t> {
|
struct WCharHelper<T, wchar_t> {
|
||||||
typedef T Supported;
|
typedef T Supported;
|
||||||
typedef Null<T> Unsupported;
|
typedef Null<T> Unsupported;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef char Yes[1];
|
typedef char Yes[1];
|
||||||
typedef char No[2];
|
typedef char No[2];
|
||||||
@ -1392,6 +1411,7 @@ class MakeValue : public Arg {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
MakeValue(T *value);
|
MakeValue(T *value);
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
// The following methods are private to disallow formatting of wide
|
// The following methods are private to disallow formatting of wide
|
||||||
// characters and strings into narrow strings as in
|
// characters and strings into narrow strings as in
|
||||||
// fmt::format("{}", L"test");
|
// fmt::format("{}", L"test");
|
||||||
@ -1409,16 +1429,19 @@ class MakeValue : public Arg {
|
|||||||
MakeValue(typename WCharHelper<const std::experimental::wstring_view &, Char>::Unsupported);
|
MakeValue(typename WCharHelper<const std::experimental::wstring_view &, Char>::Unsupported);
|
||||||
#endif
|
#endif
|
||||||
MakeValue(typename WCharHelper<WStringRef, Char>::Unsupported);
|
MakeValue(typename WCharHelper<WStringRef, Char>::Unsupported);
|
||||||
|
#endif
|
||||||
|
|
||||||
void set_string(StringRef str) {
|
void set_string(StringRef str) {
|
||||||
string.value = str.data();
|
string.value = str.data();
|
||||||
string.size = str.size();
|
string.size = str.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
void set_string(WStringRef str) {
|
void set_string(WStringRef str) {
|
||||||
wstring.value = str.data();
|
wstring.value = str.data();
|
||||||
wstring.size = str.size();
|
wstring.size = str.size();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Formats an argument of a custom type, such as a user-defined class.
|
// Formats an argument of a custom type, such as a user-defined class.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1491,12 +1514,14 @@ class MakeValue : public Arg {
|
|||||||
static uint64_t type(T) { return Arg::INT; }
|
static uint64_t type(T) { return Arg::INT; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAS_WCHAR_T
|
||||||
#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
|
#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
|
||||||
MakeValue(typename WCharHelper<wchar_t, Char>::Supported value) {
|
MakeValue(typename WCharHelper<wchar_t, Char>::Supported value) {
|
||||||
int_value = value;
|
int_value = value;
|
||||||
}
|
}
|
||||||
static uint64_t type(wchar_t) { return Arg::CHAR; }
|
static uint64_t type(wchar_t) { return Arg::CHAR; }
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#define FMT_MAKE_STR_VALUE(Type, TYPE) \
|
#define FMT_MAKE_STR_VALUE(Type, TYPE) \
|
||||||
MakeValue(Type value) { set_string(value); } \
|
MakeValue(Type value) { set_string(value); } \
|
||||||
@ -1523,17 +1548,18 @@ class MakeValue : public Arg {
|
|||||||
set_string(value); \
|
set_string(value); \
|
||||||
} \
|
} \
|
||||||
static uint64_t type(Type) { return Arg::TYPE; }
|
static uint64_t type(Type) { return Arg::TYPE; }
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
FMT_MAKE_WSTR_VALUE(wchar_t *, WSTRING)
|
FMT_MAKE_WSTR_VALUE(wchar_t *, WSTRING)
|
||||||
FMT_MAKE_WSTR_VALUE(const wchar_t *, WSTRING)
|
FMT_MAKE_WSTR_VALUE(const wchar_t *, WSTRING)
|
||||||
FMT_MAKE_WSTR_VALUE(const std::wstring &, WSTRING)
|
FMT_MAKE_WSTR_VALUE(const std::wstring &, WSTRING)
|
||||||
#if FMT_HAS_STRING_VIEW
|
#ifdef FMT_HAS_STRING_VIEW
|
||||||
FMT_MAKE_WSTR_VALUE(const std::wstring_view &, WSTRING)
|
FMT_MAKE_WSTR_VALUE(const std::wstring_view &, WSTRING)
|
||||||
#endif
|
#endif
|
||||||
#if FMT_HAS_EXPERIMENTAL_STRING_VIEW
|
#if FMT_HAS_EXPERIMENTAL_STRING_VIEW
|
||||||
FMT_MAKE_WSTR_VALUE(const std::experimental::wstring_view &, WSTRING)
|
FMT_MAKE_WSTR_VALUE(const std::experimental::wstring_view &, WSTRING)
|
||||||
#endif
|
#endif
|
||||||
FMT_MAKE_WSTR_VALUE(WStringRef, WSTRING)
|
FMT_MAKE_WSTR_VALUE(WStringRef, WSTRING)
|
||||||
|
#endif
|
||||||
|
|
||||||
FMT_MAKE_VALUE(void *, pointer, POINTER)
|
FMT_MAKE_VALUE(void *, pointer, POINTER)
|
||||||
FMT_MAKE_VALUE(const void *, pointer, POINTER)
|
FMT_MAKE_VALUE(const void *, pointer, POINTER)
|
||||||
@ -1776,10 +1802,12 @@ class ArgVisitor {
|
|||||||
return FMT_DISPATCH(visit_unhandled_arg());
|
return FMT_DISPATCH(visit_unhandled_arg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
/** Visits a wide string argument. **/
|
/** Visits a wide string argument. **/
|
||||||
Result visit_wstring(Arg::StringValue<wchar_t>) {
|
Result visit_wstring(Arg::StringValue<wchar_t>) {
|
||||||
return FMT_DISPATCH(visit_unhandled_arg());
|
return FMT_DISPATCH(visit_unhandled_arg());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Visits a pointer argument. **/
|
/** Visits a pointer argument. **/
|
||||||
Result visit_pointer(const void *) {
|
Result visit_pointer(const void *) {
|
||||||
@ -1825,8 +1853,10 @@ class ArgVisitor {
|
|||||||
return FMT_DISPATCH(visit_cstring(arg.string.value));
|
return FMT_DISPATCH(visit_cstring(arg.string.value));
|
||||||
case Arg::STRING:
|
case Arg::STRING:
|
||||||
return FMT_DISPATCH(visit_string(arg.string));
|
return FMT_DISPATCH(visit_string(arg.string));
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
case Arg::WSTRING:
|
case Arg::WSTRING:
|
||||||
return FMT_DISPATCH(visit_wstring(arg.wstring));
|
return FMT_DISPATCH(visit_wstring(arg.wstring));
|
||||||
|
#endif
|
||||||
case Arg::POINTER:
|
case Arg::POINTER:
|
||||||
return FMT_DISPATCH(visit_pointer(arg.pointer));
|
return FMT_DISPATCH(visit_pointer(arg.pointer));
|
||||||
case Arg::CUSTOM:
|
case Arg::CUSTOM:
|
||||||
@ -2055,10 +2085,12 @@ inline StrFormatSpec<Char> pad(
|
|||||||
return StrFormatSpec<Char>(str, width, fill);
|
return StrFormatSpec<Char>(str, width, fill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
inline StrFormatSpec<wchar_t> pad(
|
inline StrFormatSpec<wchar_t> pad(
|
||||||
const wchar_t *str, unsigned width, char fill = ' ') {
|
const wchar_t *str, unsigned width, char fill = ' ') {
|
||||||
return StrFormatSpec<wchar_t>(str, width, fill);
|
return StrFormatSpec<wchar_t>(str, width, fill);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
@ -2224,11 +2256,13 @@ class ArgFormatterBase : public ArgVisitor<Impl, void> {
|
|||||||
writer_.write_str(value, spec_);
|
writer_.write_str(value, spec_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
using ArgVisitor<Impl, void>::visit_wstring;
|
using ArgVisitor<Impl, void>::visit_wstring;
|
||||||
|
|
||||||
void visit_wstring(internal::Arg::StringValue<Char> value) {
|
void visit_wstring(internal::Arg::StringValue<Char> value) {
|
||||||
writer_.write_str(value, spec_);
|
writer_.write_str(value, spec_);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void visit_pointer(const void *value) {
|
void visit_pointer(const void *value) {
|
||||||
if (spec_.type_ && spec_.type_ != 'p')
|
if (spec_.type_ && spec_.type_ != 'p')
|
||||||
@ -3517,11 +3551,13 @@ inline std::string format(CStringRef format_str, ArgList args) {
|
|||||||
return w.str();
|
return w.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
inline std::wstring format(WCStringRef format_str, ArgList args) {
|
inline std::wstring format(WCStringRef format_str, ArgList args) {
|
||||||
WMemoryWriter w;
|
WMemoryWriter w;
|
||||||
w.write(format_str, args);
|
w.write(format_str, args);
|
||||||
return w.str();
|
return w.str();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
@ -3665,17 +3701,21 @@ inline internal::NamedArgWithType<char, T> arg(StringRef name, const T &arg) {
|
|||||||
return internal::NamedArgWithType<char, T>(name, arg);
|
return internal::NamedArgWithType<char, T>(name, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline internal::NamedArgWithType<wchar_t, T> arg(WStringRef name, const T &arg) {
|
inline internal::NamedArgWithType<wchar_t, T> arg(WStringRef name, const T &arg) {
|
||||||
return internal::NamedArgWithType<wchar_t, T>(name, arg);
|
return internal::NamedArgWithType<wchar_t, T>(name, arg);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// The following two functions are deleted intentionally to disable
|
// The following two functions are deleted intentionally to disable
|
||||||
// nested named arguments as in ``format("{}", arg("a", arg("b", 42)))``.
|
// nested named arguments as in ``format("{}", arg("a", arg("b", 42)))``.
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
void arg(StringRef, const internal::NamedArg<Char>&) FMT_DELETED_OR_UNDEFINED;
|
void arg(StringRef, const internal::NamedArg<Char>&) FMT_DELETED_OR_UNDEFINED;
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
void arg(WStringRef, const internal::NamedArg<Char>&) FMT_DELETED_OR_UNDEFINED;
|
void arg(WStringRef, const internal::NamedArg<Char>&) FMT_DELETED_OR_UNDEFINED;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FMT_GCC_VERSION
|
#if FMT_GCC_VERSION
|
||||||
@ -3812,7 +3852,9 @@ void arg(WStringRef, const internal::NamedArg<Char>&) FMT_DELETED_OR_UNDEFINED;
|
|||||||
|
|
||||||
namespace fmt {
|
namespace fmt {
|
||||||
FMT_VARIADIC(std::string, format, CStringRef)
|
FMT_VARIADIC(std::string, format, CStringRef)
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
FMT_VARIADIC_W(std::wstring, format, WCStringRef)
|
FMT_VARIADIC_W(std::wstring, format, WCStringRef)
|
||||||
|
#endif
|
||||||
FMT_VARIADIC(void, print, CStringRef)
|
FMT_VARIADIC(void, print, CStringRef)
|
||||||
FMT_VARIADIC(void, print, std::FILE *, CStringRef)
|
FMT_VARIADIC(void, print, std::FILE *, CStringRef)
|
||||||
FMT_VARIADIC(void, print_colored, Color, CStringRef)
|
FMT_VARIADIC(void, print_colored, Color, CStringRef)
|
||||||
@ -4118,10 +4160,12 @@ ArgJoin<char, It> join(It first, It last, const BasicCStringRef<char>& sep) {
|
|||||||
return ArgJoin<char, It>(first, last, sep);
|
return ArgJoin<char, It>(first, last, sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
template <typename It>
|
template <typename It>
|
||||||
ArgJoin<wchar_t, It> join(It first, It last, const BasicCStringRef<wchar_t>& sep) {
|
ArgJoin<wchar_t, It> join(It first, It last, const BasicCStringRef<wchar_t>& sep) {
|
||||||
return ArgJoin<wchar_t, It>(first, last, sep);
|
return ArgJoin<wchar_t, It>(first, last, sep);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FMT_HAS_GXX_CXX11 && \
|
#if FMT_HAS_GXX_CXX11 && \
|
||||||
(!FMT_GCC_VERSION || FMT_GCC_VERSION >= 405 || __clang__)
|
(!FMT_GCC_VERSION || FMT_GCC_VERSION >= 405 || __clang__)
|
||||||
@ -4131,12 +4175,14 @@ auto join(const Range& range, const BasicCStringRef<char>& sep)
|
|||||||
return join(std::begin(range), std::end(range), sep);
|
return join(std::begin(range), std::end(range), sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
template <typename Range>
|
template <typename Range>
|
||||||
auto join(const Range& range, const BasicCStringRef<wchar_t>& sep)
|
auto join(const Range& range, const BasicCStringRef<wchar_t>& sep)
|
||||||
-> ArgJoin<wchar_t, decltype(std::begin(range))> {
|
-> ArgJoin<wchar_t, decltype(std::begin(range))> {
|
||||||
return join(std::begin(range), std::end(range), sep);
|
return join(std::begin(range), std::end(range), sep);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename ArgFormatter, typename Char, typename It>
|
template <typename ArgFormatter, typename Char, typename It>
|
||||||
void format_arg(fmt::BasicFormatter<Char, ArgFormatter> &f,
|
void format_arg(fmt::BasicFormatter<Char, ArgFormatter> &f,
|
||||||
@ -4208,8 +4254,10 @@ inline namespace literals {
|
|||||||
*/
|
*/
|
||||||
inline internal::UdlFormat<char>
|
inline internal::UdlFormat<char>
|
||||||
operator"" _format(const char *s, std::size_t) { return {s}; }
|
operator"" _format(const char *s, std::size_t) { return {s}; }
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
inline internal::UdlFormat<wchar_t>
|
inline internal::UdlFormat<wchar_t>
|
||||||
operator"" _format(const wchar_t *s, std::size_t) { return {s}; }
|
operator"" _format(const wchar_t *s, std::size_t) { return {s}; }
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
@ -4223,8 +4271,10 @@ operator"" _format(const wchar_t *s, std::size_t) { return {s}; }
|
|||||||
*/
|
*/
|
||||||
inline internal::UdlArg<char>
|
inline internal::UdlArg<char>
|
||||||
operator"" _a(const char *s, std::size_t) { return {s}; }
|
operator"" _a(const char *s, std::size_t) { return {s}; }
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
inline internal::UdlArg<wchar_t>
|
inline internal::UdlArg<wchar_t>
|
||||||
operator"" _a(const wchar_t *s, std::size_t) { return {s}; }
|
operator"" _a(const wchar_t *s, std::size_t) { return {s}; }
|
||||||
|
#endif
|
||||||
|
|
||||||
} // inline namespace literals
|
} // inline namespace literals
|
||||||
} // namespace fmt
|
} // namespace fmt
|
||||||
|
|||||||
@ -25,7 +25,9 @@ FMT_FUNC int fprintf(std::FILE *f, CStringRef format, ArgList args) {
|
|||||||
#ifndef FMT_HEADER_ONLY
|
#ifndef FMT_HEADER_ONLY
|
||||||
|
|
||||||
template void PrintfFormatter<char>::format(CStringRef format);
|
template void PrintfFormatter<char>::format(CStringRef format);
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
template void PrintfFormatter<wchar_t>::format(WCStringRef format);
|
template void PrintfFormatter<wchar_t>::format(WCStringRef format);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // FMT_HEADER_ONLY
|
#endif // FMT_HEADER_ONLY
|
||||||
|
|
||||||
|
|||||||
@ -524,10 +524,12 @@ inline void printf(Writer &w, CStringRef format, ArgList args) {
|
|||||||
}
|
}
|
||||||
FMT_VARIADIC(void, printf, Writer &, CStringRef)
|
FMT_VARIADIC(void, printf, Writer &, CStringRef)
|
||||||
|
|
||||||
|
#ifdef FMT_HAS_WCHAR_T
|
||||||
inline void printf(WWriter &w, WCStringRef format, ArgList args) {
|
inline void printf(WWriter &w, WCStringRef format, ArgList args) {
|
||||||
PrintfFormatter<wchar_t>(args, w).format(format);
|
PrintfFormatter<wchar_t>(args, w).format(format);
|
||||||
}
|
}
|
||||||
FMT_VARIADIC(void, printf, WWriter &, WCStringRef)
|
FMT_VARIADIC(void, printf, WWriter &, WCStringRef)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\rst
|
\rst
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user