Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Ozkan Sezer <sezeroz@gmail.com>
To: Kai Tietz <ktietz70@googlemail.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] winsock include fixes
Date: Fri, 26 Mar 2010 11:21:00 -0000	[thread overview]
Message-ID: <647fe9b11003260421w3d0f858dw64af31a7126ba84a@mail.gmail.com> (raw)
In-Reply-To: <90baa01f1003260415m279f11a9hdaac7592d32cf4db@mail.gmail.com>

On Fri, Mar 26, 2010 at 1:15 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
> 2010/3/26 Ozkan Sezer <sezeroz@gmail.com>:
>> 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
>
> Ok, patch is ok. Ugly, but ok.
>
>> 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.
>
> Long term we should clean it up in gdb. But I am pretty sure this
> wrong order appears in other projects, too. So I think we should make
> winsock2.h able to override definitions of winsock.h to simply allow
> this. I dislike to priest and have malfunctional projects using our
> runtime. It is correct that this behavior is default for VC, but it
> hard to argument here, as we will always hear that things are working
> by using w32api.

It is the fault of w32api (cygwin/mingw.org) that winsock2.h
is included from within windows.h and not winsock.h. It
is the reason that many projects are doing this include
order wrongly, and we (mingw-w64) must not try to be
compatible with an incorrect implementation. W32api is
not windows itself and it is doing this winsock inclusion
wrong.

>
> Kai


  parent reply	other threads:[~2010-03-26 11:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-26 10:54 Ozkan Sezer
2010-03-26 11:15 ` Kai Tietz
2010-03-26 11:20   ` Kai Tietz
2010-03-26 11:21   ` Ozkan Sezer [this message]
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=647fe9b11003260421w3d0f858dw64af31a7126ba84a@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