Re: [Mingw-w64-public] _FILE_OFFSET_BITS + stat macro + conflicts

2022-01-21 Thread Christoph Reiter
On Fri, Jan 21, 2022 at 6:47 PM LRN wrote: > > On 21.01.2022 17:32, Christoph Reiter wrote: > > > > when _FILE_OFFSET_BITS is defined (ideally Windows code shouldn't > > depend on it, but here we are) mingw-w64 does this: > > > > https://github.com/mingw-w64/mingw-w64/blob/898141aa957b99812f2f4d2c

Re: [Mingw-w64-public] _FILE_OFFSET_BITS + stat macro + conflicts

2022-01-21 Thread LRN
On 21.01.2022 17:32, Christoph Reiter wrote: when _FILE_OFFSET_BITS is defined (ideally Windows code shouldn't depend on it, but here we are) mingw-w64 does this: https://github.com/mingw-w64/mingw-w64/blob/898141aa957b99812f2f4d2cf89255798d578d54/mingw-w64-headers/crt/sys/stat.h#L279 This s

Re: [Mingw-w64-public] [PATCH] crt: Move misc/seterrno.c from src_libmingwex into src_msvcrt32 and src_msvcrt64

2022-01-21 Thread LIU Hao
在 2022-01-21 22:53, Martin Storsjö 写道: The _set_errno function is defined in arm versions of msvcrt.dll, and in all the newer numbered versions of msvcr*.dll, and UCRT. This avoids issues with the recently added _vscprintf in libmsvcrt.a which depends on _set_errno, which was present in libmingw

[Mingw-w64-public] [PATCH] crt: Move misc/seterrno.c from src_libmingwex into src_msvcrt32 and src_msvcrt64

2022-01-21 Thread Martin Storsjö
The _set_errno function is defined in arm versions of msvcrt.dll, and in all the newer numbered versions of msvcr*.dll, and UCRT. This avoids issues with the recently added _vscprintf in libmsvcrt.a which depends on _set_errno, which was present in libmingwex.a. When linking with ld.bfd, a later l

Re: [Mingw-w64-public] [PATCH 1/2] crt: Add fallback _vscprintf() implementation

2022-01-21 Thread Martin Storsjö
On Fri, 21 Jan 2022, LIU Hao wrote: This seems easy to reproduce in MSYS2: ``` lh_mouse@lhmouse-pc ~/Desktop $ cat conftest.c extern int snprintf(char*, unsigned, const char*, ...); int main(void) { char temp[42]; snprintf(temp, 10, ""); } lh_mouse@lhmouse-pc ~/Desktop $ gcc conft

[Mingw-w64-public] _FILE_OFFSET_BITS + stat macro + conflicts

2022-01-21 Thread Christoph Reiter
Hey, when _FILE_OFFSET_BITS is defined (ideally Windows code shouldn't depend on it, but here we are) mingw-w64 does this: https://github.com/mingw-w64/mingw-w64/blob/898141aa957b99812f2f4d2cf89255798d578d54/mingw-w64-headers/crt/sys/stat.h#L279 Which replaces various things called "stat" in som

Re: [Mingw-w64-public] [PATCH 1/2] crt: Add fallback _vscprintf() implementation

2022-01-21 Thread LIU Hao
在 2022-01-21 18:51, Martin Storsjö 写道: That's strange, as _set_errno should be provided by libmingwex.a, which should be implicitly linked in at this stage? I tried bootstrapping a cross gcc toolchain with mingw-w64 898141aa957b99812f2f4d2cf89255798d578d54 targeting i686, with GCC 11.2.0, an

Re: [Mingw-w64-public] [PATCH 1/2] crt: Add fallback _vscprintf() implementation

2022-01-21 Thread Martin Storsjö
On Fri, 21 Jan 2022, LIU Hao wrote: Bootstrapping GCC now fails with this error: That's strange - I ``` gcc -c -DHAVE_CONFIG_H -g -D__USE_MINGW_ANSI_STDIO=1 -I. -I../../gcc/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic -D_GNU_SOU

Re: [Mingw-w64-public] [PATCH 1/2] crt: Add fallback _vscprintf() implementation

2022-01-21 Thread LIU Hao
Bootstrapping GCC now fails with this error: ``` gcc -c -DHAVE_CONFIG_H -g -D__USE_MINGW_ANSI_STDIO=1 -I. -I../../gcc/libiberty/../include -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic -D_GNU_SOURCE ../../gcc/libiberty/vfork.c -o vfork.o ../../gcc/libiber