Skip to content

Commit 56fb3dd

Browse files
Ramsay Jonesgitster
authored andcommitted
msvc: Fix compilation errors in compat/win32/sys/poll.c
The msvc winsock2.h header file conditionally defines or declares poll() related symbols which cause many macro redefinition errors, a struct type redefinition error and syntax errors. These symbols are defined in support of the WSAPoll() API, new in Windows Vista, when the symbol _WIN32_WINNT is defined and _WIN32_WINNT >= 0x0600. In order to avoid the compilation errors, we set _WIN32_WINNT to 0x0502 (which would target Windows Server 2003) prior to including the winsock2.h header file. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Acked-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 89ba4e7 commit 56fb3dd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compat/win32/sys/poll.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434

3535
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
3636
# define WIN32_NATIVE
37+
# if defined (_MSC_VER)
38+
# define _WIN32_WINNT 0x0502
39+
# endif
3740
# include <winsock2.h>
3841
# include <windows.h>
3942
# include <io.h>

0 commit comments

Comments
 (0)