On Thu, 19 Dec 2024, Pali Rohár wrote:

Do note that the w- functions currently default to using
_CRT_INTERNAL_PRINTF_LEGACY_WIDE_SPECIFIERS, even if this conflicts with
what the C standards say about how it should behave. This is also the
default behaviour in MSVC, so for cross compatibility in code targeting
Windows, we've intentionally decided to match the MSVC behaviour rather than
hard sticking to the standard.

For msvcrt builds in C99+ mode, by default is used mingw stdio
implementation and its w- functions are correct, no legacy.

So switching from msvcrt builds to ucrt builds, w- functions are not
correct anymore.

It is correct? Should not we rather make consistent behavior?

I'm not entirely decided.

Also, as long as the wchar stdio functions are implemented as inline (which
admittedly has some other issues), it's possible to override
_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS before including stdio.h, to pick a
different preference wrt this - this should work pretty much in the same way
as it does for MSVC.

I'm not sure if we want to have those functions as inline... I think we
have relevant issues with them and seems that it is better to not use
inline functions...

Yes, inline functions do cause a bunch of other issues, so ideally they would be avoided.

If the problem is Makefile size, I can try to look how to decrease its
size.

It's not a hard thing that we must reduce it - but e.g. for this case, for adding a dozen of extra files just for the __ms_* symbols (which I feel like is a lot of extra files for something which I didn't feel warrants that much space), I want to look at alternatives.

The main thing that causes our makefiles to be huge, is that most declarations are duplicated 4 times, for all architectures. But AFAIK this was an intentional design or even feature originally, that you can build mingw-w64-crt for both 32 and 64 bit at the same time, for multilib gcc setups. But changing this architecture would be a whole lot of rework too.

To be honest, I'm not sure I want to go down this route, I already dread the amount of review effort to look through it :-)

(However with MSVC, _CRT_INTERNAL_LOCAL_PRINTF_OPTIONS
defaults to using __local_stdio_printf_options(), and it's possible to
override this behaviour also by linking in an object file - we don't match
that aspect, yet at least.)

// Martin

We can extend code to support this. I think that this could not be hard.

Indeed, it's probably quite doable, and that would allow changing the defaults also for non-inline functions - patches for doing this would probably be welcome.

// Martin

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to