headers: Fix non-standard C++ two-argument swprintf() function
Currently this function can be compiled by g++ only with -O1 (or up)
because it uses __builtin_va_arg_pack().
Both non-standard C++ two-argument swprintf() and vswprintf() functions are
just redirection to _swprintf() and _vswprintf() functions. So declare them
via __MINGW_ASM_CALL() redirection, which works with both clang and gcc
compilers in both optimizing and non-optimizing modes.
Reported issue: https://github.com/mingw-w64/mingw-w64/issues/92
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-headers/crt/swprintf.inl b/mingw-w64-headers/crt/swprintf.inl
index 3fe7712..7adfbb6 100644
--- a/mingw-w64-headers/crt/swprintf.inl
+++ b/mingw-w64-headers/crt/swprintf.inl
@@ -7,36 +7,15 @@
#ifndef _INC_SWPRINTF_INL
#define _INC_SWPRINTF_INL
-#include <vadefs.h>
-
#ifdef __cplusplus
extern "C++" {
-__mingw_ovr
/* __attribute__((__format__ (gnu_wprintf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2)
-int vswprintf (wchar_t *__stream, const wchar_t *__format, __builtin_va_list __local_argv)
-{
- return _vswprintf( __stream, __format, __local_argv );
-}
+int vswprintf (wchar_t *__stream, const wchar_t *__format, __builtin_va_list __local_argv) __MINGW_ASM_CALL(_vswprintf);
-__mingw_ovr
/* __attribute__((__format__ (gnu_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2)
-int swprintf (wchar_t *__stream, const wchar_t *__format, ...)
-{
-#ifdef __clang__
- /* clang does not support __builtin_va_arg_pack(), so forward swprintf() to vswprintf() */
- int __retval;
- __builtin_va_list __local_argv;
-
- __builtin_va_start( __local_argv, __format );
- __retval = vswprintf( __stream, __format, __local_argv );
- __builtin_va_end( __local_argv );
- return __retval;
-#else
- return _swprintf( __stream, __format, __builtin_va_arg_pack() );
-#endif
-}
+int swprintf (wchar_t *__stream, const wchar_t *__format, ...) __MINGW_ASM_CALL(_swprintf);
}