Skip to content

Commit e8b0df3

Browse files
lhmousestephanosio
authored andcommitted
Always define WIN32_LEAN_AND_MEAN before <windows.h>
Recently, mingw-w64 has got updated <msxml.h> from Wine which is included indirectly by <windows.h> 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 <windows.h>. * 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 <windows.h>`. * 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 <windows.h>. libatomic/ PR middle-end/108300 * config/mingw/lock.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>. libffi/ PR middle-end/108300 * src/aarch64/ffi.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>. libgcc/ PR middle-end/108300 * config/i386/enable-execute-stack-mingw32.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>. * libgcc2.c: Likewise. * unwind-generic.h: Likewise. libgfortran/ PR middle-end/108300 * intrinsics/sleep.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>. libgomp/ PR middle-end/108300 * config/mingw32/proc.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>. libiberty/ PR middle-end/108300 * make-temp-file.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>. * pex-win32.c: Likewise. libssp/ PR middle-end/108300 * ssp.c: Define `WIN32_LEAN_AND_MEAN` before <windows.h>. libstdc++-v3/ PR middle-end/108300 * src/c++11/system_error.cc: Define `WIN32_LEAN_AND_MEAN` before <windows.h>. * 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 <windows.h>. * vtv_rts.cc: Likewise. * vtv_utils.cc: Likewise. (cherry picked from commit 902c755) Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
1 parent c378752 commit e8b0df3

File tree

37 files changed

+40
-0
lines changed

37 files changed

+40
-0
lines changed

gcc/ada/adaint.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ UINT __gnat_current_ccs_encoding;
231231

232232
#elif defined (_WIN32)
233233

234+
#define WIN32_LEAN_AND_MEAN
234235
#include <windows.h>
235236
#include <accctrl.h>
236237
#include <aclapi.h>

gcc/ada/cio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ extern "C" {
6767
#endif
6868

6969
#ifdef RTX
70+
#define WIN32_LEAN_AND_MEAN
7071
#include <windows.h>
7172
#include <Rtapi.h>
7273
#endif

gcc/ada/ctrl_c.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ __gnat_uninstall_int_handler (void)
126126

127127
#elif defined (__MINGW32__)
128128

129+
#define WIN32_LEAN_AND_MEAN
129130
#include "mingw32.h"
130131
#include <windows.h>
131132

gcc/ada/expect.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575

7676
#ifdef _WIN32
7777

78+
#define WIN32_LEAN_AND_MEAN
7879
#include <windows.h>
7980
#include <process.h>
8081
#include <signal.h>

gcc/ada/gsocket.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173

174174
#endif
175175

176+
#define WIN32_LEAN_AND_MEAN
176177
#include <windows.h>
177178

178179
#elif defined(VMS)

gcc/ada/mingw32.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#define _X86INTRIN_H_INCLUDED
5959
#define _EMMINTRIN_H_INCLUDED
6060
#endif
61+
#define WIN32_LEAN_AND_MEAN
6162
#include <windows.h>
6263

6364
/* After including this file it is possible to use the character t as prefix

gcc/ada/mkdir.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#endif
4444

4545
#ifdef __MINGW32__
46+
#define WIN32_LEAN_AND_MEAN
4647
#include "mingw32.h"
4748
#include <windows.h>
4849
#ifdef MAXPATHLEN

gcc/ada/rtfinal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ extern int __gnat_rt_init_count;
4646
/* see initialize.c */
4747

4848
#if defined (__MINGW32__)
49+
#define WIN32_LEAN_AND_MEAN
4950
#include "mingw32.h"
5051
#include <windows.h>
5152

gcc/ada/rtinit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ int __gnat_rt_init_count = 0;
7070
and finalize properly the run-time. */
7171

7272
#if defined (__MINGW32__)
73+
#define WIN32_LEAN_AND_MEAN
7374
#include "mingw32.h"
7475
#include <windows.h>
7576

gcc/ada/seh_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
#if defined (_WIN32) || (defined (__CYGWIN__) && defined (__SEH__))
3636
/* Include system headers, before system.h poisons malloc. */
37+
#define WIN32_LEAN_AND_MEAN
3738
#include <windows.h>
3839
#include <excpt.h>
3940
#endif

0 commit comments

Comments
 (0)