printf.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. // Formatting library for C++ - legacy printf implementation
  2. //
  3. // Copyright (c) 2012 - 2016, Victor Zverovich
  4. // All rights reserved.
  5. //
  6. // For the license information refer to format.h.
  7. #ifndef FMT_PRINTF_H_
  8. #define FMT_PRINTF_H_
  9. #ifndef FMT_MODULE
  10. # include <algorithm> // std::max
  11. # include <limits> // std::numeric_limits
  12. #endif
  13. #include "format.h"
  14. FMT_BEGIN_NAMESPACE
  15. FMT_BEGIN_EXPORT
  16. template <typename T> struct printf_formatter {
  17. printf_formatter() = delete;
  18. };
  19. template <typename Char> class basic_printf_context {
  20. private:
  21. basic_appender<Char> out_;
  22. basic_format_args<basic_printf_context> args_;
  23. static_assert(std::is_same<Char, char>::value ||
  24. std::is_same<Char, wchar_t>::value,
  25. "Unsupported code unit type.");
  26. public:
  27. using char_type = Char;
  28. using parse_context_type = parse_context<Char>;
  29. template <typename T> using formatter_type = printf_formatter<T>;
  30. enum { builtin_types = 1 };
  31. /// Constructs a `printf_context` object. References to the arguments are
  32. /// stored in the context object so make sure they have appropriate lifetimes.
  33. basic_printf_context(basic_appender<Char> out,
  34. basic_format_args<basic_printf_context> args)
  35. : out_(out), args_(args) {}
  36. auto out() -> basic_appender<Char> { return out_; }
  37. void advance_to(basic_appender<Char>) {}
  38. auto locale() -> detail::locale_ref { return {}; }
  39. auto arg(int id) const -> basic_format_arg<basic_printf_context> {
  40. return args_.get(id);
  41. }
  42. };
  43. namespace detail {
  44. // Return the result via the out param to workaround gcc bug 77539.
  45. template <bool IS_CONSTEXPR, typename T, typename Ptr = const T*>
  46. FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr& out) -> bool {
  47. for (out = first; out != last; ++out) {
  48. if (*out == value) return true;
  49. }
  50. return false;
  51. }
  52. template <>
  53. inline auto find<false, char>(const char* first, const char* last, char value,
  54. const char*& out) -> bool {
  55. out =
  56. static_cast<const char*>(memchr(first, value, to_unsigned(last - first)));
  57. return out != nullptr;
  58. }
  59. // Checks if a value fits in int - used to avoid warnings about comparing
  60. // signed and unsigned integers.
  61. template <bool IsSigned> struct int_checker {
  62. template <typename T> static auto fits_in_int(T value) -> bool {
  63. unsigned max = to_unsigned(max_value<int>());
  64. return value <= max;
  65. }
  66. inline static auto fits_in_int(bool) -> bool { return true; }
  67. };
  68. template <> struct int_checker<true> {
  69. template <typename T> static auto fits_in_int(T value) -> bool {
  70. return value >= (std::numeric_limits<int>::min)() &&
  71. value <= max_value<int>();
  72. }
  73. inline static auto fits_in_int(int) -> bool { return true; }
  74. };
  75. struct printf_precision_handler {
  76. template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
  77. auto operator()(T value) -> int {
  78. if (!int_checker<std::numeric_limits<T>::is_signed>::fits_in_int(value))
  79. report_error("number is too big");
  80. return (std::max)(static_cast<int>(value), 0);
  81. }
  82. template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
  83. auto operator()(T) -> int {
  84. report_error("precision is not integer");
  85. return 0;
  86. }
  87. };
  88. // An argument visitor that returns true iff arg is a zero integer.
  89. struct is_zero_int {
  90. template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
  91. auto operator()(T value) -> bool {
  92. return value == 0;
  93. }
  94. template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
  95. auto operator()(T) -> bool {
  96. return false;
  97. }
  98. };
  99. template <typename T> struct make_unsigned_or_bool : std::make_unsigned<T> {};
  100. template <> struct make_unsigned_or_bool<bool> {
  101. using type = bool;
  102. };
  103. template <typename T, typename Context> class arg_converter {
  104. private:
  105. using char_type = typename Context::char_type;
  106. basic_format_arg<Context>& arg_;
  107. char_type type_;
  108. public:
  109. arg_converter(basic_format_arg<Context>& arg, char_type type)
  110. : arg_(arg), type_(type) {}
  111. void operator()(bool value) {
  112. if (type_ != 's') operator()<bool>(value);
  113. }
  114. template <typename U, FMT_ENABLE_IF(std::is_integral<U>::value)>
  115. void operator()(U value) {
  116. bool is_signed = type_ == 'd' || type_ == 'i';
  117. using target_type = conditional_t<std::is_same<T, void>::value, U, T>;
  118. if (const_check(sizeof(target_type) <= sizeof(int))) {
  119. // Extra casts are used to silence warnings.
  120. using unsigned_type = typename make_unsigned_or_bool<target_type>::type;
  121. if (is_signed)
  122. arg_ = static_cast<int>(static_cast<target_type>(value));
  123. else
  124. arg_ = static_cast<unsigned>(static_cast<unsigned_type>(value));
  125. } else {
  126. // glibc's printf doesn't sign extend arguments of smaller types:
  127. // std::printf("%lld", -42); // prints "4294967254"
  128. // but we don't have to do the same because it's a UB.
  129. if (is_signed)
  130. arg_ = static_cast<long long>(value);
  131. else
  132. arg_ = static_cast<typename make_unsigned_or_bool<U>::type>(value);
  133. }
  134. }
  135. template <typename U, FMT_ENABLE_IF(!std::is_integral<U>::value)>
  136. void operator()(U) {} // No conversion needed for non-integral types.
  137. };
  138. // Converts an integer argument to T for printf, if T is an integral type.
  139. // If T is void, the argument is converted to corresponding signed or unsigned
  140. // type depending on the type specifier: 'd' and 'i' - signed, other -
  141. // unsigned).
  142. template <typename T, typename Context, typename Char>
  143. void convert_arg(basic_format_arg<Context>& arg, Char type) {
  144. arg.visit(arg_converter<T, Context>(arg, type));
  145. }
  146. // Converts an integer argument to char for printf.
  147. template <typename Context> class char_converter {
  148. private:
  149. basic_format_arg<Context>& arg_;
  150. public:
  151. explicit char_converter(basic_format_arg<Context>& arg) : arg_(arg) {}
  152. template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
  153. void operator()(T value) {
  154. arg_ = static_cast<typename Context::char_type>(value);
  155. }
  156. template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
  157. void operator()(T) {} // No conversion needed for non-integral types.
  158. };
  159. // An argument visitor that return a pointer to a C string if argument is a
  160. // string or null otherwise.
  161. template <typename Char> struct get_cstring {
  162. template <typename T> auto operator()(T) -> const Char* { return nullptr; }
  163. auto operator()(const Char* s) -> const Char* { return s; }
  164. };
  165. // Checks if an argument is a valid printf width specifier and sets
  166. // left alignment if it is negative.
  167. class printf_width_handler {
  168. private:
  169. format_specs& specs_;
  170. public:
  171. inline explicit printf_width_handler(format_specs& specs) : specs_(specs) {}
  172. template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
  173. auto operator()(T value) -> unsigned {
  174. auto width = static_cast<uint32_or_64_or_128_t<T>>(value);
  175. if (detail::is_negative(value)) {
  176. specs_.set_align(align::left);
  177. width = 0 - width;
  178. }
  179. unsigned int_max = to_unsigned(max_value<int>());
  180. if (width > int_max) report_error("number is too big");
  181. return static_cast<unsigned>(width);
  182. }
  183. template <typename T, FMT_ENABLE_IF(!std::is_integral<T>::value)>
  184. auto operator()(T) -> unsigned {
  185. report_error("width is not integer");
  186. return 0;
  187. }
  188. };
  189. // Workaround for a bug with the XL compiler when initializing
  190. // printf_arg_formatter's base class.
  191. template <typename Char>
  192. auto make_arg_formatter(basic_appender<Char> iter, format_specs& s)
  193. -> arg_formatter<Char> {
  194. return {iter, s, locale_ref()};
  195. }
  196. // The `printf` argument formatter.
  197. template <typename Char>
  198. class printf_arg_formatter : public arg_formatter<Char> {
  199. private:
  200. using base = arg_formatter<Char>;
  201. using context_type = basic_printf_context<Char>;
  202. context_type& context_;
  203. void write_null_pointer(bool is_string = false) {
  204. auto s = this->specs;
  205. s.set_type(presentation_type::none);
  206. write_bytes<Char>(this->out, is_string ? "(null)" : "(nil)", s);
  207. }
  208. template <typename T> void write(T value) {
  209. detail::write<Char>(this->out, value, this->specs, this->locale);
  210. }
  211. public:
  212. printf_arg_formatter(basic_appender<Char> iter, format_specs& s,
  213. context_type& ctx)
  214. : base(make_arg_formatter(iter, s)), context_(ctx) {}
  215. void operator()(monostate value) { write(value); }
  216. template <typename T, FMT_ENABLE_IF(detail::is_integral<T>::value)>
  217. void operator()(T value) {
  218. // MSVC2013 fails to compile separate overloads for bool and Char so use
  219. // std::is_same instead.
  220. if (!std::is_same<T, Char>::value) {
  221. write(value);
  222. return;
  223. }
  224. format_specs s = this->specs;
  225. if (s.type() != presentation_type::none &&
  226. s.type() != presentation_type::chr) {
  227. return (*this)(static_cast<int>(value));
  228. }
  229. s.set_sign(sign::none);
  230. s.clear_alt();
  231. s.set_fill(' '); // Ignore '0' flag for char types.
  232. // align::numeric needs to be overwritten here since the '0' flag is
  233. // ignored for non-numeric types
  234. if (s.align() == align::none || s.align() == align::numeric)
  235. s.set_align(align::right);
  236. detail::write<Char>(this->out, static_cast<Char>(value), s);
  237. }
  238. template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
  239. void operator()(T value) {
  240. write(value);
  241. }
  242. void operator()(const char* value) {
  243. if (value)
  244. write(value);
  245. else
  246. write_null_pointer(this->specs.type() != presentation_type::pointer);
  247. }
  248. void operator()(const wchar_t* value) {
  249. if (value)
  250. write(value);
  251. else
  252. write_null_pointer(this->specs.type() != presentation_type::pointer);
  253. }
  254. void operator()(basic_string_view<Char> value) { write(value); }
  255. void operator()(const void* value) {
  256. if (value)
  257. write(value);
  258. else
  259. write_null_pointer();
  260. }
  261. void operator()(typename basic_format_arg<context_type>::handle handle) {
  262. auto parse_ctx = parse_context<Char>({});
  263. handle.format(parse_ctx, context_);
  264. }
  265. };
  266. template <typename Char>
  267. void parse_flags(format_specs& specs, const Char*& it, const Char* end) {
  268. for (; it != end; ++it) {
  269. switch (*it) {
  270. case '-': specs.set_align(align::left); break;
  271. case '+': specs.set_sign(sign::plus); break;
  272. case '0': specs.set_fill('0'); break;
  273. case ' ':
  274. if (specs.sign() != sign::plus) specs.set_sign(sign::space);
  275. break;
  276. case '#': specs.set_alt(); break;
  277. default: return;
  278. }
  279. }
  280. }
  281. template <typename Char, typename GetArg>
  282. auto parse_header(const Char*& it, const Char* end, format_specs& specs,
  283. GetArg get_arg) -> int {
  284. int arg_index = -1;
  285. Char c = *it;
  286. if (c >= '0' && c <= '9') {
  287. // Parse an argument index (if followed by '$') or a width possibly
  288. // preceded with '0' flag(s).
  289. int value = parse_nonnegative_int(it, end, -1);
  290. if (it != end && *it == '$') { // value is an argument index
  291. ++it;
  292. arg_index = value != -1 ? value : max_value<int>();
  293. } else {
  294. if (c == '0') specs.set_fill('0');
  295. if (value != 0) {
  296. // Nonzero value means that we parsed width and don't need to
  297. // parse it or flags again, so return now.
  298. if (value == -1) report_error("number is too big");
  299. specs.width = value;
  300. return arg_index;
  301. }
  302. }
  303. }
  304. parse_flags(specs, it, end);
  305. // Parse width.
  306. if (it != end) {
  307. if (*it >= '0' && *it <= '9') {
  308. specs.width = parse_nonnegative_int(it, end, -1);
  309. if (specs.width == -1) report_error("number is too big");
  310. } else if (*it == '*') {
  311. ++it;
  312. specs.width = static_cast<int>(
  313. get_arg(-1).visit(detail::printf_width_handler(specs)));
  314. }
  315. }
  316. return arg_index;
  317. }
  318. inline auto parse_printf_presentation_type(char c, type t, bool& upper)
  319. -> presentation_type {
  320. using pt = presentation_type;
  321. constexpr auto integral_set = sint_set | uint_set | bool_set | char_set;
  322. switch (c) {
  323. case 'd': return in(t, integral_set) ? pt::dec : pt::none;
  324. case 'o': return in(t, integral_set) ? pt::oct : pt::none;
  325. case 'X': upper = true; FMT_FALLTHROUGH;
  326. case 'x': return in(t, integral_set) ? pt::hex : pt::none;
  327. case 'E': upper = true; FMT_FALLTHROUGH;
  328. case 'e': return in(t, float_set) ? pt::exp : pt::none;
  329. case 'F': upper = true; FMT_FALLTHROUGH;
  330. case 'f': return in(t, float_set) ? pt::fixed : pt::none;
  331. case 'G': upper = true; FMT_FALLTHROUGH;
  332. case 'g': return in(t, float_set) ? pt::general : pt::none;
  333. case 'A': upper = true; FMT_FALLTHROUGH;
  334. case 'a': return in(t, float_set) ? pt::hexfloat : pt::none;
  335. case 'c': return in(t, integral_set) ? pt::chr : pt::none;
  336. case 's': return in(t, string_set | cstring_set) ? pt::string : pt::none;
  337. case 'p': return in(t, pointer_set | cstring_set) ? pt::pointer : pt::none;
  338. default: return pt::none;
  339. }
  340. }
  341. template <typename Char, typename Context>
  342. void vprintf(buffer<Char>& buf, basic_string_view<Char> format,
  343. basic_format_args<Context> args) {
  344. using iterator = basic_appender<Char>;
  345. auto out = iterator(buf);
  346. auto context = basic_printf_context<Char>(out, args);
  347. auto parse_ctx = parse_context<Char>(format);
  348. // Returns the argument with specified index or, if arg_index is -1, the next
  349. // argument.
  350. auto get_arg = [&](int arg_index) {
  351. if (arg_index < 0)
  352. arg_index = parse_ctx.next_arg_id();
  353. else
  354. parse_ctx.check_arg_id(--arg_index);
  355. return detail::get_arg(context, arg_index);
  356. };
  357. const Char* start = parse_ctx.begin();
  358. const Char* end = parse_ctx.end();
  359. auto it = start;
  360. while (it != end) {
  361. if (!find<false, Char>(it, end, '%', it)) {
  362. it = end; // find leaves it == nullptr if it doesn't find '%'.
  363. break;
  364. }
  365. Char c = *it++;
  366. if (it != end && *it == c) {
  367. write(out, basic_string_view<Char>(start, to_unsigned(it - start)));
  368. start = ++it;
  369. continue;
  370. }
  371. write(out, basic_string_view<Char>(start, to_unsigned(it - 1 - start)));
  372. auto specs = format_specs();
  373. specs.set_align(align::right);
  374. // Parse argument index, flags and width.
  375. int arg_index = parse_header(it, end, specs, get_arg);
  376. if (arg_index == 0) report_error("argument not found");
  377. // Parse precision.
  378. if (it != end && *it == '.') {
  379. ++it;
  380. c = it != end ? *it : 0;
  381. if ('0' <= c && c <= '9') {
  382. specs.precision = parse_nonnegative_int(it, end, 0);
  383. } else if (c == '*') {
  384. ++it;
  385. specs.precision =
  386. static_cast<int>(get_arg(-1).visit(printf_precision_handler()));
  387. } else {
  388. specs.precision = 0;
  389. }
  390. }
  391. auto arg = get_arg(arg_index);
  392. // For d, i, o, u, x, and X conversion specifiers, if a precision is
  393. // specified, the '0' flag is ignored
  394. if (specs.precision >= 0 && is_integral_type(arg.type())) {
  395. // Ignore '0' for non-numeric types or if '-' present.
  396. specs.set_fill(' ');
  397. }
  398. if (specs.precision >= 0 && arg.type() == type::cstring_type) {
  399. auto str = arg.visit(get_cstring<Char>());
  400. auto str_end = str + specs.precision;
  401. auto nul = std::find(str, str_end, Char());
  402. auto sv = basic_string_view<Char>(
  403. str, to_unsigned(nul != str_end ? nul - str : specs.precision));
  404. arg = sv;
  405. }
  406. if (specs.alt() && arg.visit(is_zero_int())) specs.clear_alt();
  407. if (specs.fill_unit<Char>() == '0') {
  408. if (is_arithmetic_type(arg.type()) && specs.align() != align::left) {
  409. specs.set_align(align::numeric);
  410. } else {
  411. // Ignore '0' flag for non-numeric types or if '-' flag is also present.
  412. specs.set_fill(' ');
  413. }
  414. }
  415. // Parse length and convert the argument to the required type.
  416. c = it != end ? *it++ : 0;
  417. Char t = it != end ? *it : 0;
  418. switch (c) {
  419. case 'h':
  420. if (t == 'h') {
  421. ++it;
  422. t = it != end ? *it : 0;
  423. convert_arg<signed char>(arg, t);
  424. } else {
  425. convert_arg<short>(arg, t);
  426. }
  427. break;
  428. case 'l':
  429. if (t == 'l') {
  430. ++it;
  431. t = it != end ? *it : 0;
  432. convert_arg<long long>(arg, t);
  433. } else {
  434. convert_arg<long>(arg, t);
  435. }
  436. break;
  437. case 'j': convert_arg<intmax_t>(arg, t); break;
  438. case 'z': convert_arg<size_t>(arg, t); break;
  439. case 't': convert_arg<std::ptrdiff_t>(arg, t); break;
  440. case 'L':
  441. // printf produces garbage when 'L' is omitted for long double, no
  442. // need to do the same.
  443. break;
  444. default: --it; convert_arg<void>(arg, c);
  445. }
  446. // Parse type.
  447. if (it == end) report_error("invalid format string");
  448. char type = static_cast<char>(*it++);
  449. if (is_integral_type(arg.type())) {
  450. // Normalize type.
  451. switch (type) {
  452. case 'i':
  453. case 'u': type = 'd'; break;
  454. case 'c':
  455. arg.visit(char_converter<basic_printf_context<Char>>(arg));
  456. break;
  457. }
  458. }
  459. bool upper = false;
  460. specs.set_type(parse_printf_presentation_type(type, arg.type(), upper));
  461. if (specs.type() == presentation_type::none)
  462. report_error("invalid format specifier");
  463. if (upper) specs.set_upper();
  464. start = it;
  465. // Format argument.
  466. arg.visit(printf_arg_formatter<Char>(out, specs, context));
  467. }
  468. write(out, basic_string_view<Char>(start, to_unsigned(it - start)));
  469. }
  470. } // namespace detail
  471. using printf_context = basic_printf_context<char>;
  472. using wprintf_context = basic_printf_context<wchar_t>;
  473. using printf_args = basic_format_args<printf_context>;
  474. using wprintf_args = basic_format_args<wprintf_context>;
  475. /// Constructs an `format_arg_store` object that contains references to
  476. /// arguments and can be implicitly converted to `printf_args`.
  477. template <typename Char = char, typename... T>
  478. inline auto make_printf_args(T&... args)
  479. -> decltype(fmt::make_format_args<basic_printf_context<Char>>(args...)) {
  480. return fmt::make_format_args<basic_printf_context<Char>>(args...);
  481. }
  482. template <typename Char> struct vprintf_args {
  483. using type = basic_format_args<basic_printf_context<Char>>;
  484. };
  485. template <typename Char>
  486. inline auto vsprintf(basic_string_view<Char> fmt,
  487. typename vprintf_args<Char>::type args)
  488. -> std::basic_string<Char> {
  489. auto buf = basic_memory_buffer<Char>();
  490. detail::vprintf(buf, fmt, args);
  491. return {buf.data(), buf.size()};
  492. }
  493. /**
  494. * Formats `args` according to specifications in `fmt` and returns the result
  495. * as as string.
  496. *
  497. * **Example**:
  498. *
  499. * std::string message = fmt::sprintf("The answer is %d", 42);
  500. */
  501. template <typename S, typename... T, typename Char = detail::char_t<S>>
  502. inline auto sprintf(const S& fmt, const T&... args) -> std::basic_string<Char> {
  503. return vsprintf(detail::to_string_view(fmt),
  504. fmt::make_format_args<basic_printf_context<Char>>(args...));
  505. }
  506. template <typename Char>
  507. inline auto vfprintf(std::FILE* f, basic_string_view<Char> fmt,
  508. typename vprintf_args<Char>::type args) -> int {
  509. auto buf = basic_memory_buffer<Char>();
  510. detail::vprintf(buf, fmt, args);
  511. size_t size = buf.size();
  512. return std::fwrite(buf.data(), sizeof(Char), size, f) < size
  513. ? -1
  514. : static_cast<int>(size);
  515. }
  516. /**
  517. * Formats `args` according to specifications in `fmt` and writes the output
  518. * to `f`.
  519. *
  520. * **Example**:
  521. *
  522. * fmt::fprintf(stderr, "Don't %s!", "panic");
  523. */
  524. template <typename S, typename... T, typename Char = detail::char_t<S>>
  525. inline auto fprintf(std::FILE* f, const S& fmt, const T&... args) -> int {
  526. return vfprintf(f, detail::to_string_view(fmt),
  527. make_printf_args<Char>(args...));
  528. }
  529. template <typename Char>
  530. FMT_DEPRECATED inline auto vprintf(basic_string_view<Char> fmt,
  531. typename vprintf_args<Char>::type args)
  532. -> int {
  533. return vfprintf(stdout, fmt, args);
  534. }
  535. /**
  536. * Formats `args` according to specifications in `fmt` and writes the output
  537. * to `stdout`.
  538. *
  539. * **Example**:
  540. *
  541. * fmt::printf("Elapsed time: %.2f seconds", 1.23);
  542. */
  543. template <typename... T>
  544. inline auto printf(string_view fmt, const T&... args) -> int {
  545. return vfprintf(stdout, fmt, make_printf_args(args...));
  546. }
  547. template <typename... T>
  548. FMT_DEPRECATED inline auto printf(basic_string_view<wchar_t> fmt,
  549. const T&... args) -> int {
  550. return vfprintf(stdout, fmt, make_printf_args<wchar_t>(args...));
  551. }
  552. FMT_END_EXPORT
  553. FMT_END_NAMESPACE
  554. #endif // FMT_PRINTF_H_