crt: Deinline UCRT _scwprintf() and _vscwprintf() functions and define import symbols for them This allows to reference _scwprintf() and _vscwprintf() functions for UCRT build via their symbols, like for msvcrt builds. Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index a24221d..e0924b4 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am
@@ -414,11 +414,13 @@ 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 0000000..bc766de --- /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 0000000..5cb7d7d --- /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 14e14e5..52a5441 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h
@@ -1165,16 +1165,7 @@ _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 @@ _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 809d497..54df97a 100644 --- a/mingw-w64-headers/crt/wchar.h +++ b/mingw-w64-headers/crt/wchar.h
@@ -535,16 +535,7 @@ _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 @@ { 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;