Subject: Re: Version 1.8.1 does not compile on Cygwin 1.7.14

From: Torsten Bögershausen <[email-masked]>
Date: Sun, 20 Jan 2013 11:48:53 +0100

On 20.01.13 11:10, Jonathan Nieder wrote:
> Ramsay Jones wrote:
> 
>> --- a/git-compat-util.h
>> +++ b/git-compat-util.h
>> @@ -85,12 +85,6 @@
>>  #define _NETBSD_SOURCE 1
>>  #define _SGI_SOURCE 1
>>  
>> -#ifdef WIN32 /* Both MinGW and MSVC */
>> -#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
>> -#include <winsock2.h>
>> -#include <windows.h>
>> -#endif
> 
> So, do I understand correctly that the above conditional should be
> something like
> 
>  #if defined(WIN32) && !defined(__CYGWIN__)
> 
> to allow dropping the CYGWIN_V15_WIN32API setting?
> 
> "defined(WIN32)" is used throughout git to mean "win32 and not
> cygwin", so if I understand correctly we would either need to do
> 
>  #if defined(WIN32) && defined(__CYGWIN__)
>  # undef WIN32
>  #endif
> 
> or define a new GIT_WIN32 (name is just a placeholder) macro to use
> consistently in its stead.
> 
> Thanks for investigating.
> Jonathan

I wonder, if if we can go one step further:

Replace
#ifdef WIN32 /* Both MinGW and MSVC */
#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
#include <winsock2.h>
#include <windows.h>
#endif

with
#if defined(_MSC_VER)
#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
#include <winsock2.h>
#include <windows.h>
#endif

Any thougths from msysGit ?
/Torsten