This allows to reference _swprintf() and _vswprintf() functions for UCRT
build via their symbols, like for msvcrt builds.
This change is needed to allow to use __MINGW_ASM_CALL(_swprintf).
---
mingw-w64-crt/Makefile.am | 2 ++
mingw-w64-crt/stdio/ucrt__swprintf.c | 21 +++++++++++++++++++++
mingw-w64-crt/stdio/ucrt__vswprintf.c | 15 +++++++++++++++
mingw-w64-headers/crt/stdio.h | 17 ++---------------
mingw-w64-headers/crt/wchar.h | 15 ++-------------
5 files changed, 42 insertions(+), 28 deletions(-)
create mode 100644 mingw-w64-crt/stdio/ucrt__swprintf.c
create mode 100644 mingw-w64-crt/stdio/ucrt__vswprintf.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 04b61c429d34..8bc3bab6c235 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -409,9 +409,11 @@ src_ucrtbase=\
stdio/ucrt__snprintf.c \
stdio/ucrt__snscanf.c \
stdio/ucrt__snwprintf.c \
+ stdio/ucrt__swprintf.c \
stdio/ucrt__vscprintf.c \
stdio/ucrt__vsnprintf.c \
stdio/ucrt__vsnwprintf.c \
+ stdio/ucrt__vswprintf.c \
stdio/ucrt_fprintf.c \
stdio/ucrt_fscanf.c \
stdio/ucrt_fwprintf.c \
diff --git a/mingw-w64-crt/stdio/ucrt__swprintf.c
b/mingw-w64-crt/stdio/ucrt__swprintf.c
new file mode 100644
index 000000000000..c39c4f0f1edb
--- /dev/null
+++ b/mingw-w64-crt/stdio/ucrt__swprintf.c
@@ -0,0 +1,21 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#undef __MSVCRT_VERSION__
+#define _UCRT
+#include <stdio.h>
+#include <stdarg.h>
+
+int __cdecl _swprintf(wchar_t * restrict dest, const wchar_t * restrict
format, ...)
+{
+ int ret;
+ va_list args;
+ va_start(args, format);
+ ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, dest,
(size_t)-1, format, NULL, args);
+ va_end(args);
+ return ret;
+}
+int __cdecl (*__MINGW_IMP_SYMBOL(_swprintf))(wchar_t * restrict, const wchar_t
* restrict, ...) = _swprintf;
diff --git a/mingw-w64-crt/stdio/ucrt__vswprintf.c
b/mingw-w64-crt/stdio/ucrt__vswprintf.c
new file mode 100644
index 000000000000..71c18e16b37e
--- /dev/null
+++ b/mingw-w64-crt/stdio/ucrt__vswprintf.c
@@ -0,0 +1,15 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#undef __MSVCRT_VERSION__
+#define _UCRT
+#include <stdio.h>
+
+int __cdecl _vswprintf(wchar_t * restrict dest, const wchar_t * restrict
format, va_list args)
+{
+ return __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, dest,
(size_t)-1, format, NULL, args);
+}
+int __cdecl (*__MINGW_IMP_SYMBOL(_vswprintf))(wchar_t * restrict, const
wchar_t * restrict, va_list) = _vswprintf;
diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h
index 91d617fc0fb2..14e14e55809d 100644
--- a/mingw-w64-headers/crt/stdio.h
+++ b/mingw-w64-headers/crt/stdio.h
@@ -1186,21 +1186,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const
wchar_t *__format, __builti
int __cdecl vsnwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t *
__restrict__ format, va_list arg);
#endif
- __mingw_ovr
- int __cdecl _swprintf(wchar_t * __restrict__ _Dest,const wchar_t *
__restrict__ _Format,...)
- {
- __builtin_va_list __ap;
- int __ret;
- __builtin_va_start(__ap, _Format);
- __ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS,
_Dest, (size_t)-1, _Format, NULL, __ap);
- __builtin_va_end(__ap);
- return __ret;
- }
- __mingw_ovr
- int __cdecl _vswprintf(wchar_t * __restrict__ _Dest,const wchar_t *
__restrict__ _Format,va_list _Args)
- {
- return __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _Dest,
(size_t)-1, _Format, NULL, _Args);
- }
+ _CRTIMP int __cdecl _swprintf(wchar_t * __restrict__ _Dest,const wchar_t *
__restrict__ _Format,...);
+ _CRTIMP int __cdecl _vswprintf(wchar_t * __restrict__ _Dest,const wchar_t *
__restrict__ _Format,va_list _Args);
__mingw_ovr
int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format, va_list
_ArgList)
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index 0ce7593cf3c2..4026f827d92d 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -828,10 +828,7 @@ __MINGW_ASM_CALL(__mingw_vsnwprintf);
{
return _vswprintf_c_l(_DstBuf, _MaxCount, _Format, _Locale, _ArgList);
}
- __mingw_ovr int __cdecl _vswprintf(wchar_t *_DstBuf, const wchar_t *_Format,
va_list _ArgList)
- {
- return _vswprintf_c_l(_DstBuf, (size_t)-1, _Format, NULL, _ArgList);
- }
+ _CRTIMP int __cdecl _vswprintf(wchar_t * __restrict__ _Dest,const wchar_t *
__restrict__ _Format,va_list _Args);
__mingw_ovr int __cdecl _swprintf_c_l(wchar_t *_DstBuf, size_t _MaxCount,
const wchar_t *_Format, _locale_t _Locale, ...)
{
__builtin_va_list _ArgList;
@@ -850,15 +847,7 @@ __MINGW_ASM_CALL(__mingw_vsnwprintf);
__builtin_va_end(_ArgList);
return _Ret;
}
- __mingw_ovr int __cdecl _swprintf(wchar_t *_DstBuf, const wchar_t *_Format,
...)
- {
- __builtin_va_list _ArgList;
- int _Ret;
- __builtin_va_start(_ArgList, _Format);
- _Ret = _vswprintf_c_l(_DstBuf, (size_t)-1, _Format, NULL, _ArgList);
- __builtin_va_end(_ArgList);
- return _Ret;
- }
+ _CRTIMP int __cdecl _swprintf(wchar_t * __restrict__ _Dest,const wchar_t *
__restrict__ _Format,...);
#else /* _UCRT */
_CRTIMP int __cdecl _fwprintf_p(FILE * __restrict__ _File,const wchar_t *
__restrict__ _Format,...);
_CRTIMP int __cdecl _wprintf_p(const wchar_t * __restrict__ _Format,...);
--
2.20.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public