Re: [PATCH] winsock include fixes

Ozkan Sezer
2010-03-26T15:24:32Z

On Fri, Mar 26, 2010 at 4:47 PM, Ozkan Sezer <sezeroz@gmail.com> wrote:
> On Fri, Mar 26, 2010 at 4:17 PM, Daniel Jacobowitz <dan@codesourcery.com> wrote:
>> On Fri, Mar 26, 2010 at 12:54:10PM +0200, Ozkan Sezer wrote:
>>> Hi: Here is a patch fixing the winsock include problem
>>> which appeared after the recent winsock header work in
>>> mingw-w64-headers.
>>
>> This patch isn't OK, because it fixes an inclusion order problem by
>> moving things around without a comment.  Everywhere else the
>> "gdb_XXX.h" headers are included in a group, last.  So someone's going
>> to clean up these files and reintroduce the problem.
>>
>> It sounds like part of the problem is the inclusion of winsock2.h in
>> gdb_select.h, and windows.h in serial.h.  Should we include both
>> headers in both files to avoid the problem?
>>
>> --
>> Daniel Jacobowitz
>> CodeSourcery
>>
>
> That may be a solution, too: Inclusion of winsock2.h
> should be harmless in all cases when USE_WIN32API
> is defined.
>
> --
> Ozkan
>

Indeed, adding winsock2.h include to serial.h does fix the
problems for mingw-w64, like the following:

Index: gdb/serial.h
===================================================================
RCS file: /cvs/src/src/gdb/serial.h,v
retrieving revision 1.21
diff -u -p -r1.21 serial.h
--- gdb/serial.h 1 Jan 2010 07:31:41 -0000 1.21
+++ gdb/serial.h 26 Mar 2010 15:21:45 -0000
@@ -21,6 +21,7 @@
#define SERIAL_H

#ifdef USE_WIN32API
+#include <winsock2.h>
#include <windows.h>
#endif

Compile tested for x86_64-w64-mingw32 and i686-w64-mingw32.

--
Ozkan