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

Re: [PATCH] Compile fix for MSVC: Move poll.h out of sys-folder

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Nov 18, 2011, 14:09 UTC
Message-ID
<CABPQNSa+ZjAMSxpBTqGW7P=v-tJTW_jdx3MO=vCpzc-z_XdHTg@mail.gmail.com>
In-Reply-To
<1321624070-4246-1-git-send-email-vfr@lyx.org>
On Fri, Nov 18, 2011 at 2:47 PM, Vincent van Ravesteijn <vfr@lyx.org> wrote:
Show 13 quoted lines
> 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,
> the same must be done for poll.h in compat/vcbuild/include/sys/poll.h.
>
> Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
> ---
>  compat/vcbuild/include/poll.h     |    1 +
>  compat/vcbuild/include/sys/poll.h |    1 -
>  2 files changed, 1 insertions(+), 1 deletions(-)
>  create mode 100644 compat/vcbuild/include/poll.h
>  delete mode 100644 compat/vcbuild/include/sys/poll.h
>

This looks strange to me. vcbuild/include/poll.h will only prevent the correct header from being included, while compiling an linking against compat/win32/poll.[co]... That seems dangerous to me, because the interface might be declared differently.

Instead, I think compat/vcbuild/include/poll.h should be removed, and _WIN32_WINNT set to a value below 0x600. That way the poll-stuff doesn't get pulled in by winsock2.h (as it's Vista and above only).

This was already discussed in your "[PATCHv2] Compile fix for MSVC" thread: http://mid.gmane.org/CABPQNSaCRRRpEQPG1Mb4DovkMdQSBhHTm-i7y5M4iT+ndHX4XA@mail.gmail.com

Here's the patch that fixes it. I still can't build Junio's master, due to sys/resource.h missing. This comes from ebae9ff ("compat: add missing #include <sys/resource.h>"), and is only guarded against MinGW, not MSVC...

$ git diff
diff --git a/compat/mingw.h b/compat/mingw.h
index dfb0e87..a06269d 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..c52be6c 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>
Previous: Vincent van RavesteijnNext: Erik Faye-Lund
Message 2 of 5 in “Compile fix for MSVC: Move poll.h out of sys-folder”
  1. Compile fix for MSVC: Move poll.h out of sys-folderVincent van Ravesteijn, Nov 18, 2011
  2. Erik Faye-LundNov 18, 2011
  3. Erik Faye-LundNov 18, 2011
  4. Vincent van RavesteijnNov 18, 2011
  5. Vincent van RavesteijnNov 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.