On Sat, 14 Dec 2024, Pali Rohár wrote:

On Tuesday 03 December 2024 16:31:16 Martin Storsjö wrote:
On Wed, 27 Nov 2024, Pali Rohár wrote:

This ensures that mingwex wprintf implementation will not be used and
statically linked when not needed. And also make it more predictable as %ls
format is always using wide string.

But the mingwex implementation shouldn't really be used here anyway? All of
mingw-w64-crt is compiled with -D__USE_MINGW_ANSI_STDIO=0?

So this shouldn't have any functional effect, it only makes things clearer -
or do I misunderstand something here?

---
mingw-w64-crt/crt/crtexe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c
index cdf5dcd25894..2c6fbd7e7062 100644
--- a/mingw-w64-crt/crt/crtexe.c
+++ b/mingw-w64-crt/crt/crtexe.c
@@ -89,8 +89,8 @@ __mingw_invalidParameterHandler (const wchar_t * 
__UNUSED_PARAM_1(expression),
                                 uintptr_t __UNUSED_PARAM(pReserved))
{
#ifdef __MINGW_SHOW_INVALID_PARAMETER_EXCEPTION
-  wprintf(L"Invalid parameter detected in function %s. File: %s Line: %d\n", 
function, file, line);
-  wprintf(L"Expression: %s\n", expression);
+  __ms_wprintf(L"Invalid parameter detected in function %ls. File: %ls Line: 
%d\n", function, file, line);
+  __ms_wprintf(L"Expression: %ls\n", expression);
#endif
}

Both before and after this change, I get errors due to calling an undefined
function, if I compile this file with
-D__MINGW_SHOW_INVALID_PARAMETER_EXCEPTION - so I'd like to have that fixed
too before I'd be willing to take on this change.

// Martin

Should be fixed by changes which I sent to the list, which defines all
__ms_* stdio functions for UCRT builds.

It makes no difference - these files in mingw-w64-crt are built with with a fixed __MSVCRT_VERSION__, independent of the default mode in the headers.

Please test compiling this file yourself with -D__MINGW_SHOW_INVALID_PARAMETER_EXCEPTION; before this change, it errors out with

../crt/crtexe.c:90:3: error: call to undeclared function 'wprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 90 | wprintf(L"Invalid parameter detected in function %s. File: %s Line: %d\n", function, file, line);
      |   ^

and with this change:


../crt/crtexe.c:90:3: error: call to undeclared function '__ms_wprintf'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 90 | __ms_wprintf(L"Invalid parameter detected in function %ls. File: %ls Line: %d\n", function, file, line);
      |   ^

// Martin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to