blob: 0d4904bcd81834d1ac9ba0ad84188f984196261c [file] [log] [blame]
Jacek Caban824ceb12012-11-30 11:16:49 +00001/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6
7#ifndef _INC_SWPRINTF_INL
8#define _INC_SWPRINTF_INL
9
10#include <vadefs.h>
11
12#undef __mingw_ovr
13#if defined (__GNUC__)
14#define __mingw_ovr static __attribute__ ((__unused__)) __inline__ __cdecl
Martin Storsjö3e521082017-11-21 10:00:57 +020015#ifdef __mingw_static_ovr
16#undef __mingw_static_ovr
17#define __mingw_static_ovr __mingw_ovr
18#endif
Jacek Caban824ceb12012-11-30 11:16:49 +000019#elif defined(__cplusplus)
20#define __mingw_ovr inline __cdecl
21#else
22#define __mingw_ovr static __cdecl
23#endif
24
25__mingw_ovr
26/* __attribute__((__format__ (gnu_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3)
27int vswprintf (wchar_t *__stream, size_t __count, const wchar_t *__format, __builtin_va_list __local_argv)
28{
29 return vsnwprintf( __stream, __count, __format, __local_argv );
30}
31
32__mingw_ovr
33/* __attribute__((__format__ (gnu_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3)
34int swprintf (wchar_t *__stream, size_t __count, const wchar_t *__format, ...)
35{
Martin Storsjö09e4fcb2018-03-23 22:56:15 +020036 int __retval;
Jacek Caban824ceb12012-11-30 11:16:49 +000037 __builtin_va_list __local_argv;
38
39 __builtin_va_start( __local_argv, __format );
40 __retval = vswprintf( __stream, __count, __format, __local_argv );
41 __builtin_va_end( __local_argv );
42 return __retval;
43}
44
45#ifdef __cplusplus
46
47extern "C++" {
48
49__mingw_ovr
50/* __attribute__((__format__ (gnu_wprintf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
51int vswprintf (wchar_t *__stream, const wchar_t *__format, __builtin_va_list __local_argv)
52{
53#if __USE_MINGW_ANSI_STDIO
54 return __mingw_vswprintf( __stream, __format, __local_argv );
55#else
56 return _vswprintf( __stream, __format, __local_argv );
57#endif
58}
59
60__mingw_ovr
61/* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
62int swprintf (wchar_t *__stream, const wchar_t *__format, ...)
63{
Martin Storsjö09e4fcb2018-03-23 22:56:15 +020064 int __retval;
Jacek Caban824ceb12012-11-30 11:16:49 +000065 __builtin_va_list __local_argv;
66
67 __builtin_va_start( __local_argv, __format );
68 __retval = vswprintf( __stream, __format, __local_argv );
69 __builtin_va_end( __local_argv );
70 return __retval;
71}
72
73}
74
75#elif defined(_CRT_NON_CONFORMING_SWPRINTFS)
76
77#if __USE_MINGW_ANSI_STDIO
78#define swprintf __mingw_swprintf
79#define vswprintf __mingw_vswprintf
80#else
81#define swprintf _swprintf
82#define vswprintf _vswprintf
83#endif
84
85#endif /* __cplusplus */
86
Martin Storsjö09e4fcb2018-03-23 22:56:15 +020087#endif /* _INC_SWPRINTF_INL */