On Tuesday 24 June 2025 14:32:21 Martin Storsjö wrote:
> On Sat, 21 Jun 2025, Pali Rohár wrote:
> 
> > AM_CFLAGS contains cflags required to build the mingw-w64 CRT source code.
> > They are not intended to compile applications (including those used in
> > mingw-w64 testsuite). Setting per-target <target>_CFLAGS variable
> > overwrites the AM_CFLAGS. So for every testcase sets the custom
> > <target>_CFLAGS variable. This ensures that the testcase would not be
> > compiled with -D_CRTBLD or -D__MSVCRT_VERSION__=0x600 which is unsuitable
> > when the mingw-w64 uses the UCRT by default.
> > ---
> > Should be applied on top of the:
> > - "crt: Improve LFS 64-bit functions"
> > - "crt: Improve LFS 64-bit functions (part 2)"
> > - crt: Fix _*stat32 and _*stat32i64 functions for 64-bit msvcrt.dll builds
> > ---
> > mingw-w64-crt/Makefile.am                   | 73 +++++++++++++++++++--
> > mingw-w64-crt/testcases/complex/Makefile.am | 50 ++++++++++++++
> > 2 files changed, 116 insertions(+), 7 deletions(-)
> 
> FWIW, this doesn't seem to be quite enough for making the existing testcases
> build properly.
> 
> I set up the CI to run these tests, with these patches applied:
> https://github.com/mstorsjo/mingw-w64/commits/refs/heads/ci-testsuite/
> 
> The run results are at 
> https://github.com/mstorsjo/mingw-w64/actions/runs/15848888686/job/44677297831,
> but you won't be able to see the logs if you're not logged in to github.
> 
> The issues encountered by both the Clang and GCC builds are:
> 
> ../testcases/t_ansi_io.c: In function 'main':
> ../testcases/t_ansi_io.c:11:10: fatal error: _mingw_print_push.h: No such
> file or directory
>    11 | #include <_mingw_print_push.h>
> 
> (This header was removed in 2018 in
> 70860d945e6be713af352ee62820bccb653589c2.)

Simple removal of those includes should be enough for the test purposes.

> ../testcases/t_trycatch.cpp:3:18: error: ISO C++17 does not allow dynamic
> exception specifications
>     3 | void foo (int d) throw (int)
>       |                  ^~~~~

Too new C++ version for that test.
https://en.cppreference.com/w/cpp/language/except_spec.html

But I'm not sure what the test wanted to do.

> 
> 
> Additionally, a UCRT build hits this error:
> 
> D:/a/_temp/msys64/gcc-mingw/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
> testcases/tstmain_sys_xxx-tstmain_sys_xxx.o: in function `main':
> D:\a\mingw-w64\mingw-w64\mingw-w64-crt\build/../testcases/tstmain_sys_xxx.c:13:(.text.startup+0xc):
> undefined reference to `__imp__sys_errlist'
> collect2.exe: error: ld returned 1 exit status
> make[2]: *** [Makefile:27717: testcases/tstmain_sys_xxx.exe] Error 1

_sys_errlist as a macro is available in stdlib.h for all platforms.

This change (untested) could fix it:

diff --git a/mingw-w64-crt/testcases/tstmain_sys_xxx.c 
b/mingw-w64-crt/testcases/tstmain_sys_xxx.c
index 9af48233e833..42d2d48fe181 100644
--- a/mingw-w64-crt/testcases/tstmain_sys_xxx.c
+++ b/mingw-w64-crt/testcases/tstmain_sys_xxx.c
@@ -4,8 +4,7 @@
  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
  */
 #include <stdio.h>
-
-_CRTIMP char *_sys_errlist[];
+#include <stdlib.h>
 
 int main(int argc, char **argv)
 {


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

Reply via email to