[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-19 Thread i.nixman at autistici dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #16 from niXman  ---
(In reply to nightstrike from comment #15)
> Someone on irc (jakub?) suggested just changing all of the aborts to
> gcc_unreachable. Is that a viable option?

I like that idea, I'm not sure it will be accepted...

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-14 Thread nightstrike at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

nightstrike  changed:

   What|Removed |Added

 CC||nightstrike at gmail dot com

--- Comment #15 from nightstrike  ---
Someone on irc (jakub?) suggested just changing all of the aborts to
gcc_unreachable. Is that a viable option?

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-09 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #14 from Jonathan Wakely  ---
Yes. Your mingw headers have changed, adding  which is incompatible
with the 'abort' macro in the GCC sources.

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-08 Thread i.nixman at autistici dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #13 from niXman  ---
could it be because now as host toolchain used a version which contains the
changes LIU Hao is talked about?

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-08 Thread i.nixman at autistici dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #12 from niXman  ---
guys, does anyone have an idea why I faced with the error on gcc-12.2.0 ?

```
../../../../src/gcc-12.2.0/libcpp/system.h:404:30: error: expected identifier
before string constant
  404 | #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
  |  ^~~~
../../../../src/gcc-12.2.0/libcpp/system.h:404:30: error: expected ',' or '...'
before string constant
../../../../src/gcc-12.2.0/libcpp/system.h:404:30: error: expected identifier
before string constant
  404 | #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
  |  ^~~~
../../../../src/gcc-12.2.0/libcpp/system.h:404:30: error: expected ',' or '...'
before string constant
make[3]: *** [Makefile:227: files.o] Error 1
```

until recently I successfully built this version, but now for some reason I get
that error...

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-07 Thread arsen at aarsen dot me via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #11 from Arsen Arsenović  ---
(In reply to LIU Hao from comment #10)
> I think Jonathan's proposal makes it unnecessarily complex. Renaming `abort`
> to `gcc_fancy_abort`, as well as all invocations accordingly, should be much
> simpler than those inline functions and `__builtin_*` stuff.

This feels like an increase in development overhead and potential for error. 
The approach described by Jonathan is pretty standard, and it doesn't really
have a cost at all.

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-07 Thread lh_mouse at 126 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #10 from LIU Hao  ---
(In reply to Arsen Arsenović from comment #9)
> (In reply to LIU Hao from comment #8)
> > The commit above just lets GCC bootstrap on Windows. The cause of this issue
> > is still there.
> > 
> > Maybe it's possible to replace all direct calls to `abort()` in gcc and
> > libcpp with `fancy_abort (__FILE__, __LINE__, __FUNCTION__)`, and eventually
> > get rid of that macro.
> 
> See Jonathans comment above.  I'll do that refactor this week, likely.

I think Jonathan's proposal makes it unnecessarily complex. Renaming `abort` to
`gcc_fancy_abort`, as well as all invocations accordingly, should be much
simpler than those inline functions and `__builtin_*` stuff.

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-07 Thread arsen at aarsen dot me via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #9 from Arsen Arsenović  ---
(In reply to LIU Hao from comment #8)
> The commit above just lets GCC bootstrap on Windows. The cause of this issue
> is still there.
> 
> Maybe it's possible to replace all direct calls to `abort()` in gcc and
> libcpp with `fancy_abort (__FILE__, __LINE__, __FUNCTION__)`, and eventually
> get rid of that macro.

See Jonathans comment above.  I'll do that refactor this week, likely.

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-07 Thread lh_mouse at 126 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #8 from LIU Hao  ---
The commit above just lets GCC bootstrap on Windows. The cause of this issue is
still there.

Maybe it's possible to replace all direct calls to `abort()` in gcc and libcpp
with `fancy_abort (__FILE__, __LINE__, __FUNCTION__)`, and eventually get rid
of that macro.

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-07 Thread i.nixman at autistici dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #7 from niXman  ---
(In reply to CVS Commits from comment #6)
> The master branch has been updated by Jonathan Yong :
> 
> https://gcc.gnu.org/g:902c755930326cb4405672aa3ea13c35c653cbff
> 
> commit r13-5055-g902c755930326cb4405672aa3ea13c35c653cbff
> Author: LIU Hao 
> Date:   Fri Jan 6 23:18:15 2023 +0800
> 
> Always define `WIN32_LEAN_AND_MEAN` before 
> 
> Recently, mingw-w64 has got updated  from Wine which is included
> indirectly by  if `WIN32_LEAN_AND_MEAN` is not defined. The
> `IXMLDOMDocument` class has a member function named `abort()`, which gets
> affected by our `abort()` macro in "system.h".
> 
> `WIN32_LEAN_AND_MEAN` should, nevertheless, always be defined. This
> can exclude 'APIs such as Cryptography, DDE, RPC, Shell, and Windows
> Sockets' [1], and speed up compilation of these files a bit.
> 
> [1]
> https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-
> headers
> 
> gcc/
> 
> PR middle-end/108300
> * config/xtensa/xtensa-dynconfig.c: Define `WIN32_LEAN_AND_MEAN`
> before .
> * diagnostic-color.cc: Likewise.
> * plugin.cc: Likewise.
> * prefix.cc: Likewise.
> 
> gcc/ada/
> 
> PR middle-end/108300
> * adaint.c: Define `WIN32_LEAN_AND_MEAN` before `#include
> `.
> * cio.c: Likewise.
> * ctrl_c.c: Likewise.
> * expect.c: Likewise.
> * gsocket.h: Likewise.
> * mingw32.h: Likewise.
> * mkdir.c: Likewise.
> * rtfinal.c: Likewise.
> * rtinit.c: Likewise.
> * seh_init.c: Likewise.
> * sysdep.c: Likewise.
> * terminals.c: Likewise.
> * tracebak.c: Likewise.
> 
> gcc/jit/
> 
> PR middle-end/108300
> * jit-w32.h: Define `WIN32_LEAN_AND_MEAN` before .
> 
> libatomic/
> 
> PR middle-end/108300
> * config/mingw/lock.c: Define `WIN32_LEAN_AND_MEAN` before
> .
> 
> libffi/
> 
> PR middle-end/108300
> * src/aarch64/ffi.c: Define `WIN32_LEAN_AND_MEAN` before
> .
> 
> libgcc/
> 
> PR middle-end/108300
> * config/i386/enable-execute-stack-mingw32.c: Define
> `WIN32_LEAN_AND_MEAN` before .
> * libgcc2.c: Likewise.
> * unwind-generic.h: Likewise.
> 
> libgfortran/
> 
> PR middle-end/108300
> * intrinsics/sleep.c: Define `WIN32_LEAN_AND_MEAN` before
> .
> 
> libgomp/
> 
> PR middle-end/108300
> * config/mingw32/proc.c: Define `WIN32_LEAN_AND_MEAN` before
> .
> 
> libiberty/
> 
> PR middle-end/108300
> * make-temp-file.c: Define `WIN32_LEAN_AND_MEAN` before
> .
> * pex-win32.c: Likewise.
> 
> libssp/
> 
> PR middle-end/108300
> * ssp.c: Define `WIN32_LEAN_AND_MEAN` before .
> 
> libstdc++-v3/
> 
> PR middle-end/108300
> * src/c++11/system_error.cc: Define `WIN32_LEAN_AND_MEAN` before
> .
> * src/c++11/thread.cc: Likewise.
> * src/c++17/fs_ops.cc: Likewise.
> * src/filesystem/ops.cc: Likewise.
> 
> libvtv/
> 
> PR middle-end/108300
> * vtv_malloc.cc: Define `WIN32_LEAN_AND_MEAN` before .
> * vtv_rts.cc: Likewise.
> * vtv_utils.cc: Likewise.

now it bootstrapped OK, thanks!

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-06 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Jonathan Yong :

https://gcc.gnu.org/g:902c755930326cb4405672aa3ea13c35c653cbff

commit r13-5055-g902c755930326cb4405672aa3ea13c35c653cbff
Author: LIU Hao 
Date:   Fri Jan 6 23:18:15 2023 +0800

Always define `WIN32_LEAN_AND_MEAN` before 

Recently, mingw-w64 has got updated  from Wine which is included
indirectly by  if `WIN32_LEAN_AND_MEAN` is not defined. The
`IXMLDOMDocument` class has a member function named `abort()`, which gets
affected by our `abort()` macro in "system.h".

`WIN32_LEAN_AND_MEAN` should, nevertheless, always be defined. This
can exclude 'APIs such as Cryptography, DDE, RPC, Shell, and Windows
Sockets' [1], and speed up compilation of these files a bit.

[1]
https://learn.microsoft.com/en-us/windows/win32/winprog/using-the-windows-headers

gcc/

PR middle-end/108300
* config/xtensa/xtensa-dynconfig.c: Define `WIN32_LEAN_AND_MEAN`
before .
* diagnostic-color.cc: Likewise.
* plugin.cc: Likewise.
* prefix.cc: Likewise.

gcc/ada/

PR middle-end/108300
* adaint.c: Define `WIN32_LEAN_AND_MEAN` before `#include
`.
* cio.c: Likewise.
* ctrl_c.c: Likewise.
* expect.c: Likewise.
* gsocket.h: Likewise.
* mingw32.h: Likewise.
* mkdir.c: Likewise.
* rtfinal.c: Likewise.
* rtinit.c: Likewise.
* seh_init.c: Likewise.
* sysdep.c: Likewise.
* terminals.c: Likewise.
* tracebak.c: Likewise.

gcc/jit/

PR middle-end/108300
* jit-w32.h: Define `WIN32_LEAN_AND_MEAN` before .

libatomic/

PR middle-end/108300
* config/mingw/lock.c: Define `WIN32_LEAN_AND_MEAN` before
.

libffi/

PR middle-end/108300
* src/aarch64/ffi.c: Define `WIN32_LEAN_AND_MEAN` before
.

libgcc/

PR middle-end/108300
* config/i386/enable-execute-stack-mingw32.c: Define
`WIN32_LEAN_AND_MEAN` before .
* libgcc2.c: Likewise.
* unwind-generic.h: Likewise.

libgfortran/

PR middle-end/108300
* intrinsics/sleep.c: Define `WIN32_LEAN_AND_MEAN` before
.

libgomp/

PR middle-end/108300
* config/mingw32/proc.c: Define `WIN32_LEAN_AND_MEAN` before
.

libiberty/

PR middle-end/108300
* make-temp-file.c: Define `WIN32_LEAN_AND_MEAN` before
.
* pex-win32.c: Likewise.

libssp/

PR middle-end/108300
* ssp.c: Define `WIN32_LEAN_AND_MEAN` before .

libstdc++-v3/

PR middle-end/108300
* src/c++11/system_error.cc: Define `WIN32_LEAN_AND_MEAN` before
.
* src/c++11/thread.cc: Likewise.
* src/c++17/fs_ops.cc: Likewise.
* src/filesystem/ops.cc: Likewise.

libvtv/

PR middle-end/108300
* vtv_malloc.cc: Define `WIN32_LEAN_AND_MEAN` before .
* vtv_rts.cc: Likewise.
* vtv_utils.cc: Likewise.

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-06 Thread lh_mouse at 126 dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

--- Comment #5 from LIU Hao  ---
A quick and obvious fix is to add `CPPFLAGS='-DWIN32_LEAN_AND_MEAN'` when
configuring. Bootstrapped successfully on {i686,x86_64}-w64-mingw32.

I still think GCC source files should be patched.

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-06 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

Andrew Pinski  changed:

   What|Removed |Added

 CC||i.nixman at autistici dot org

--- Comment #4 from Andrew Pinski  ---
*** Bug 108313 has been marked as a duplicate of this bug. ***

[Bug middle-end/108300] `abort()` macro cause bootstrap failure on *-w64-mingw32

2023-01-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108300

Andrew Pinski  changed:

   What|Removed |Added

  Component|bootstrap   |middle-end
   Keywords||build

--- Comment #3 from Andrew Pinski  ---
This is remnant of when GCC was C code ...
I suspect there are other code like this too in system.h.