Re: [Mingw-w64-public] [PATCH] crt: Make evr.def shared, make it available for arm64
On Mon, 9 Mar 2020, Liu Hao wrote: 在 03/09/2020 05:25 AM, Martin Storsjö 写道: Signed-off-by: Martin Storsjö --- .../{libarm32 => lib-common}/evr.def | 2 +- mingw-w64-crt/lib64/evr.def | 34 --- mingw-w64-crt/libarm64/Makefile.am| 1 + 3 files changed, 2 insertions(+), 35 deletions(-) rename mingw-w64-crt/{libarm32 => lib-common}/evr.def (100%) delete mode 100644 mingw-w64-crt/lib64/evr.def LGTM, too. Thanks, pushed both. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] crt: Provide _vscprintf as a non-inline function for UCRT
The libmingwex implementation of asprintf requires a _vscprintf now, and that implementation is supposed to be agnostic of the underlying CRT type. Signed-off-by: Martin Storsjö --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/stdio/ucrt__vscprintf.c | 15 +++ mingw-w64-headers/crt/stdio.h | 8 3 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 mingw-w64-crt/stdio/ucrt__vscprintf.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 833a7215a..a5e48c84b 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -233,6 +233,7 @@ src_ucrtbase=\ stdio/ucrt__snwprintf.c \ stdio/ucrt_snprintf.c \ stdio/ucrt_sprintf.c \ + stdio/ucrt__vscprintf.c \ stdio/ucrt__vsnprintf.c \ stdio/ucrt__vsnwprintf.c \ stdio/ucrt_vfprintf.c \ diff --git a/mingw-w64-crt/stdio/ucrt__vscprintf.c b/mingw-w64-crt/stdio/ucrt__vscprintf.c new file mode 100644 index 0..0c2b34b93 --- /dev/null +++ b/mingw-w64-crt/stdio/ucrt__vscprintf.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 + +int _vscprintf(const char * __restrict__ _Format, va_list _ArgList) +{ + return __stdio_common_vsprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, _Format, NULL, _ArgList); +} +int __cdecl (*__MINGW_IMP_SYMBOL(_vscprintf))(const char *__restrict__, va_list) = _vscprintf; diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index d726e746e..19b19c608 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -941,15 +941,7 @@ int vsprintf (char * __restrict__ __stream, const char * __restrict__ __format, #endif /* _UCRT */ #endif /* __USE_MINGW_ANSI_STDIO */ -#ifdef _UCRT - __mingw_ovr - int __cdecl _vscprintf(const char * __restrict__ _Format,va_list _ArgList) - { -return __stdio_common_vsprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, _Format, NULL, _ArgList); - } -#else _CRTIMP int __cdecl _vscprintf(const char * __restrict__ _Format,va_list _ArgList); -#endif /* _UCRT */ _CRTIMP int __cdecl _set_printf_count_output(int _Value); _CRTIMP int __cdecl _get_printf_count_output(void); -- 2.17.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] headers: Do legacy null termination in vsnwprintf for UCRT
According to standard C99, the swprintf and vswprintf functions return a negative value if the buffer is insufficient (contrary to snprintf), and the contents of the buffer is undefined in this case. Both swprintf and vswprintf functions for UCRT end up calling this inline function. Signed-off-by: Martin Storsjö --- mingw-w64-headers/crt/stdio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index 1284e0ba3..d726e746e 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -1314,7 +1314,7 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __mingw_ovr int __cdecl vsnwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg) { -return __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE | UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, s, n, format, NULL, arg); +return __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE | UCRTBASE_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, s, n, format, NULL, arg); } #endif -- 2.17.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] headers: Do legacy null termination in vsnwprintf for UCRT
Hi Martin, On 09.03.2020 10:43, Martin Storsjö wrote: According to standard C99, the swprintf and vswprintf functions return a negative value if the buffer is insufficient (contrary to snprintf), and the contents of the buffer is undefined in this case. Both swprintf and vswprintf functions for UCRT end up calling this inline function. As far as I can see, UCRT calls it with UCRTBASE_PRINTF_DEFAULT_WIDE. Also, there is a duplicated declaration in wchar.h that would need a change (or move to corecrt_wstdio.h to avoid duplication). Thanks, Jacek ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Provide _vscprintf as a non-inline function for UCRT
On 09.03.2020 10:41, Martin Storsjö wrote: The libmingwex implementation of asprintf requires a _vscprintf now, and that implementation is supposed to be agnostic of the underlying CRT type. The patch looks good to me. Thanks, Jacek ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] headers: Add corecrt_stdio_config.h header.
Signed-off-by: Jacek Caban --- mingw-w64-headers/crt/corecrt_stdio_config.h | 30 mingw-w64-headers/crt/stdio.h| 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-headers/crt/corecrt_stdio_config.h diff --git a/mingw-w64-headers/crt/corecrt_stdio_config.h b/mingw-w64-headers/crt/corecrt_stdio_config.h new file mode 100644 index ..02a83684 --- /dev/null +++ b/mingw-w64-headers/crt/corecrt_stdio_config.h @@ -0,0 +1,30 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the Wine project. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#ifndef _STDIO_CONFIG_DEFINED +#define _STDIO_CONFIG_DEFINED + +#include + +#define _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION 0x0001ULL +#define _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR0x0002ULL +#define _CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS0x0004ULL +#define _CRT_INTERNAL_PRINTF_LEGACY_MSVCRT_COMPATIBILITY 0x0008ULL +#define _CRT_INTERNAL_PRINTF_LEGACY_THREE_DIGIT_EXPONENTS 0x0010ULL + +#define _CRT_INTERNAL_SCANF_SECURECRT0x0001ULL +#define _CRT_INTERNAL_SCANF_LEGACY_WIDE_SPECIFIERS 0x0002ULL +#define _CRT_INTERNAL_SCANF_LEGACY_MSVCRT_COMPATIBILITY 0x0004ULL + +#ifndef _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS +#define _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS _CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS +#endif + +#ifndef _CRT_INTERNAL_LOCAL_SCANF_OPTIONS +#define _CRT_INTERNAL_LOCAL_SCANF_OPTIONS _CRT_INTERNAL_SCANF_LEGACY_WIDE_SPECIFIERS +#endif + +#endif /* _STDIO_CONFIG_DEFINED */ diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index 1284e0ba..34392849 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -6,7 +6,7 @@ #ifndef _INC_STDIO #define _INC_STDIO -#include +#include #pragma pack(push,_CRT_PACKING) ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH 1/5] headers: add dxvahd.idl
Hi Steve, On 04.03.2020 15:27, Steve Lhomme wrote: Use the generated dxvahd.h --- mingw-w64-headers/Makefile.am| 1 + mingw-w64-headers/include/dxvahd.h | 841 ++- mingw-w64-headers/include/dxvahd.idl | 427 ++ 3 files changed, 990 insertions(+), 279 deletions(-) create mode 100644 mingw-w64-headers/include/dxvahd.idl Please merge those patches. There is no need to add methods in wrong order only to reorder them later in the series. Thanks, Jacek ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Provide _vscprintf as a non-inline function for UCRT
On Mon, 9 Mar 2020, Jacek Caban wrote: On 09.03.2020 10:41, Martin Storsjö wrote: The libmingwex implementation of asprintf requires a _vscprintf now, and that implementation is supposed to be agnostic of the underlying CRT type. The patch looks good to me. Thanks, pushed. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] headers: Add corecrt_stdio_config.h header.
On Mon, 9 Mar 2020, Jacek Caban wrote: Signed-off-by: Jacek Caban --- mingw-w64-headers/crt/corecrt_stdio_config.h | 30 mingw-w64-headers/crt/stdio.h| 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 mingw-w64-headers/crt/corecrt_stdio_config.h This looks ok in itself - are you going to take these new defines into use in the rest of the headers as well, which I presume is the ultimate goal? // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] headers: Do legacy null termination in vsnwprintf for UCRT
On Mon, 9 Mar 2020, Jacek Caban wrote: Hi Martin, On 09.03.2020 10:43, Martin Storsjö wrote: According to standard C99, the swprintf and vswprintf functions return a negative value if the buffer is insufficient (contrary to snprintf), and the contents of the buffer is undefined in this case. Both swprintf and vswprintf functions for UCRT end up calling this inline function. As far as I can see, UCRT calls it with UCRTBASE_PRINTF_DEFAULT_WIDE. No, that's a different thing. With UCRTBASE_PRINTF_DEFAULT_WIDE, or _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, you'd primarily change between the legacy and standard handling of %s/%S in wide printfs. This patch is not about that aspect, but about the return value and null termination of these functions. Normally that's tied to the function variant (different variants have different legacy behaviours defined), as _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION and _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR are or'ed in with the user-overrideable value. Also, there is a duplicated declaration in wchar.h that would need a change (or move to corecrt_wstdio.h to avoid duplication). Oh right, thanks for pointing it out. I noticed that this patch didn't match the null termination behaviour of MSVC exactly (for swprintf, MSVC does null terminate but returns -1, contrary to _snwprintf which doesn't null terminate), I've fixed that in an updated version of the patch. The updated patch makes the output of the attached test file (or https://martin.st/temp/swprintf.c if the mailing list drops the attachment) match MSVC when using UCRT. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] headers: Fix the return value for swprintf and vswprintf for UCRT
According to standard C99, the swprintf and vswprintf functions return a negative value if the buffer is insufficient (contrary to snprintf). As far as I can read the standard, the contents of the buffer in this case is unspecified, but this patch makes it match MSVC, which does null terminate it. Signed-off-by: Martin Storsjö --- mingw-w64-headers/crt/stdio.h | 3 ++- mingw-w64-headers/crt/wchar.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index b48241831..9b0ec6250 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -1306,7 +1306,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __mingw_ovr int __cdecl vsnwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg) { -return __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE | UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, s, n, format, NULL, arg); +int ret = __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, s, n, format, NULL, arg); +return ret < 0 ? -1 : ret; } #endif diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h index 3fde2a6fb..f4e10e2f4 100644 --- a/mingw-w64-headers/crt/wchar.h +++ b/mingw-w64-headers/crt/wchar.h @@ -824,7 +824,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const wchar_t *__format, __builti __mingw_ovr int __cdecl vsnwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t * __restrict__ format, va_list arg) { -return __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE | UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, s, n, format, NULL, arg); +int ret = __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, s, n, format, NULL, arg); +return ret < 0 ? -1 : ret; } #endif -- 2.17.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] headers: Fix the return value for swprintf and vswprintf for UCRT
在 03/10/2020 05:50 AM, Martin Storsjö 写道: > According to standard C99, the swprintf and vswprintf functions > return a negative value if the buffer is insufficient (contrary to > snprintf). As far as I can read the standard, the contents of the > buffer in this case is unspecified, but this patch makes it match > MSVC, which does null terminate it. > > Signed-off-by: Martin Storsjö > --- > > diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h > index 3fde2a6fb..f4e10e2f4 100644 > --- a/mingw-w64-headers/crt/wchar.h > +++ b/mingw-w64-headers/crt/wchar.h > @@ -824,7 +824,8 @@ int vsnwprintf (wchar_t *__stream, size_t __n, const > wchar_t *__format, __builti >__mingw_ovr >int __cdecl vsnwprintf (wchar_t * __restrict__ s, size_t n, const wchar_t > * __restrict__ format, va_list arg) `vsnwprintf()` is non-standard. I am not sure which function it should follow - `_vsnwprintf()` or just `vswprintf()`, but either way, this name is confusing. Also, if it is necessary to normalize the return value to `-1` please use reserved identifiers for local variables such as `__ret`. Likewise for the other hunk for 'wchar.h'. >{ > -return __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE | > UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, s, n, format, NULL, arg); > +int ret = __stdio_common_vswprintf(UCRTBASE_PRINTF_DEFAULT_WIDE, s, n, > format, NULL, arg); > +return ret < 0 ? -1 : ret; >} > #endif > > -- Best regards, LH_Mouse signature.asc Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH 1/5] headers: add dxvahd.idl
You mean squash all 5 patches into one or just the first two ? In general I prefer to split commits so if something breaks it's easier to know what is wrong in a particular commit and possibly revert it, without losing all changes. On 2020-03-09 16:45, Jacek Caban wrote: Hi Steve, On 04.03.2020 15:27, Steve Lhomme wrote: Use the generated dxvahd.h --- mingw-w64-headers/Makefile.am | 1 + mingw-w64-headers/include/dxvahd.h | 841 ++- mingw-w64-headers/include/dxvahd.idl | 427 ++ 3 files changed, 990 insertions(+), 279 deletions(-) create mode 100644 mingw-w64-headers/include/dxvahd.idl Please merge those patches. There is no need to add methods in wrong order only to reorder them later in the series. Thanks, Jacek ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public