public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] On MS-Windows, define _WIN32_WINNT in a single common place.
@ 2019-05-03  8:01 Eli Zaretskii
  0 siblings, 0 replies; only message in thread
From: Eli Zaretskii @ 2019-05-03  8:01 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=353ea2d106a51cfd1680f7d351f35eb8f69c9248

commit 353ea2d106a51cfd1680f7d351f35eb8f69c9248
Author: Eli Zaretskii <eliz@gnu.org>
Date:   Fri May 3 10:55:33 2019 +0300

    On MS-Windows, define _WIN32_WINNT in a single common place.
    
    This changeset defines _WIN32_WINNT to at least 0x0501, the level
    of Windows XP, unless defined to a higher level, in a single
    place.  It then removes all the overrides of _WIN32_WINNT in
    individual files as no longer needed.  Doing this also solves
    compilation of windows-nat.c with mingw.org's MinGW, as that
    file uses CONSOLE_FONT_INFO which needs the XP level to become
    exposed in the Windows headers, while mingw.org defaults to
    Windows 9X.
    
    gdb/ChangeLog:
    2019-05-03  Eli Zaretskii  <eliz@gnu.org>
    
    	* common/common-defs.h [__MINGW32__ || __CYGWIN__]: Define
    	_WIN32_WINNT to the XP level, unless already defined to a higher
    	level.
    
    	* unittests/parse-connection-spec-selftests.c:
    	* ser-tcp.c:
    	* common/netstuff.c [USE_WIN32API]:  Remove the _WIN32_WINNT
    	override.
    
    gdb/gdbserver/ChangeLog:
    2019-05-03  Eli Zaretskii  <eliz@gnu.org>
    
    	* remote-utils.c:
    	* gdbreplay.c [USE_WIN32API]: Remove the _WIN32_WINNT override.

Diff:
---
 gdb/ChangeLog                                   |  9 +++++++++
 gdb/common/common-defs.h                        | 14 ++++++++++++++
 gdb/common/netstuff.c                           |  4 ----
 gdb/gdbserver/ChangeLog                         |  5 +++++
 gdb/gdbserver/gdbreplay.c                       |  4 ----
 gdb/gdbserver/remote-utils.c                    |  4 ----
 gdb/ser-tcp.c                                   |  4 ----
 gdb/unittests/parse-connection-spec-selftests.c |  4 ----
 8 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index efe07af..4820ebf 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
 2019-05-03  Eli Zaretskii  <eliz@gnu.org>
 
+	* common/common-defs.h [__MINGW32__ || __CYGWIN__]: Define
+	_WIN32_WINNT to the XP level, unless already defined to a higher
+	level.
+
+	* unittests/parse-connection-spec-selftests.c:
+	* ser-tcp.c:
+	* common/netstuff.c [USE_WIN32API]:  Remove the _WIN32_WINNT
+	override.
+
 	* symfile.c (find_separate_debug_file): Remove colon from the
 	drive spec of DOS/Windows file names of the target, so that the
 	file name produced from DEBUGDIR and the target's directory will
diff --git a/gdb/common/common-defs.h b/gdb/common/common-defs.h
index 6b1f004..8c16492 100644
--- a/gdb/common/common-defs.h
+++ b/gdb/common/common-defs.h
@@ -72,6 +72,20 @@
 #define _FORTIFY_SOURCE 2
 #endif
 
+/* We don't support Windows versions before XP, so we define
+   _WIN32_WINNT correspondingly to ensure the Windows API headers
+   expose the required symbols.  */
+#if defined (__MINGW32__) || defined (__CYGWIN__)
+# ifdef _WIN32_WINNT
+#  if _WIN32_WINNT < 0x0501
+#   undef _WIN32_WINNT
+#   define _WIN32_WINNT 0x0501
+#  endif
+# else
+#  define _WIN32_WINNT 0x0501
+# endif
+#endif	/* __MINGW32__ || __CYGWIN__ */
+
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/gdb/common/netstuff.c b/gdb/common/netstuff.c
index 27fdc73..b192de7 100644
--- a/gdb/common/netstuff.c
+++ b/gdb/common/netstuff.c
@@ -21,10 +21,6 @@
 #include <algorithm>
 
 #ifdef USE_WIN32API
-#if _WIN32_WINNT < 0x0501
-# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0501
-#endif
 #include <ws2tcpip.h>
 #else
 #include <netinet/in.h>
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 2985281..82278e7 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2019-05-03  Eli Zaretskii  <eliz@gnu.org>
+
+	* remote-utils.c:
+	* gdbreplay.c [USE_WIN32API]: Remove the _WIN32_WINNT override.
+
 2019-04-19  Tom Tromey  <tom@tromey.com>
 
 	* server.c (struct vstop_notif): Derive from notif_event.
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index ca0a9d3..2800e78 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -45,10 +45,6 @@
 #endif
 
 #if USE_WIN32API
-#if _WIN32_WINNT < 0x0501
-# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0501
-#endif
 #include <ws2tcpip.h>
 #endif
 
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 903d773..1d27ea3 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -63,10 +63,6 @@
 #include <sys/stat.h>
 
 #if USE_WIN32API
-#if _WIN32_WINNT < 0x0501
-# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0501
-#endif
 #include <ws2tcpip.h>
 #endif
 
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index 039b043..927a285 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -39,10 +39,6 @@
 #include "common/gdb_sys_time.h"
 
 #ifdef USE_WIN32API
-#if _WIN32_WINNT < 0x0501
-# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0501
-#endif
 #include <ws2tcpip.h>
 #ifndef ETIMEDOUT
 #define ETIMEDOUT WSAETIMEDOUT
diff --git a/gdb/unittests/parse-connection-spec-selftests.c b/gdb/unittests/parse-connection-spec-selftests.c
index a4beb66..915aa66 100644
--- a/gdb/unittests/parse-connection-spec-selftests.c
+++ b/gdb/unittests/parse-connection-spec-selftests.c
@@ -22,10 +22,6 @@
 #include "common/netstuff.h"
 #include "diagnostics.h"
 #ifdef USE_WIN32API
-#if _WIN32_WINNT < 0x0501
-# undef _WIN32_WINNT
-# define _WIN32_WINNT 0x0501
-#endif
 #include <ws2tcpip.h>
 #else
 #include <netinet/in.h>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-05-03  8:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03  8:01 [binutils-gdb] On MS-Windows, define _WIN32_WINNT in a single common place Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).