On 4.05.2025 23:29, Jacek Caban wrote:
On 4.05.2025 11:37, Pali Rohár wrote:
Function _vsnwprintf() is already deinlined from stdio.h. Do same in wchar.h and define import symbol.
---
  mingw-w64-crt/stdio/ucrt__vsnwprintf.c | 1 +
  mingw-w64-headers/crt/wchar.h          | 6 +-----
  2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/mingw-w64-crt/stdio/ucrt__vsnwprintf.c b/mingw-w64-crt/stdio/ucrt__vsnwprintf.c
index 376a683b9ae6..613f5defedd0 100644
--- a/mingw-w64-crt/stdio/ucrt__vsnwprintf.c
+++ b/mingw-w64-crt/stdio/ucrt__vsnwprintf.c
@@ -12,3 +12,4 @@ int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t
  {
    return __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, NULL, _Args);
  }
+int __cdecl (*__MINGW_IMP_SYMBOL(_vsnwprintf))(wchar_t * __restrict__,size_t,const wchar_t * __restrict__,va_list) = _vsnwprintf; diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index d1efbee63d1f..4d46066ad911 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -537,11 +537,7 @@ __MINGW_ASM_CALL(__mingw_vsnwprintf);
  #ifdef _UCRT
    _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)
-  {
-    return __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, NULL, _Args);
-  }
+  _CRTIMP int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t _Count,const wchar_t * __restrict__ _Format,va_list _Args) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;


From the UCRT perspective, this is a step backward. We’d now be emitting an unnecessary indirect call. In my opinion, if unification is the goal, it would be better to drop _CRTIMP for all targets instead.


FWIW, my comment was meant for patch 4, which only adds _CRTIMP and __imp_ symbols, though it applies to the whole series.


Jacek



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to