On Tue, 19 Nov 2024, Pali Rohár wrote:
C99 vscanf-family functions are natively available since msvcr120.
This change allows to use native UCRT and msvcr120 C99 vscanf-family
functions.
I think this commit message would require a much longer explanation about
the status quo of these functions - I didn't quite remember what the
situation was, and I felt surprised to read that we didn't use the native
vscanf family of functions in the UCRT.
From a brief digging around, I see that for e.g. vsscanf, we have:
- stdio/vsscanf2.S, providing vsscanf, redirecting to __ms_vsscanf
- stdio/vsscanf.c, providing __ms_vsscanf, calling __argtos
- stdio/scanf.S, providing __argtos, which converts from a va_list back to
parameters on the stack, and calls sscanf()
And this, because older msvcr*.dll doesn't provide v*scanf functions at
all. The stdio/scanf.S file has got quite good comments explaining parts
of it. But some parts of the comments there feel inaccurate (like "This is
needed because mingw-w64 uses msvcr100.dll" - that's not really the
default anywhere), so a patch to fix up inaccuracies in the comments there
would be nice.
And now we move this to the older msvcr* import libraries, because we
actually do have proper v*scanf in msvcr120 and UCRT.
So this seems reasonable, but the commit message needs an explanation that
explanins this, as it's not at all very clear.
(The surprise about this situation was what converted my reaction on this
patchset from "seems straightforward and probably good", to "wait, what? I
need to look into that"; having more such explanations in the commit
messages makes it easier to reason about the patch.)
Can you try to write that up? Otherwise I can try to have a look at
writing it tomorrow.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public