In principle, we could maybe also do this for CRTs other than UCRT; there we currently define these aliases in def files.
This fixes breakage after 581532b8e49a0e10cbdfe2332a8c1d61ff3d6820, noted and discussed at https://github.com/git-for-windows/build-extra/commit/b1b6eb5c5d78c4d8da53c4daa6aa6cf7dae7f8fb. Previously, c9eca28decb3aa5213fe22ab1f9883df91d79806 fixed the initial issues by providing one function as a separate standalone function, however that approach seems unsustainable to do for all functions. Signed-off-by: Martin Storsjö <mar...@martin.st> --- mingw-w64-headers/crt/_mingw.h.in | 6 +++ mingw-w64-headers/crt/stdio.h | 83 +++++++++++++++++++++---------- mingw-w64-headers/crt/wchar.h | 41 ++++++++++----- 3 files changed, 91 insertions(+), 39 deletions(-) diff --git a/mingw-w64-headers/crt/_mingw.h.in b/mingw-w64-headers/crt/_mingw.h.in index 0752993f3..a5399e058 100644 --- a/mingw-w64-headers/crt/_mingw.h.in +++ b/mingw-w64-headers/crt/_mingw.h.in @@ -246,6 +246,12 @@ limitations in handling dllimport attribute. */ #define _UCRT #endif +#ifdef _UCRT +# define __MINGW_UCRT_ASM_CALL(func) __MINGW_ASM_CALL(func) +#else +# define __MINGW_UCRT_ASM_CALL(func) +#endif + #ifndef _WIN32_WINNT #define _WIN32_WINNT @DEFAULT_WIN32_WINNT@ #endif diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index f29f17ec7..3b154e2b5 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -206,47 +206,63 @@ extern extern __MINGW_MS_SCANF(2, 3) __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...); + int __cdecl __ms_sscanf(const char * __restrict__ _Src,const char * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(sscanf); extern __MINGW_MS_SCANF(2, 0) __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_vsscanf(const char * __restrict__ _Str,const char * __restrict__ _Format,va_list argp); + int __cdecl __ms_vsscanf(const char * __restrict__ _Str,const char * __restrict__ _Format,va_list argp) + __MINGW_UCRT_ASM_CALL(vsscanf); extern __MINGW_MS_SCANF(1, 2) __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_scanf(const char * __restrict__ _Format,...); + int __cdecl __ms_scanf(const char * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(scanf); extern __MINGW_MS_SCANF(1, 0) __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_vscanf(const char * __restrict__ _Format,va_list argp); + int __cdecl __ms_vscanf(const char * __restrict__ _Format,va_list argp) + __MINGW_UCRT_ASM_CALL(vscanf); extern __MINGW_MS_SCANF(2, 3) __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...); + int __cdecl __ms_fscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(fscanf); extern __MINGW_MS_SCANF(2, 0) __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_vfscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list argp); + int __cdecl __ms_vfscanf(FILE * __restrict__ _File,const char * __restrict__ _Format,va_list argp) + __MINGW_UCRT_ASM_CALL(vfscanf); extern __MINGW_MS_PRINTF(1, 2) __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_printf(const char * __restrict__ , ... ) __MINGW_NOTHROW; + int __cdecl __ms_printf(const char * __restrict__ , ... ) + __MINGW_UCRT_ASM_CALL(printf) __MINGW_NOTHROW; extern __MINGW_MS_PRINTF(1, 0) __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_vprintf (const char * __restrict__ , va_list) __MINGW_NOTHROW; + int __cdecl __ms_vprintf (const char * __restrict__ , va_list) + __MINGW_UCRT_ASM_CALL(vprintf) __MINGW_NOTHROW; extern __MINGW_MS_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) int __cdecl __ms_fprintf (FILE * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW; + // No __MINGW_UCRT_ASM_CALL for __ms_fprintf; this is provided as an + // actual function in the ucrt import libraries. extern __MINGW_MS_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_vfprintf (FILE * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW; + int __cdecl __ms_vfprintf (FILE * __restrict__ , const char * __restrict__ , va_list) + __MINGW_UCRT_ASM_CALL(vfprintf) __MINGW_NOTHROW +; extern __MINGW_MS_PRINTF(2, 3) __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_sprintf (char * __restrict__ , const char * __restrict__ , ...) __MINGW_NOTHROW; + int __cdecl __ms_sprintf (char * __restrict__ , const char * __restrict__ , ...) + __MINGW_UCRT_ASM_CALL(sprintf) __MINGW_NOTHROW; extern __MINGW_MS_PRINTF(2, 0) __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_vsprintf (char * __restrict__ , const char * __restrict__ , va_list) __MINGW_NOTHROW; + int __cdecl __ms_vsprintf (char * __restrict__ , const char * __restrict__ , va_list) + __MINGW_UCRT_ASM_CALL(vsprintf) __MINGW_NOTHROW; extern __MINGW_MS_PRINTF(3, 4) __MINGW_ATTRIB_NONNULL(3) - int __cdecl __ms_snprintf (char * __restrict__ , size_t , const char * __restrict__ , ...) __MINGW_NOTHROW; + int __cdecl __ms_snprintf (char * __restrict__ , size_t , const char * __restrict__ , ...) + __MINGW_UCRT_ASM_CALL(snprintf) __MINGW_NOTHROW; extern __MINGW_MS_PRINTF(3, 0) __MINGW_ATTRIB_NONNULL(3) - int __cdecl __ms_vsnprintf (char * __restrict__ , size_t , const char * __restrict__ , va_list) __MINGW_NOTHROW; + int __cdecl __ms_vsnprintf (char * __restrict__ , size_t , const char * __restrict__ , va_list) + __MINGW_UCRT_ASM_CALL(vsnprintf) __MINGW_NOTHROW; #ifdef _UCRT int __cdecl __stdio_common_vsprintf(unsigned __int64 options, char *str, size_t len, const char *format, _locale_t locale, va_list valist); @@ -929,34 +945,49 @@ int vsprintf (char * __restrict__ __stream, const char * __restrict__ __format, int __cdecl __mingw_vswprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ ,va_list); /* __attribute__((__format__ (ms_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...); + int __cdecl __ms_swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(swscanf); /* __attribute__((__format__ (ms_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_vswscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,va_list); + int __cdecl __ms_vswscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,va_list) + __MINGW_UCRT_ASM_CALL(vswscanf); /* __attribute__((__format__ (ms_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_wscanf(const wchar_t * __restrict__ _Format,...); + int __cdecl __ms_wscanf(const wchar_t * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(wscanf); /* __attribute__((__format__ (ms_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_vwscanf(const wchar_t * __restrict__ _Format, va_list); + int __cdecl __ms_vwscanf(const wchar_t * __restrict__ _Format, va_list) + __MINGW_UCRT_ASM_CALL(vwscanf); /* __attribute__((__format__ (ms_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); + int __cdecl __ms_fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(fwscanf); /* __attribute__((__format__ (ms_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_vfwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list); + int __cdecl __ms_vfwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list) + __MINGW_UCRT_ASM_CALL(vfwscanf); /* __attribute__((__format__ (ms_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) int __cdecl __ms_fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); + /* No __MINGW_UCRT_ASM_CALL for __ms_fwprintf; this is provided as an + * actual function in the ucrt import libraries. */ /* __attribute__((__format__ (ms_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_wprintf(const wchar_t * __restrict__ _Format,...); + int __cdecl __ms_wprintf(const wchar_t * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(wprintf); /* __attribute__((__format__ (ms_wprintf, 2, 0))) */__MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList); + int __cdecl __ms_vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList) + __MINGW_UCRT_ASM_CALL(vfwprintf); /*__attribute__((__format__ (ms_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); + int __cdecl __ms_vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList) + __MINGW_UCRT_ASM_CALL(vwprintf); /* __attribute__((__format__ (ms_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) - int __cdecl __ms_swprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...); + int __cdecl __ms_swprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...) + __MINGW_UCRT_ASM_CALL(swprintf); /* __attribute__((__format__ (ms_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) - int __cdecl __ms_vswprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ ,va_list); + int __cdecl __ms_vswprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ ,va_list) + __MINGW_UCRT_ASM_CALL(vswprintf); /* __attribute__((__format__ (ms_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) - int __cdecl __ms_snwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...); + int __cdecl __ms_snwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...) + __MINGW_UCRT_ASM_CALL(snwprintf); /* __attribute__((__format__ (ms_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) - int __cdecl __ms_vsnwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list); + int __cdecl __ms_vsnwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list) + __MINGW_UCRT_ASM_CALL(vsnwprintf); #ifdef _UCRT int __cdecl __stdio_common_vswprintf(unsigned __int64 options, wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist); diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h index 1bb1d336c..e8228b82b 100644 --- a/mingw-w64-headers/crt/wchar.h +++ b/mingw-w64-headers/crt/wchar.h @@ -335,34 +335,49 @@ _CRTIMP FILE *__cdecl __acrt_iob_func(unsigned index); int __cdecl __mingw_vswprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ ,va_list); /* __attribute__((__format__ (ms_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...); + int __cdecl __ms_swscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(swscanf); /* __attribute__((__format__ (ms_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_vswscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,va_list); + int __cdecl __ms_vswscanf(const wchar_t * __restrict__ _Src,const wchar_t * __restrict__ _Format,va_list) + __MINGW_UCRT_ASM_CALL(vswscanf); /* __attribute__((__format__ (ms_wscanf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_wscanf(const wchar_t * __restrict__ _Format,...); + int __cdecl __ms_wscanf(const wchar_t * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(wscanf); /* __attribute__((__format__ (ms_wscanf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_vwscanf(const wchar_t * __restrict__ _Format, va_list); + int __cdecl __ms_vwscanf(const wchar_t * __restrict__ _Format, va_list) + __MINGW_UCRT_ASM_CALL(vwscanf); /* __attribute__((__format__ (ms_wscanf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); + int __cdecl __ms_fwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(fwscanf); /* __attribute__((__format__ (ms_wscanf, 2, 0))) */ __MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_vfwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list); + int __cdecl __ms_vfwscanf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list) + __MINGW_UCRT_ASM_CALL(vfwscanf); /* __attribute__((__format__ (ms_wprintf, 2, 3))) */ __MINGW_ATTRIB_NONNULL(2) int __cdecl __ms_fwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,...); + /* No __MINGW_UCRT_ASM_CALL for __ms_fwprintf; this is provided as an + * actual function in the ucrt import libraries. */ /* __attribute__((__format__ (ms_wprintf, 1, 2))) */ __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_wprintf(const wchar_t * __restrict__ _Format,...); + int __cdecl __ms_wprintf(const wchar_t * __restrict__ _Format,...) + __MINGW_UCRT_ASM_CALL(wprintf); /* __attribute__((__format__ (ms_wprintf, 2, 0))) */__MINGW_ATTRIB_NONNULL(2) - int __cdecl __ms_vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList); + int __cdecl __ms_vfwprintf(FILE * __restrict__ _File,const wchar_t * __restrict__ _Format,va_list _ArgList) + __MINGW_UCRT_ASM_CALL(vfwprintf); /*__attribute__((__format__ (ms_wprintf, 1, 0))) */ __MINGW_ATTRIB_NONNULL(1) - int __cdecl __ms_vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList); + int __cdecl __ms_vwprintf(const wchar_t * __restrict__ _Format,va_list _ArgList) + __MINGW_UCRT_ASM_CALL(vwprintf); /* __attribute__((__format__ (ms_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) - int __cdecl __ms_swprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...); + int __cdecl __ms_swprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...) + __MINGW_UCRT_ASM_CALL(swprintf); /* __attribute__((__format__ (ms_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) - int __cdecl __ms_vswprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ ,va_list); + int __cdecl __ms_vswprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ ,va_list) + __MINGW_UCRT_ASM_CALL(vswprintf); /* __attribute__((__format__ (ms_wprintf, 3, 4))) */ __MINGW_ATTRIB_NONNULL(3) - int __cdecl __ms_snwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...); + int __cdecl __ms_snwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , ...) + __MINGW_UCRT_ASM_CALL(snwprintf); /* __attribute__((__format__ (ms_wprintf, 3, 0))) */ __MINGW_ATTRIB_NONNULL(3) - int __cdecl __ms_vsnwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list); + int __cdecl __ms_vsnwprintf(wchar_t * __restrict__ , size_t, const wchar_t * __restrict__ , va_list) + __MINGW_UCRT_ASM_CALL(vsnwprintf); #ifdef _UCRT int __cdecl __stdio_common_vswprintf(unsigned __int64 options, wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist); -- 2.43.0 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public