# [PATCH 1/3] MSVC: Remove vcbuild/include/sys/poll.h

5 messages from 2011-11-18 to 2011-11-22. Participants: Vincent van Ravesteijn, Sebastian Schuberth.
Thread: https://gitlist.dev/t/28974

## Vincent van Ravesteijn, 2011-11-18 16:44

Subject: [PATCH 1/3] MSVC: Remove vcbuild/include/sys/poll.h
Message-ID: <1321634670-4968-1-git-send-email-vfr@lyx.org>
URL: https://gitlist.dev/e/1321634670-4968-1-git-send-email-vfr%40lyx.org

```
In v1.7.7.1-432-g0f77dea (Oct 24 2011; Erik Faye-Lund; mingw: move
poll out of sys-folder) poll.h was moved out of the compat/win32/sys
folder. As the change in the Makefile also affects the MSVC build,
this file was no longer used.

Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
---
 compat/vcbuild/include/sys/poll.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
 delete mode 100644 compat/vcbuild/include/sys/poll.h

diff --git a/compat/vcbuild/include/sys/poll.h b/compat/vcbuild/include/sys/poll.h
deleted file mode 100644
index 0d8552a..0000000
--- a/compat/vcbuild/include/sys/poll.h
+++ /dev/null
@@ -1 +0,0 @@
-/* Intentionally empty file to support building git with MSVC */
-- 
1.7.4.1

```

## Vincent van Ravesteijn, 2011-11-18 16:44

Subject: [PATCH 2/3] Compile fix for MSVC: fix poll-related macro redefines
Message-ID: <1321634670-4968-2-git-send-email-vfr@lyx.org>
URL: https://gitlist.dev/e/1321634670-4968-2-git-send-email-vfr%40lyx.org
In-Reply-To: <1321634670-4968-1-git-send-email-vfr@lyx.org>

```
This seems to be related to the poll-emulation... I see that these things
are guarded by an "#if(_WIN32_WINNT >= 0x0600)" in <winsock2.h>, which
means it's supported for Windows Vista and above... We still support
Windows XP, so it seems someone has set this too high :)

I'd prefer to set this from the Makefile, but this generates a warning in
compat/win32/poll.c about redefining a macro (poll.c wants it to be 0x502,
which is Windows XP with SP2, rather than 0x501 which is normal Windows
XP).

Proposed-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Submitted-by: Vincent van Ravesteijn <vfr@lyx.org>
---
 compat/mingw.h    |    1 +
 git-compat-util.h |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index fecf0d0..ff18401 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -1,3 +1,4 @@
+#define _WIN32_WINNT 0x0501
 #include <winsock2.h>
 #include <ws2tcpip.h>
 
diff --git a/git-compat-util.h b/git-compat-util.h
index 5ef8ff7..76cbfe6 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -85,6 +85,7 @@
 #define _SGI_SOURCE 1
 
 #ifdef WIN32 /* Both MinGW and MSVC */
+#  define _WIN32_WINNT 0x0501
 #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
 #include <winsock2.h>
 #include <windows.h>
-- 
1.7.4.1

```

## Vincent van Ravesteijn, 2011-11-18 16:44

Subject: [PATCH 3/3] Compile fix for MSVC: Use NO_INET_PTON and NO_INET_NTOP
Message-ID: <1321634670-4968-3-git-send-email-vfr@lyx.org>
URL: https://gitlist.dev/e/1321634670-4968-3-git-send-email-vfr%40lyx.org
In-Reply-To: <1321634670-4968-1-git-send-email-vfr@lyx.org>

```
This is needed to compile daemon.c.

In v1.7.3.2-162-ga666b47 (Nov 4 2010; Erik Faye-Lund <kusmabite@gmail.com>;
daemon: opt-out on features that require posix) this was introduced for
MingW, but this is also necessary for MSVC.

Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
---
 Makefile |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index ee34eab..b9d53aa 100644
--- a/Makefile
+++ b/Makefile
@@ -1120,6 +1120,8 @@ ifeq ($(uname_S),Windows)
 	BLK_SHA1 = YesPlease
 	NO_POSIX_GOODIES = UnfortunatelyYes
 	NATIVE_CRLF = YesPlease
+	NO_INET_PTON = YesPlease
+	NO_INET_NTOP = YesPlease
 
 	CC = compat/vcbuild/scripts/clink.pl
 	AR = compat/vcbuild/scripts/lib.pl
-- 
1.7.4.1

```

## Sebastian Schuberth, 2011-11-18 17:36

Subject: Re: [PATCH 2/3] Compile fix for MSVC: fix poll-related macro redefines
Message-ID: <4EC6978D.3020604@gmail.com>
URL: https://gitlist.dev/e/4EC6978D.3020604%40gmail.com
In-Reply-To: <1321634670-4968-2-git-send-email-vfr@lyx.org>

```
On 18.11.2011 17:44, Vincent van Ravesteijn wrote:

> diff --git a/git-compat-util.h b/git-compat-util.h
> index 5ef8ff7..76cbfe6 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -85,6 +85,7 @@
>  #define _SGI_SOURCE 1
>
>  #ifdef WIN32 /* Both MinGW and MSVC */
> +#  define _WIN32_WINNT 0x0501
>  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
>  #include<winsock2.h>
>  #include<windows.h>

It seems the indentation is wrong (does not match the surrounding code) 
here.

-- 
Sebastian Schuberth

```

## Vincent van Ravesteijn, 2011-11-22 07:30

Subject: Re: [PATCH 2/3] Compile fix for MSVC: fix poll-related macro redefines
Message-ID: <4ECB4F78.40309@lyx.org>
URL: https://gitlist.dev/e/4ECB4F78.40309%40lyx.org
In-Reply-To: <4EC6978D.3020604@gmail.com>

```
Op 18-11-2011 18:36, Sebastian Schuberth schreef:
> On 18.11.2011 17:44, Vincent van Ravesteijn wrote:
>
>> diff --git a/git-compat-util.h b/git-compat-util.h
>> index 5ef8ff7..76cbfe6 100644
>> --- a/git-compat-util.h
>> +++ b/git-compat-util.h
>> @@ -85,6 +85,7 @@
>>  #define _SGI_SOURCE 1
>>
>>  #ifdef WIN32 /* Both MinGW and MSVC */
>> +#  define _WIN32_WINNT 0x0501
>>  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */
>>  #include<winsock2.h>
>>  #include<windows.h>
>
> It seems the indentation is wrong (does not match the surrounding 
> code) here.
>

Yes, you're right. I will reroll the patch series when there is somewhat 
more feedback on the series.

Vincent

```
