Re: [Mingw-w64-public] [PATCH] headers: Hide the contents of struct _iobuf in UCRT mode
在 2021-03-26 20:19, Martin Storsjö 写道: This matches the public UCRT headers - the struct only contains one single placeholder member. Signed-off-by: Martin Storsjö --- mingw-w64-headers/crt/stdio.h | 4 1 file changed, 4 insertions(+) This patch looks good to me, as we have concluded. -- Best regards, Liu Hao OpenPGP_signature Description: OpenPGP digital signature ___ 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: Hide the contents of struct _iobuf in UCRT mode
This matches the public UCRT headers - the struct only contains one single placeholder member. Signed-off-by: Martin Storsjö --- mingw-w64-headers/crt/stdio.h | 4 1 file changed, 4 insertions(+) diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h index 89bfa1473..c7617798f 100644 --- a/mingw-w64-headers/crt/stdio.h +++ b/mingw-w64-headers/crt/stdio.h @@ -22,6 +22,9 @@ extern "C" { #ifndef _FILE_DEFINED struct _iobuf { +#ifdef _UCRT +void *_Placeholder; +#else char *_ptr; int _cnt; char *_base; @@ -30,6 +33,7 @@ extern "C" { int _charbuf; int _bufsiz; char *_tmpfname; +#endif }; typedef struct _iobuf FILE; #define _FILE_DEFINED -- 2.25.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: Update the layout of struct _iobuf to match the layout used in UCRT
在 2021/3/26 下午7:51, Martin Storsjö 写道: That also brings up the question about the origin of pointing out this mismatching struct (by "sotrdg sotrdg" on the list a couple days ago) - was there code that used those fields, noticing that it didn't do the right thing in UCRT builds? Or just reading/inspecting of source, comparing things? I know this guy, and I had been criticizing him for hacking implementation details, just like what he is doing now. I think following MS new definition (which contains only a `void*` field) is the right way to go. If you wonder whether there was code that used those fields, probably; but I am pretty sure there will be [1], because he did the same to Glibc's `FILE` struct. [1] https://github.com/expnkx/fast_io -- Best regards, Liu Hao OpenPGP_signature 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] headers: Update the layout of struct _iobuf to match the layout used in UCRT
On Fri, 26 Mar 2021, Jacek Caban wrote: On 26/03/2021 12:22, Martin Storsjö wrote: As there's no code that could be using the new UCRT spelling using any public headers, there's nothing we can try to remain compatible with in that case, so we'd only be setting new predecent (i.e. if building with mingw headers, and iff targeting UCRT, then access the field with a different name). I.e., I'm a bit hesitant about whether we should be doing this at all, or if we should follow suit and make it a similar struct containing only the first member instead? In my opinion it was the right call by Microsoft to do that, so it would be nice to follow. Sure, that sounds sensible to me too. That also brings up the question about the origin of pointing out this mismatching struct (by "sotrdg sotrdg" on the list a couple days ago) - was there code that used those fields, noticing that it didn't do the right thing in UCRT builds? Or just reading/inspecting of source, comparing things? // 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: Update the layout of struct _iobuf to match the layout used in UCRT
On 26/03/2021 12:22, Martin Storsjö wrote: As there's no code that could be using the new UCRT spelling using any public headers, there's nothing we can try to remain compatible with in that case, so we'd only be setting new predecent (i.e. if building with mingw headers, and iff targeting UCRT, then access the field with a different name). I.e., I'm a bit hesitant about whether we should be doing this at all, or if we should follow suit and make it a similar struct containing only the first member instead? In my opinion it was the right call by Microsoft to do that, so it would be nice to follow. 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] headers: Update the layout of struct _iobuf to match the layout used in UCRT
On Fri, 26 Mar 2021, Liu Hao wrote: 在 2021/3/26 上午4:56, Martin Storsjö 写道: diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h (...) int _flag; int _file; These fields have been changed to `long`s in UCRT (although there is no difference in the representation), Sure, maybe and `_flag` has been renamed to the plural form `_flags`. How about updating them as well? Hmm. The thing is that since this struct actually isn't available in the public UCRT headers (where it's a pretty opaque struct containing only the first member), I'm not sure what code we should try to be compatible with. The only cases where one could have preexisting code that accesses these fields, is for old mingw headers targeting msvcrt.dll, or older MSVC versions targeting msvcrXX.dll (or statically linked). As there's no code that could be using the new UCRT spelling using any public headers, there's nothing we can try to remain compatible with in that case, so we'd only be setting new predecent (i.e. if building with mingw headers, and iff targeting UCRT, then access the field with a different name). I.e., I'm a bit hesitant about whether we should be doing this at all, or if we should follow suit and make it a similar struct containing only the first member instead? // 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: Update the layout of struct _iobuf to match the layout used in UCRT
在 2021/3/26 上午4:56, Martin Storsjö 写道: diff --git a/mingw-w64-headers/crt/stdio.h b/mingw-w64-headers/crt/stdio.h (...) int _flag; int _file; These fields have been changed to `long`s in UCRT (although there is no difference in the representation), and `_flag` has been renamed to the plural form `_flags`. How about updating them as well? -- Best regards, Liu Hao OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public