From f9ee0d2f05b72d06f9be6f7d2d073972e5cb8801 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Thu, 7 Oct 2021 14:37:04 +0200
Subject: [PATCH] tools: Avoid using wine/port.h.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
 tools/make_xftmpl.c       |  4 ----
 tools/sfnt2fon/sfnt2fon.c |  1 -
 tools/widl/client.c       |  4 ----
 tools/widl/header.c       |  3 ---
 tools/widl/proxy.c        |  4 ----
 tools/widl/register.c     |  4 ----
 tools/widl/server.c       |  4 ----
 tools/widl/typegen.c      |  4 ----
 tools/widl/typelib.c      |  7 +------
 tools/widl/utils.c        |  1 -
 tools/widl/widl.c         |  4 ----
 tools/widl/write_msft.c   |  4 +---
 tools/winebuild/import.c  |  7 -------
 tools/winebuild/main.c    |  1 -
 tools/winebuild/parser.c  |  1 -
 tools/winebuild/relay.c   |  1 -
 tools/winebuild/res16.c   |  5 -----
 tools/winebuild/res32.c   |  5 -----
 tools/winebuild/spec16.c  |  1 -
 tools/winebuild/spec32.c  |  1 -
 tools/winebuild/utils.c   |  7 -------
 tools/winedump/debug.c    | 14 --------------
 tools/winedump/dos.c      | 13 -------------
 tools/winedump/dump.c     | 11 -----------
 tools/winedump/emf.c      |  9 +--------
 tools/winedump/font.c     | 10 ----------
 tools/winedump/le.c       |  4 ----
 tools/winedump/lib.c      | 10 ----------
 tools/winedump/lnk.c      | 11 ++---------
 tools/winedump/main.c     |  2 --
 tools/winedump/mf.c       |  3 +--
 tools/winedump/minidump.c |  4 +---
 tools/winedump/misc.c     |  2 --
 tools/winedump/msc.c      | 14 --------------
 tools/winedump/msmangle.c |  2 --
 tools/winedump/ne.c       |  6 +-----
 tools/winedump/nls.c      |  2 --
 tools/winedump/output.c   |  1 -
 tools/winedump/pdb.c      | 14 --------------
 tools/winedump/pe.c       | 14 --------------
 tools/winedump/search.c   |  2 --
 tools/winedump/symbol.c   |  2 --
 tools/winedump/tlb.c      |  2 --
 tools/winedump/winedump.h |  1 +
 tools/winegcc/utils.c     |  2 +-
 tools/winegcc/winegcc.c   |  1 -
 tools/wmc/po.c            |  1 -
 tools/wmc/utils.c         |  1 -
 tools/wmc/wmc.c           |  1 -
 tools/wmc/write.c         |  1 -
 tools/wrc/parser.y        |  2 +-
 tools/wrc/po.c            |  1 -
 tools/wrc/ppy.y           |  1 -
 tools/wrc/utils.c         |  1 -
 tools/wrc/wpp.c           |  4 ----
 tools/wrc/wrc.c           |  4 ----
 tools/wrc/writeres.c      |  1 -
 57 files changed, 11 insertions(+), 236 deletions(-)

diff --git a/tools/make_xftmpl.c b/tools/make_xftmpl.c
index 686beeb449c..b7f964c28d7 100644
--- a/tools/make_xftmpl.c
+++ b/tools/make_xftmpl.c
@@ -19,15 +19,11 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <signal.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 
 #include "windef.h"
 #include "guiddef.h"
diff --git a/tools/sfnt2fon/sfnt2fon.c b/tools/sfnt2fon/sfnt2fon.c
index 303293c18e5..0be1ce658b3 100644
--- a/tools/sfnt2fon/sfnt2fon.c
+++ b/tools/sfnt2fon/sfnt2fon.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <ctype.h>
diff --git a/tools/widl/client.c b/tools/widl/client.c
index 6ecae4187d3..1ce7d245311 100644
--- a/tools/widl/client.c
+++ b/tools/widl/client.c
@@ -19,13 +19,9 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <string.h>
 #include <ctype.h>
 
diff --git a/tools/widl/header.c b/tools/widl/header.c
index b149b8e2b9c..2a745b8a767 100644
--- a/tools/widl/header.c
+++ b/tools/widl/header.c
@@ -23,9 +23,6 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <string.h>
 #include <ctype.h>
 
diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c
index 457f29a2650..382f39d121f 100644
--- a/tools/widl/proxy.c
+++ b/tools/widl/proxy.c
@@ -20,13 +20,9 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <string.h>
 #include <ctype.h>
 
diff --git a/tools/widl/register.c b/tools/widl/register.c
index e13d8451f9e..634ddfbb87b 100644
--- a/tools/widl/register.c
+++ b/tools/widl/register.c
@@ -19,13 +19,9 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <string.h>
 #include <ctype.h>
 
diff --git a/tools/widl/server.c b/tools/widl/server.c
index cce880bbf66..58abc0dabe3 100644
--- a/tools/widl/server.c
+++ b/tools/widl/server.c
@@ -19,13 +19,9 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <string.h>
 #include <ctype.h>
 
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 2c1017b9f2b..f1c7db9c0e8 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -20,13 +20,9 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <string.h>
 #include <assert.h>
 #include <ctype.h>
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index 7f34aa4efcf..85cb140b7a6 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -20,21 +20,16 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <string.h>
 #include <ctype.h>
 
+#include "widl.h"
 #include "windef.h"
 #include "winbase.h"
-
-#include "widl.h"
 #include "utils.h"
 #include "wpp_private.h"
 #include "parser.h"
diff --git a/tools/widl/utils.c b/tools/widl/utils.c
index c11a7e40901..81558011d66 100644
--- a/tools/widl/utils.c
+++ b/tools/widl/utils.c
@@ -20,7 +20,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <stdio.h>
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index 97a26743cf3..e5a772e87bd 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -20,15 +20,11 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <errno.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <string.h>
 #include <assert.h>
 #include <ctype.h>
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index 228f58e2649..311b5017049 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -28,7 +28,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdlib.h>
 #include <string.h>
@@ -39,12 +38,11 @@
 
 #define NONAMELESSUNION
 
+#include "widl.h"
 #include "winerror.h"
 #include "windef.h"
 #include "winbase.h"
 #include "winnls.h"
-
-#include "widl.h"
 #include "typelib.h"
 #include "typelib_struct.h"
 #include "utils.h"
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 6a07ff08a94..104397716f1 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -20,7 +20,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <ctype.h>
@@ -28,12 +27,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 
 #include "wine/list.h"
 #include "build.h"
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index 7b4a9b8ae71..45e21f8c462 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -23,7 +23,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <stdio.h>
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index 2e6424fe76a..c9a9f1b09f3 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -23,7 +23,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <ctype.h>
diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c
index 43a35af211c..b86a88aae24 100644
--- a/tools/winebuild/relay.c
+++ b/tools/winebuild/relay.c
@@ -23,7 +23,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <ctype.h>
 #include <stdarg.h>
diff --git a/tools/winebuild/res16.c b/tools/winebuild/res16.c
index 216d2530802..732af015199 100644
--- a/tools/winebuild/res16.c
+++ b/tools/winebuild/res16.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <ctype.h>
@@ -27,10 +26,6 @@
 #include <string.h>
 #include <stdarg.h>
 #include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#include <fcntl.h>
 
 #include "build.h"
 
diff --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c
index 2c39a3502e3..3b74f098e83 100644
--- a/tools/winebuild/res32.c
+++ b/tools/winebuild/res32.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <ctype.h>
@@ -27,10 +26,6 @@
 #include <string.h>
 #include <stdarg.h>
 #include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#include <fcntl.h>
 
 #include "build.h"
 
diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c
index daa9c63a8c9..e82f5f81d9a 100644
--- a/tools/winebuild/spec16.c
+++ b/tools/winebuild/spec16.c
@@ -23,7 +23,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <ctype.h>
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 65da570ec6d..89feb0db5d3 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -23,7 +23,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <ctype.h>
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 0f6ea1bc929..16b1fc2d968 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <ctype.h>
@@ -27,12 +26,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
 
 #include "build.h"
 
diff --git a/tools/winedump/debug.c b/tools/winedump/debug.c
index 10694c57ea0..c2efeb24340 100644
--- a/tools/winedump/debug.c
+++ b/tools/winedump/debug.c
@@ -21,25 +21,11 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <time.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-#include <fcntl.h>
 
 #include "../tools.h"
 #include "windef.h"
diff --git a/tools/winedump/dos.c b/tools/winedump/dos.c
index 2ec38b71be4..aa94cfe46de 100644
--- a/tools/winedump/dos.c
+++ b/tools/winedump/dos.c
@@ -19,24 +19,11 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <time.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
 #include <fcntl.h>
 
 #include "windef.h"
diff --git a/tools/winedump/dump.c b/tools/winedump/dump.c
index e825c592cba..33c98648d8c 100644
--- a/tools/winedump/dump.c
+++ b/tools/winedump/dump.c
@@ -19,22 +19,11 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <time.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#include <fcntl.h>
 
 #include "../tools.h"
 #include "windef.h"
diff --git a/tools/winedump/emf.c b/tools/winedump/emf.c
index 50c3ad092ea..0aa776efbb5 100644
--- a/tools/winedump/emf.c
+++ b/tools/winedump/emf.c
@@ -19,19 +19,12 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
-#include "winedump.h"
 
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
 #include <fcntl.h>
 #include <stdarg.h>
 
+#include "winedump.h"
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
diff --git a/tools/winedump/font.c b/tools/winedump/font.c
index 3257fce9d80..58441975d3a 100644
--- a/tools/winedump/font.c
+++ b/tools/winedump/font.c
@@ -19,20 +19,10 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
 #include <fcntl.h>
 
 #include "windef.h"
diff --git a/tools/winedump/le.c b/tools/winedump/le.c
index ee043f2a3e4..14e3e84185e 100644
--- a/tools/winedump/le.c
+++ b/tools/winedump/le.c
@@ -19,14 +19,10 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <fcntl.h>
 #include <stdarg.h>
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
 
 #include "windef.h"
 #include "winbase.h"
diff --git a/tools/winedump/lib.c b/tools/winedump/lib.c
index 5a7c33aa8b8..430ec2d4de7 100644
--- a/tools/winedump/lib.c
+++ b/tools/winedump/lib.c
@@ -19,20 +19,10 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
 #include <fcntl.h>
 
 #define NONAMELESSUNION
diff --git a/tools/winedump/lnk.c b/tools/winedump/lnk.c
index 0a06b49a118..e9f7229b5ae 100644
--- a/tools/winedump/lnk.c
+++ b/tools/winedump/lnk.c
@@ -19,22 +19,15 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
-#include "winedump.h"
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#include <fcntl.h>
 #include <stdarg.h>
+#include <fcntl.h>
 
 #include "windef.h"
 #include "winbase.h"
+#include "winedump.h"
 
 #include "pshpack1.h"
 
diff --git a/tools/winedump/main.c b/tools/winedump/main.c
index b60868d0d89..fd5b44d637d 100644
--- a/tools/winedump/main.c
+++ b/tools/winedump/main.c
@@ -19,9 +19,7 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
-#include "../tools.h"
 #include "winedump.h"
 
 _globals globals; /* All global variables */
diff --git a/tools/winedump/mf.c b/tools/winedump/mf.c
index 37869d3bb8a..aa108d2d96c 100644
--- a/tools/winedump/mf.c
+++ b/tools/winedump/mf.c
@@ -19,9 +19,8 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
-#include "winedump.h"
 
+#include "winedump.h"
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
diff --git a/tools/winedump/minidump.c b/tools/winedump/minidump.c
index da1369cbf84..228c593f5dd 100644
--- a/tools/winedump/minidump.c
+++ b/tools/winedump/minidump.c
@@ -23,11 +23,9 @@
 
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
-#include "windef.h"
-#include "winbase.h"
+#include "winedump.h"
 #include "winver.h"
 #include "dbghelp.h"
-#include "winedump.h"
 
 static void dump_mdmp_data(const MINIDUMP_LOCATION_DESCRIPTOR* md, const char* pfx)
 {
diff --git a/tools/winedump/misc.c b/tools/winedump/misc.c
index de46d65ae8a..62a5962547a 100644
--- a/tools/winedump/misc.c
+++ b/tools/winedump/misc.c
@@ -19,9 +19,7 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
-#include "../tools.h"
 #include "winedump.h"
 
 
diff --git a/tools/winedump/msc.c b/tools/winedump/msc.c
index 557f46b0703..2c3d406347e 100644
--- a/tools/winedump/msc.c
+++ b/tools/winedump/msc.c
@@ -19,27 +19,13 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <time.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
 #include <fcntl.h>
 
-#include "../tools.h"
 #include "windef.h"
 #include "winbase.h"
 #include "winedump.h"
diff --git a/tools/winedump/msmangle.c b/tools/winedump/msmangle.c
index cf26a073b4b..d22f4715937 100644
--- a/tools/winedump/msmangle.c
+++ b/tools/winedump/msmangle.c
@@ -19,9 +19,7 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
-#include "../tools.h"
 #include "winedump.h"
 
 /* Type for parsing mangled types */
diff --git a/tools/winedump/ne.c b/tools/winedump/ne.c
index b4f4f892752..ec73d16ce0d 100644
--- a/tools/winedump/ne.c
+++ b/tools/winedump/ne.c
@@ -19,14 +19,10 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
-#include <fcntl.h>
 #include <stdarg.h>
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+#include <fcntl.h>
 
 #include "windef.h"
 #include "winbase.h"
diff --git a/tools/winedump/nls.c b/tools/winedump/nls.c
index 731d42761f4..9fe0d26773c 100644
--- a/tools/winedump/nls.c
+++ b/tools/winedump/nls.c
@@ -19,13 +19,11 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 
-#include "../tools.h"
 #include "windef.h"
 #include "winedump.h"
 
diff --git a/tools/winedump/output.c b/tools/winedump/output.c
index ad3a70c3b0f..b039f5d71ad 100644
--- a/tools/winedump/output.c
+++ b/tools/winedump/output.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include "winedump.h"
 
diff --git a/tools/winedump/pdb.c b/tools/winedump/pdb.c
index 30001d224da..71a2bc49cc8 100644
--- a/tools/winedump/pdb.c
+++ b/tools/winedump/pdb.c
@@ -19,29 +19,15 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <time.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
 #include <fcntl.h>
 
 #define NONAMELESSUNION
 
-#include "../tools.h"
 #include "windef.h"
 #include "winbase.h"
 #include "winedump.h"
diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c
index 4455ab61bd0..04e01755171 100644
--- a/tools/winedump/pe.c
+++ b/tools/winedump/pe.c
@@ -19,29 +19,15 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <time.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
 #include <fcntl.h>
 
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
-#include "../tools.h"
 #include "windef.h"
 #include "winbase.h"
 #include "winedump.h"
diff --git a/tools/winedump/search.c b/tools/winedump/search.c
index c957a2c2ce5..21f9986d0a6 100644
--- a/tools/winedump/search.c
+++ b/tools/winedump/search.c
@@ -19,9 +19,7 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
-#include "../tools.h"
 #include "winedump.h"
 
 static char *grep_buff = NULL;
diff --git a/tools/winedump/symbol.c b/tools/winedump/symbol.c
index 57a23df7bf9..90d34e33756 100644
--- a/tools/winedump/symbol.c
+++ b/tools/winedump/symbol.c
@@ -19,9 +19,7 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
-#include "../tools.h"
 #include "winedump.h"
 
 
diff --git a/tools/winedump/tlb.c b/tools/winedump/tlb.c
index 7e0f664f778..9992cc762f1 100644
--- a/tools/winedump/tlb.c
+++ b/tools/winedump/tlb.c
@@ -20,13 +20,11 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 
-#include "../tools.h"
 #include "winedump.h"
 
 #define MSFT_MAGIC 0x5446534d
diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h
index df1d6e24105..236ce6dede3 100644
--- a/tools/winedump/winedump.h
+++ b/tools/winedump/winedump.h
@@ -42,6 +42,7 @@
 #include <assert.h>
 #include <stdarg.h>
 
+#include "../tools.h"
 #include "windef.h"
 #include "winbase.h"
 
diff --git a/tools/winegcc/utils.c b/tools/winegcc/utils.c
index 00aa8607304..f378a17976a 100644
--- a/tools/winegcc/utils.c
+++ b/tools/winegcc/utils.c
@@ -19,8 +19,8 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
+
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <string.h>
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 1fa7f59cfaa..5204553f739 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -87,7 +87,6 @@
  */ 
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <stdio.h>
diff --git a/tools/wmc/po.c b/tools/wmc/po.c
index d0a053cfb67..28bcea91f59 100644
--- a/tools/wmc/po.c
+++ b/tools/wmc/po.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tools/wmc/utils.c b/tools/wmc/utils.c
index 5a91d420cb4..d9d803413da 100644
--- a/tools/wmc/utils.c
+++ b/tools/wmc/utils.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tools/wmc/wmc.c b/tools/wmc/wmc.c
index 618a6ab2472..864c969b136 100644
--- a/tools/wmc/wmc.c
+++ b/tools/wmc/wmc.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tools/wmc/write.c b/tools/wmc/write.c
index 361d1a9943e..69ebf24b6b9 100644
--- a/tools/wmc/write.c
+++ b/tools/wmc/write.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y
index 7daa4581f23..2efd7ee7e5c 100644
--- a/tools/wrc/parser.y
+++ b/tools/wrc/parser.y
@@ -120,8 +120,8 @@
  *			- Corrected syntax problems with an old yacc (;)
  *			- Added extra comment about grammar
  */
+
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tools/wrc/po.c b/tools/wrc/po.c
index 8c77b5ccbfa..520c7de266b 100644
--- a/tools/wrc/po.c
+++ b/tools/wrc/po.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tools/wrc/ppy.y b/tools/wrc/ppy.y
index 50561cbe1aa..a4b834d7f6c 100644
--- a/tools/wrc/ppy.y
+++ b/tools/wrc/ppy.y
@@ -21,7 +21,6 @@
 
 %{
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tools/wrc/utils.c b/tools/wrc/utils.c
index 68e920dd14d..f6f36260617 100644
--- a/tools/wrc/utils.c
+++ b/tools/wrc/utils.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <stdio.h>
diff --git a/tools/wrc/wpp.c b/tools/wrc/wpp.c
index 990edeb1563..9ad09f25da2 100644
--- a/tools/wrc/wpp.c
+++ b/tools/wrc/wpp.c
@@ -20,7 +20,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <assert.h>
 #include <ctype.h>
@@ -30,9 +29,6 @@
 #include <string.h>
 #include <stdarg.h>
 #include <time.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 
 #include "../tools.h"
 #include "utils.h"
diff --git a/tools/wrc/wrc.c b/tools/wrc/wrc.c
index 69faaf370a4..8cdb91195cf 100644
--- a/tools/wrc/wrc.c
+++ b/tools/wrc/wrc.c
@@ -20,13 +20,9 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
 #include <string.h>
 #include <assert.h>
 #include <ctype.h>
diff --git a/tools/wrc/writeres.c b/tools/wrc/writeres.c
index 07d4f748fe3..7a75cb1e0d6 100644
--- a/tools/wrc/writeres.c
+++ b/tools/wrc/writeres.c
@@ -19,7 +19,6 @@
  */
 
 #include "config.h"
-#include "wine/port.h"
 
 #include <stdio.h>
 #include <stdlib.h>
-- 
GitLab