Jacek Caban | 824ceb1 | 2012-11-30 11:16:49 +0000 | [diff] [blame] | 1 | /** |
| 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ö | 3e52108 | 2017-11-21 10:00:57 +0200 | [diff] [blame] | 15 | #ifdef __mingw_static_ovr |
| 16 | #undef __mingw_static_ovr |
| 17 | #define __mingw_static_ovr __mingw_ovr |
| 18 | #endif |
Jacek Caban | 824ceb1 | 2012-11-30 11:16:49 +0000 | [diff] [blame] | 19 | #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) |
| 27 | int 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) |
| 34 | int swprintf (wchar_t *__stream, size_t __count, const wchar_t *__format, ...) |
| 35 | { |
Martin Storsjö | 09e4fcb | 2018-03-23 22:56:15 +0200 | [diff] [blame] | 36 | int __retval; |
Jacek Caban | 824ceb1 | 2012-11-30 11:16:49 +0000 | [diff] [blame] | 37 | __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 | |
| 47 | extern "C++" { |
| 48 | |
| 49 | __mingw_ovr |
| 50 | /* __attribute__((__format__ (gnu_wprintf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) |
| 51 | int 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) |
| 62 | int swprintf (wchar_t *__stream, const wchar_t *__format, ...) |
| 63 | { |
Martin Storsjö | 09e4fcb | 2018-03-23 22:56:15 +0200 | [diff] [blame] | 64 | int __retval; |
Jacek Caban | 824ceb1 | 2012-11-30 11:16:49 +0000 | [diff] [blame] | 65 | __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ö | 09e4fcb | 2018-03-23 22:56:15 +0200 | [diff] [blame] | 87 | #endif /* _INC_SWPRINTF_INL */ |