This allows to reference _scwprintf() and _vscwprintf() functions for UCRT build via their symbols, like for msvcrt builds. --- mingw-w64-crt/Makefile.am | 2 ++ mingw-w64-crt/stdio/ucrt__scwprintf.c | 21 +++++++++++++++++++++ mingw-w64-crt/stdio/ucrt__vscwprintf.c | 15 +++++++++++++++ mingw-w64-headers/crt/stdio.h | 18 ++---------------- mingw-w64-headers/crt/wchar.h | 18 ++++-------------- 5 files changed, 44 insertions(+), 30 deletions(-) create mode 100644 mingw-w64-crt/stdio/ucrt__scwprintf.c create mode 100644 mingw-w64-crt/stdio/ucrt__vscwprintf.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 8bc3bab6c235..0eae6541b7ad 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -406,11 +406,13 @@ src_ucrtbase=\ stdio/ucrt___local_stdio_printf_options.c \ stdio/ucrt___local_stdio_scanf_options.c \ stdio/ucrt__scprintf.c \ + stdio/ucrt__scwprintf.c \ stdio/ucrt__snprintf.c \ stdio/ucrt__snscanf.c \ stdio/ucrt__snwprintf.c \ stdio/ucrt__swprintf.c \ stdio/ucrt__vscprintf.c \ + stdio/ucrt__vscwprintf.c \ stdio/ucrt__vsnprintf.c \ stdio/ucrt__vsnwprintf.c \ stdio/ucrt__vswprintf.c \ diff --git a/mingw-w64-crt/stdio/ucrt__scwprintf.c b/mingw-w64-crt/stdio/ucrt__scwprintf.c new file mode 100644 index 000000000000..bc766de5441f --- /dev/null +++ b/mingw-w64-crt/stdio/ucrt__scwprintf.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 _scwprintf(const wchar_t * restrict format, ...) +{ + int ret; + va_list args; + va_start(args, format); + ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, format, NULL, args); + va_end(args); + return ret; +} +int __cdecl (*__MINGW_IMP_SYMBOL(_scwprintf))(const wchar_t * restrict, ...) = _scwprintf; diff --git a/mingw-w64-crt/stdio/ucrt__vscwprintf.c b/mingw-w64-crt/stdio/ucrt__vscwprintf.c new file mode 100644 index 000000000000..5cb7d7d80e4b --- /dev/null +++ b/mingw-w64-crt/stdio/ucrt__vscwprintf.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 _vscwprintf(const wchar_t * restrict format, va_list args) +{ + return __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, format, NULL, args); +} +int __cdecl (*__MINGW_IMP_SYMBOL(_vscwprintf))(const wchar_t * restrict, va_list) = _vscwprintf; diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index 14e14e55809d..52a5441eefc7 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -1165,16 +1165,7 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti _CRTIMP int __cdecl _putws(const wchar_t *_Str); #ifdef _UCRT - __mingw_ovr - int __cdecl _scwprintf(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 | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, NULL, __ap); - __builtin_va_end(__ap); - return __ret; - } + _CRTIMP int __cdecl _scwprintf(const wchar_t * __restrict__ _Format,...); int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; @@ -1189,12 +1180,7 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti _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) - { - int _Result = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, NULL, _ArgList); - return _Result < 0 ? -1 : _Result; - } + _CRTIMP int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); #else _CRTIMP int __cdecl _scwprintf(const wchar_t * __restrict__ _Format,...); _CRTIMP int __cdecl _swprintf_c(wchar_t * __restrict__ _DstBuf,size_t _SizeInWords,const wchar_t * __restrict__ _Format,...); diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h index 4026f827d92d..d1efbee63d1f 100644 --- a/mingw-w64-headers/crt/wchar.h +++ b/mingw-w64-headers/crt/wchar.h @@ -535,16 +535,7 @@ __MINGW_ASM_CALL(__mingw_vsnwprintf); _CRTIMP int __cdecl _putws(const wchar_t *_Str); #ifdef _UCRT - __mingw_ovr - int __cdecl _scwprintf(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 | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, NULL, __ap); - __builtin_va_end(__ap); - return __ret; - } + _CRTIMP int __cdecl _scwprintf(const wchar_t * __restrict__ _Format,...); int __cdecl _snwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; __mingw_ovr __MINGW_ATTRIB_DEPRECATED_SEC_WARN int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) @@ -802,10 +793,9 @@ __MINGW_ASM_CALL(__mingw_vsnwprintf); { return __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, NULL, 0, _Format, _Locale, _ArgList); } - __mingw_ovr int __cdecl _vscwprintf(const wchar_t *_Format, va_list _ArgList) - { - return _vscwprintf_l(_Format, NULL, _ArgList); - } + + _CRTIMP int __cdecl _vscwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); + __mingw_ovr int __cdecl _scwprintf_l(const wchar_t *_Format, _locale_t _Locale, ...) { __builtin_va_list _ArgList; -- 2.20.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public