On Wednesday 07 May 2025 00:11:50 Martin Storsjö wrote: > On Sun, 4 May 2025, Pali Rohár wrote: > > > 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 > > --- > > mingw-w64-headers/crt/swprintf.inl | 25 ++----------------------- > > 1 file changed, 2 insertions(+), 23 deletions(-) > > From reading this patchset, I didn't find anything to object to (except > Jacek's concern about adding _CRTIMP which causes unncessary indirection). > But from testing with our CI, I noticed the following error: > > i686-w64-mingw32-gcc ../crt-test.c -o crt-test.exe > ../crt-test.c:264:15: error: call to undeclared function 'vsnwprintf'; ISO > C99 and later do not support implicit function declarations > [-Wimplicit-function-declaration] > 264 | int ret = vsnwprintf(buf, n, fmt, ap); > | ^ > ../crt-test.c:554:11: error: call to undeclared function 'snwprintf'; ISO > C99 and later do not support implicit function declarations > [-Wimplicit-function-declaration] > 554 | ret = snwprintf(wbuf2, ARRAYLEN(wbuf2), L"%d", 123456); > | ^ > 2 errors generated. > > This was in builds with UCRT; builds with msvcrt seem to pass this stage - > see > https://github.com/mstorsjo/mingw-w64/actions/runs/14869105161/job/41753135722 > for the full log. The same thing also show up in GCC builds with UCRT. > > For patchsets like these, it'd be nice to test running with the CI before > posting for review if possible, so the reviewers don't need to do that. > > // Martin
I cannot access the build logs, seems to be private. But I see where is the issue. During rebasing of the commits I put declaration of those functions into wrong #ifdef section. Change like the following one could address the issue. I will do more testing and then let you know. fixup! headers: Deduplicate (v)swprintf, (v)snwprintf _(v)swprintf, _(v)scwprintf functions across UCRT/msvcrt builds diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index 5beef25ea4de..f604975e77e0 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -1086,9 +1086,6 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __MINGW_ATTRIB_NONNULL(1) int vwscanf(const wchar_t *__format, __builtin_va_list __local_argv); - - int __cdecl snwprintf(wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...); - int __cdecl vsnwprintf(wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg); #endif /* __NO_ISOCEXT */ int __cdecl fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); @@ -1099,6 +1096,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti int __cdecl swprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,...); int __cdecl vswprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args); + int __cdecl snwprintf(wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, ...); + int __cdecl vsnwprintf(wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg); #endif /* __USE_MINGW_ANSI_STDIO */ #ifndef WEOF _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public