git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marius Storm-Olsen <mstormo@gmail.com>
To: Reece Dunn <msclrhd@googlemail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Johannes.Schindelin@gmx.de, msysgit@googlegroups.com,
	git@vger.kernel.org, lznuaa@gmail.com
Subject: Re: [PATCH 09/14] Avoid including windows.h in winansi.c for MSVC  build
Date: Sat, 22 Aug 2009 13:40:15 +0200	[thread overview]
Message-ID: <18cd41840908220440o37cf0909l15ff552abd52e075@mail.gmail.com> (raw)
In-Reply-To: <3f4fd2640908211416i489b6e23s27cb9cae6a439ddc@mail.gmail.com>

On Fri, Aug 21, 2009 at 11:16 PM, Reece Dunn<msclrhd@googlemail.com> wrote:
> 2009/8/21 Junio C Hamano <gitster@pobox.com>:
>> Marius Storm-Olsen <mstormo@gmail.com> writes:
>>
>>> From: Frank Li <lznuaa@gmail.com>
>>>
>>> compat/msvc.h includes winsock2.h which conflicts with windows.h.
>>> msvc.h also defines the oldest Windows API version required.
>>
>> The first sentence sort-of makes sense; compat/msvc.h will be included by
>> git-compat-util.h and including <windows.h> here will bring conflicting
>> definitions, so we avoid doing so when on MSC.
>>
>> The second sentence does not make any sense to me.  It may be correctly
>> stating a fact (i.e. "defines required WAPI version"), but it is unclear
>> what relevance it has to this change to stop including <windows.h>.
>
> The way things are configured, windows.h is pulling in winsock.h. In
> git-compat-util.h, winsock2.h is included which has conflicting
> definitions of various functions and data structures.
>
>> Having said that, the first sentence hints me that perhaps you guys should
>> include (conditionally only on windows but not with MSC) <windows.h> not
>> from this file, but from git-compat-util.h?
>
> It would make sense for windows.h to be included in git-compat-util.h.
>
> According to http://social.msdn.microsoft.com/Forums/en-US/windowssdk/thread/4a90b143-1fb8-43e9-a54c-956127e0c579,
> the following will work:
>
> #define _WINSOCKAPI_    // stops windows.h including winsock.h
> #include <winsock2.h>
> #include <windows.h>
>
> Also, if you define WIN32_LEAN_AND_MEAN, windows.h will pull in a
> subset of the Windows header files (which also improves compilation
> times). Adding this may prevent it from pulling in winsock.h. This
> would be a better approach (and would make sense to go into
> git-compat-util.h).
>
> I don't have access to a Windows dev box at the moment, so can't
> verify that this does indeed work.
>
> - Reece
>

I'll check this on Monday, and send out a v3 of the series,
incorporating the pieces commented on, and clarifying some of the
still confusing commit msgs.

--
.marius

  reply	other threads:[~2009-08-22 11:40 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-21 13:30 [RFC/PATCH 00/14] Build git with MSVC Marius Storm-Olsen
2009-08-21 13:30 ` [PATCH 01/14] Fix non-constant array creation Marius Storm-Olsen
2009-08-21 13:30   ` [PATCH 02/14] Avoid declaration after statement Marius Storm-Olsen
2009-08-21 13:30     ` [PATCH 03/14] Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++ Marius Storm-Olsen
2009-08-21 13:30       ` [PATCH 04/14] Add define guards to compat/win32.h Marius Storm-Olsen
2009-08-21 13:30         ` [PATCH 05/14] Change regerror() declaration from K&R style to ANSI C (C89) Marius Storm-Olsen
2009-08-21 13:30           ` [PATCH 06/14] mingw.c: Use the O_BINARY flag to open files Marius Storm-Olsen
2009-08-21 13:30             ` [PATCH 07/14] Fix __stdcall/WINAPI placement and function prototype Marius Storm-Olsen
2009-08-21 13:30               ` [PATCH 08/14] Test for WIN32 instead of __MINGW32_ Marius Storm-Olsen
2009-08-21 13:30                 ` [PATCH 09/14] Avoid including windows.h in winansi.c for MSVC build Marius Storm-Olsen
2009-08-21 13:30                   ` [PATCH 10/14] Add empty header files for MSVC port Marius Storm-Olsen
2009-08-21 13:30                     ` [PATCH 11/14] Add MinGW header files to build git with MSVC Marius Storm-Olsen
2009-08-21 13:30                       ` [PATCH 12/14] Add platform files for MSVC porting Marius Storm-Olsen
2009-08-21 13:30                         ` [PATCH 13/14] Add MSVC project files Marius Storm-Olsen
2009-08-21 13:30                           ` [PATCH 14/14] Add README and gitignore file for MSVC build Marius Storm-Olsen
2009-08-23 16:26                             ` Thiago Farina
2009-08-23 18:22                               ` Reece Dunn
2009-08-23 18:59                                 ` Marius Storm-Olsen
2009-08-23 19:29                                   ` Thiago Farina
2009-08-24  7:03                                     ` [msysGit] " Marius Storm-Olsen
2009-08-25 14:32                                     ` Frank Li
2009-08-25 17:24                                       ` Thiago Farina
2009-08-27 13:16                                         ` Frank Li
2009-08-27 14:26                                           ` Thiago Farina
2009-09-07 12:26                                       ` Erik Faye-Lund
2009-08-21 21:02                   ` [PATCH 09/14] Avoid including windows.h in winansi.c " Junio C Hamano
2009-08-21 21:16                     ` Reece Dunn
2009-08-22 11:40                       ` Marius Storm-Olsen [this message]
2009-08-28  8:15                 ` [PATCH 08/14] Test for WIN32 instead of __MINGW32_ Paolo Bonzini
2009-08-21 17:37               ` [msysGit] [PATCH 07/14] Fix __stdcall/WINAPI placement and function prototype Johannes Sixt
2009-08-21 19:42                 ` Marius Storm-Olsen
2009-08-21 14:37           ` [PATCH 05/14] Change regerror() declaration from K&R style to ANSI C (C89) Frank Li
2009-08-21 20:10           ` [PATCH v2 05/14] Change regerror() definition " Marius Storm-Olsen
2009-08-22  0:15             ` Frank Li
2009-08-24  9:42             ` Erik Faye-Lund
2009-08-21 20:55       ` [PATCH 03/14] Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++ Junio C Hamano
2009-08-21 21:18         ` Johan 't Hart
2009-08-21 21:41         ` Johannes Sixt
2009-08-21 22:11           ` Junio C Hamano
2009-08-22 11:25             ` Marius Storm-Olsen
2009-08-22 11:32             ` Marius Storm-Olsen
2009-08-21 13:41   ` [PATCH 01/14] Fix non-constant array creation Erik Faye-Lund
2009-08-21 13:46     ` Marius Storm-Olsen
2009-08-21 16:26       ` [msysGit] " Janos Laube
2009-08-21 19:49         ` Marius Storm-Olsen
2009-08-21 20:06         ` Johan 't Hart
2009-08-22 10:35           ` Erik Faye-Lund
2009-08-21 21:04     ` Junio C Hamano
2009-08-21 20:39   ` Junio C Hamano

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=18cd41840908220440o37cf0909l15ff552abd52e075@mail.gmail.com \
    --to=mstormo@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=lznuaa@gmail.com \
    --cc=msclrhd@googlemail.com \
    --cc=msysgit@googlegroups.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;
as well as URLs for NNTP newsgroup(s).