Re: [PATCH] Always define `WIN32_LEAN_AND_MEAN` before

2023-03-05 Thread Ian Lance Taylor via Gcc-patches
On Fri, Mar 3, 2023 at 10:47 PM Xi Ruoyao  wrote:
>
> On Sat, 2023-01-07 at 06:52 +, Jonathan Yong via Gcc-patches wrote:
> > On 1/6/23 18:10, Jakub Jelinek wrote:
> > > On Sat, Jan 07, 2023 at 02:01:05AM +0800, LIU Hao via Gcc-patches
> > > wrote:
> > > > libgomp/
> > > >
> > > > PR middle-end/108300
> > > > * config/mingw32/proc.c: Define `WIN32_LEAN_AND_MEAN`
> > > > before
> > > > .
> > >
> > > This change is ok for trunk.
> > >
> > > Jakub
> > >
> >
> > Pushed to master branch, thanks LH.
>
> The patch touches libgo (w/o mentioning it in the ChangeLog).  I guess
> you need to contribute the libgo part into the upstream Go runtime or
> the change will be undone when Ian merges libgo next time.

Thanks, I've reverted the part of the patch that applies to libgo.

It's not worth changing upstream because gccgo doesn't support Windows
anyhow, and because that change is gone in the even-more-upstream
sources.

Ian


Re: [PATCH] Always define `WIN32_LEAN_AND_MEAN` before

2023-03-03 Thread Xi Ruoyao via Gcc-patches
On Sat, 2023-01-07 at 06:52 +, Jonathan Yong via Gcc-patches wrote:
> On 1/6/23 18:10, Jakub Jelinek wrote:
> > On Sat, Jan 07, 2023 at 02:01:05AM +0800, LIU Hao via Gcc-patches
> > wrote:
> > > libgomp/
> > > 
> > > PR middle-end/108300
> > > * config/mingw32/proc.c: Define `WIN32_LEAN_AND_MEAN`
> > > before
> > > .
> > 
> > This change is ok for trunk.
> > 
> > Jakub
> > 
> 
> Pushed to master branch, thanks LH.

The patch touches libgo (w/o mentioning it in the ChangeLog).  I guess
you need to contribute the libgo part into the upstream Go runtime or
the change will be undone when Ian merges libgo next time.

-- 
Xi Ruoyao 
School of Aerospace Science and Technology, Xidian University


Re: [PATCH] Always define `WIN32_LEAN_AND_MEAN` before

2023-01-06 Thread Jonathan Yong via Gcc-patches

On 1/6/23 18:10, Jakub Jelinek wrote:

On Sat, Jan 07, 2023 at 02:01:05AM +0800, LIU Hao via Gcc-patches wrote:

libgomp/

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


This change is ok for trunk.

Jakub



Pushed to master branch, thanks LH.



Re: [PATCH] Always define `WIN32_LEAN_AND_MEAN` before

2023-01-06 Thread Jakub Jelinek via Gcc-patches
On Sat, Jan 07, 2023 at 02:01:05AM +0800, LIU Hao via Gcc-patches wrote:
> libgomp/
> 
>   PR middle-end/108300
>   * config/mingw32/proc.c: Define `WIN32_LEAN_AND_MEAN` before
>   .

This change is ok for trunk.

Jakub



[PATCH] Always define `WIN32_LEAN_AND_MEAN` before

2023-01-06 Thread LIU Hao via Gcc-patches

This fixes bootstrap issues with current mingw-w64 headers:

   ```
   ../../gcc/gcc/system.h:791:30: error: expected identifier before string 
constant
 791 | #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
 |  ^~~~
   ```


The changes in this commit were generated by the following command, with some 
post-processing:

   ```
   sed -Ei 's,^( *)#( *)include ,\1#\2define 
WIN32_LEAN_AND_MEAN\n&,'  \
 $(grep -Flr "")
   ```


This has been tested with C, C++, LTO, Fortran, Objective-C, Objective-C++ and JIT, on 
{i868,x86_64}-w64-mingw32; but it contains changes to Ada, libgo, libgomp and libvtv, which I don't 
usually build and test.





--
Best regards,
LIU Hao
From 6600e2b135bd06b2aad77e538b47a480c8deebdd Mon Sep 17 00:00:00 2001
From: LIU Hao 
Date: Fri, 6 Jan 2023 23:18:15 +0800
Subject: [PATCH] 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
.

libgo/

PR middle-end/108300
* misc/cgo/test/callback_c.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.
---
 gcc/ada/adaint.c  | 1 +
 gcc/ada/cio.c | 1 +
 gcc/ada/ctrl_c.c  | 1 +
 gcc/ada/expect.c  | 1 +
 gcc/ada/gsocket.h | 1 +
 gcc/ada/mingw32.h | 1 +
 gcc/ada/mkdir.c   | 1 +
 gcc/ada/rtfinal.c | 1 +
 gcc/ada/rtinit.c  | 1 +
 gcc/ada/seh_init.c| 1 +
 gcc/ada/sysdep.c  | 2 ++
 gcc/ada/terminals.c   | 1 +
 gcc/ada/tracebak.c| 2 ++
 gcc/config/xtensa/xtensa-dynconfig.c  | 1 +
 gcc/diagnostic-color.cc   | 1 +
 gcc/jit/jit-w32.h | 1 +
 gcc/plugin.cc | 1 +
 gcc/prefix.cc | 1 +
 libatomic/config/mingw/lock.c | 1 +
 libffi/src/aarch64/ffi.c  | 1 +
 libgcc/config/i386/enable-execute-stack-mingw32.c | 1 +
 libgcc/libgcc2.c