From: Ozkan Sezer <sezeroz@gmail.com>
To: gdb-patches@sources.redhat.com
Cc: ktietz70@googlemail.com
Subject: [PATCH] winsock include fixes
Date: Fri, 26 Mar 2010 10:54:00 -0000 [thread overview]
Message-ID: <647fe9b11003260354o53df5f0ayde8d1e3a03f1b694@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 997 bytes --]
Hi: Here is a patch fixing the winsock include problem
which appeared after the recent winsock header work in
mingw-w64-headers. Problem is this: GDB does windows.h
and winsock2.h includes in its own headers and then it
includes them in its sources in an arbitrary order. If
winsock2.h or a header including winsock2.h (such as
gdb_select.h) is included after windows.h or a header
including windows.h (such as serial.h), then conflicting
definitions occur and they result in error, because windows.h
already includes winsock.h and including winsock2.h after
that is an error. The patch fixes that in a quick and
dirty way mostly by tweaking the include order. Tested
by compiling gdb for x86_64-w64-mingw32, i686-w64-mingw32
and x86_64-pc-linux-gnu. Please consider for applying.
--
Ozkan
PS:
A possibly better solution is defining WIN32_LEAN_AND_MEAN
before including windows.h and then manually including
the necessary additional headers in the sources, but that
may require some more work.
[-- Attachment #2: winsock_includes.patch --]
[-- Type: application/octet-stream, Size: 3749 bytes --]
Index: gdb/inflow.c
===================================================================
RCS file: /cvs/src/src/gdb/inflow.c,v
retrieving revision 1.58
diff -u -p -r1.58 inflow.c
--- gdb/inflow.c 24 Feb 2010 07:51:44 -0000 1.58
+++ gdb/inflow.c 26 Mar 2010 10:48:03 -0000
@@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "gdb_select.h"
#include "frame.h"
#include "inferior.h"
#include "command.h"
@@ -31,7 +32,6 @@
#include "gdb_string.h"
#include <signal.h>
#include <fcntl.h>
-#include "gdb_select.h"
#include "inflow.h"
Index: gdb/mingw-hdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mingw-hdep.c,v
retrieving revision 1.11
diff -u -p -r1.11 mingw-hdep.c
--- gdb/mingw-hdep.c 1 Jan 2010 07:31:37 -0000 1.11
+++ gdb/mingw-hdep.c 26 Mar 2010 10:48:03 -0000
@@ -18,11 +18,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "gdb_select.h"
#include "serial.h"
#include "event-loop.h"
#include "gdb_assert.h"
-#include "gdb_select.h"
#include "gdb_string.h"
#include "readline/readline.h"
Index: gdb/ser-base.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-base.c,v
retrieving revision 1.15
diff -u -p -r1.15 ser-base.c
--- gdb/ser-base.c 1 Jan 2010 07:31:41 -0000 1.15
+++ gdb/ser-base.c 26 Mar 2010 10:48:03 -0000
@@ -19,6 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#ifdef USE_WIN32API
+#include <winsock2.h>
+#endif
#include "serial.h"
#include "ser-base.h"
#include "event-loop.h"
@@ -26,9 +29,6 @@
#include "gdb_select.h"
#include "gdb_string.h"
#include <sys/time.h>
-#ifdef USE_WIN32API
-#include <winsock2.h>
-#endif
static timer_handler_func push_event;
Index: gdb/ser-mingw.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-mingw.c,v
retrieving revision 1.20
diff -u -p -r1.20 ser-mingw.c
--- gdb/ser-mingw.c 1 Jan 2010 07:31:41 -0000 1.20
+++ gdb/ser-mingw.c 26 Mar 2010 10:48:03 -0000
@@ -18,6 +18,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#ifdef USE_WIN32API
+#include <winsock2.h>
+#endif
#include "serial.h"
#include "ser-base.h"
#include "ser-tcp.h"
Index: gdb/ser-tcp.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-tcp.c,v
retrieving revision 1.33
diff -u -p -r1.33 ser-tcp.c
--- gdb/ser-tcp.c 1 Jan 2010 07:31:41 -0000 1.33
+++ gdb/ser-tcp.c 26 Mar 2010 10:48:03 -0000
@@ -19,6 +19,9 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#ifdef USE_WIN32API
+#include <winsock2.h>
+#endif
#include "serial.h"
#include "ser-base.h"
#include "ser-tcp.h"
@@ -38,7 +41,6 @@
#include <sys/time.h>
#ifdef USE_WIN32API
-#include <winsock2.h>
#define ETIMEDOUT WSAETIMEDOUT
#define close(fd) closesocket (fd)
#define ioctl ioctlsocket
Index: gdb/ser-unix.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-unix.c,v
retrieving revision 1.34
diff -u -p -r1.34 ser-unix.c
--- gdb/ser-unix.c 1 Jan 2010 07:31:41 -0000 1.34
+++ gdb/ser-unix.c 26 Mar 2010 10:48:03 -0000
@@ -19,6 +19,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "gdb_select.h"
#include "serial.h"
#include "ser-base.h"
#include "ser-unix.h"
@@ -29,7 +30,6 @@
#include <sys/socket.h>
#include <sys/time.h>
-#include "gdb_select.h"
#include "gdb_string.h"
#include "gdbcmd.h"
next reply other threads:[~2010-03-26 10:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-26 10:54 Ozkan Sezer [this message]
2010-03-26 11:15 ` Kai Tietz
2010-03-26 11:20 ` Kai Tietz
2010-03-26 11:21 ` Ozkan Sezer
2010-03-26 14:17 ` Daniel Jacobowitz
2010-03-26 14:47 ` Ozkan Sezer
2010-03-26 15:24 ` Ozkan Sezer
2010-03-26 15:33 ` Daniel Jacobowitz
2010-03-26 15:35 ` Ozkan Sezer
2010-03-27 16:15 ` Ozkan Sezer
2010-03-30 18:08 ` Tom Tromey
2010-03-30 18:18 ` Ozkan Sezer
2010-03-28 18:43 ` Christopher Faylor
2010-03-28 18:48 ` Ozkan Sezer
2010-03-28 19:01 ` Christopher Faylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=647fe9b11003260354o53df5f0ayde8d1e3a03f1b694@mail.gmail.com \
--to=sezeroz@gmail.com \
--cc=gdb-patches@sources.redhat.com \
--cc=ktietz70@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox