git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] Compile fix for MSVC: fix poll-related macro redefines

From
Vincent van Ravesteijn <vfr@lyx.org>
Date
Nov 18, 2011, 16:44 UTC
Message-ID
<1321634670-4968-2-git-send-email-vfr@lyx.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
Previous: Vincent van RavesteijnNext: Sebastian Schuberth
Message 2 of 5 in “MSVC: Remove vcbuild/include/sys/poll.h”
  1. 1/3 MSVC: Remove vcbuild/include/sys/poll.hVincent van Ravesteijn, Nov 18, 2011
  2. 2/3 Compile fix for MSVC: fix poll-related macro redefinesVincent van Ravesteijn, Nov 18, 2011
  3. Sebastian SchuberthNov 18, 2011
  4. Vincent van RavesteijnNov 22, 2011
  5. 3/3 Compile fix for MSVC: Use NO_INET_PTON and NO_INET_NTOPVincent van Ravesteijn, Nov 18, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.