{"thread":{"id":"25955","subject":"[PATCH 01/14] msvc: Fix compilation errors in compat/win32/sys/poll.c","startedAt":"2010-12-04T18:54:28Z","lastAt":"2010-12-11T22:09:51Z","messageCount":8,"participants":["Ramsay Jones","Jonathan Nieder","Erik Faye-Lund","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":14},"messages":[{"id":"157312","messageId":"4CFA8E64.6070402@ramsay1.demon.co.uk","threadId":"25955","inReplyTo":null,"subject":"[PATCH 01/14] msvc: Fix compilation errors in compat/win32/sys/poll.c","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2010-12-04T18:54:28Z","receivedAt":"2010-12-04T18:54:28Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nThe msvc winsock2.h header file conditionally defines or declares\npoll() related symbols which cause many macro redefinition errors,\na struct type redefinition error and syntax errors. These symbols\nare defined in support of the WSAPoll() API, new in Windows Vista,\nwhen the symbol _WIN32_WINNT is defined and _WIN32_WINNT >= 0x0600.\n\nIn order to avoid the compilation errors, we set _WIN32_WINNT to\n0x0502 (which would target Windows Server 2003) prior to including\nthe winsock2.h header file.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n compat/win32/sys/poll.c |    3 +++\n 1 files changed, 3 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/win32/sys/poll.c b/compat/win32/sys/poll.c\nindex 7e74ebe..708a6c9 100644\n--- a/compat/win32/sys/poll.c\n+++ b/compat/win32/sys/poll.c\n@@ -34,6 +34,9 @@\n \n #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__\n # define WIN32_NATIVE\n+# if defined (_MSC_VER)\n+#  define _WIN32_WINNT 0x0502\n+# endif\n # include <winsock2.h>\n # include <windows.h>\n # include <io.h>\n-- \n1.7.3\n"},{"id":"157315","messageId":"20101204204541.GA3170@burratino","threadId":"25955","inReplyTo":"4CFA8E64.6070402@ramsay1.demon.co.uk","subject":"Re: [PATCH 01/14] msvc: Fix compilation errors in compat/win32/sys/poll.c","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-12-04T20:45:41Z","receivedAt":"2010-12-04T20:45:41Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ramsay Jones wrote:\n\n> The msvc winsock2.h header file conditionally defines or declares\n> poll() related symbols which cause many macro redefinition errors,\n> a struct type redefinition error and syntax errors. These symbols\n> are defined in support of the WSAPoll() API, new in Windows Vista,\n> when the symbol _WIN32_WINNT is defined and _WIN32_WINNT >= 0x0600.\n\nCould it make sense to define this at the same time as _GNU_SOURCE et\nal?\n\n\t#define _ALL_SOURCE 1\n\t#define _GNU_SOURCE 1\n\t#define _BSD_SOURCE 1\n\t#define _NETBSD_SOURCE 1\n\t#define _SGI_SOURCE 1\n\t#define _WIN32_WINNT 0x0502\n\nHaven't thought carefully about the consequences, though; your patch\nis probably safer.\n"},{"id":"157324","messageId":"AANLkTinDoeYarLQLtZ327a7Us0cvaN42NFCoYorwMsT-@mail.gmail.com","threadId":"25955","inReplyTo":"4CFA8E64.6070402@ramsay1.demon.co.uk","subject":"Re: [PATCH 01/14] msvc: Fix compilation errors in compat/win32/sys/poll.c","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2010-12-04T21:12:24Z","receivedAt":"2010-12-04T21:12:24Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Sat, Dec 4, 2010 at 7:54 PM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:\n>\n> The msvc winsock2.h header file conditionally defines or declares\n> poll() related symbols which cause many macro redefinition errors,\n> a struct type redefinition error and syntax errors. These symbols\n> are defined in support of the WSAPoll() API, new in Windows Vista,\n> when the symbol _WIN32_WINNT is defined and _WIN32_WINNT >= 0x0600.\n>\n> In order to avoid the compilation errors, we set _WIN32_WINNT to\n> 0x0502 (which would target Windows Server 2003) prior to including\n> the winsock2.h header file.\n>\n> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n> ---\n>  compat/win32/sys/poll.c |    3 +++\n>  1 files changed, 3 insertions(+), 0 deletions(-)\n>\n> diff --git a/compat/win32/sys/poll.c b/compat/win32/sys/poll.c\n> index 7e74ebe..708a6c9 100644\n> --- a/compat/win32/sys/poll.c\n> +++ b/compat/win32/sys/poll.c\n> @@ -34,6 +34,9 @@\n>\n>  #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__\n>  # define WIN32_NATIVE\n> +# if defined (_MSC_VER)\n> +#  define _WIN32_WINNT 0x0502\n> +# endif\n>  # include <winsock2.h>\n>  # include <windows.h>\n>  # include <io.h>\n\nI have an almost identical patch in my msvc-tree, so FWIW:\n\nAcked-by: Erik Faye-Lund <kusmabite@gmail.com>\n"},{"id":"157329","messageId":"201012042222.23384.j6t@kdbg.org","threadId":"25955","inReplyTo":"4CFA8E64.6070402@ramsay1.demon.co.uk","subject":"Re: [PATCH 01/14] msvc: Fix compilation errors in compat/win32/sys/poll.c","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-12-04T21:22:23Z","receivedAt":"2010-12-04T21:22:23Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Samstag, 4. Dezember 2010, Ramsay Jones wrote:\n> The msvc winsock2.h header file conditionally defines or declares\n> poll() related symbols which cause many macro redefinition errors,\n> a struct type redefinition error and syntax errors. These symbols\n> are defined in support of the WSAPoll() API, new in Windows Vista,\n> when the symbol _WIN32_WINNT is defined and _WIN32_WINNT >= 0x0600.\n>\n> In order to avoid the compilation errors, we set _WIN32_WINNT to\n> 0x0502 (which would target Windows Server 2003) prior to including\n> the winsock2.h header file.\n>\n> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n> ---\n>  compat/win32/sys/poll.c |    3 +++\n>  1 files changed, 3 insertions(+), 0 deletions(-)\n>\n> diff --git a/compat/win32/sys/poll.c b/compat/win32/sys/poll.c\n> index 7e74ebe..708a6c9 100644\n> --- a/compat/win32/sys/poll.c\n> +++ b/compat/win32/sys/poll.c\n> @@ -34,6 +34,9 @@\n>\n>  #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__\n>  # define WIN32_NATIVE\n> +# if defined (_MSC_VER)\n> +#  define _WIN32_WINNT 0x0502\n> +# endif\n>  # include <winsock2.h>\n>  # include <windows.h>\n>  # include <io.h>\n\nDon't you have to do the same in git-compat-util.h?\n\n-- Hannes\n"},{"id":"157559","messageId":"4CFEBB3E.2060401@ramsay1.demon.co.uk","threadId":"25955","inReplyTo":"20101204204541.GA3170@burratino","subject":"Re: [PATCH 01/14] msvc: Fix compilation errors in compat/win32/sys/poll.c","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2010-12-07T22:54:54Z","receivedAt":"2010-12-07T22:54:54Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Jonathan Nieder wrote:\n> Could it make sense to define this at the same time as _GNU_SOURCE et\n> al?\n> \n> \t#define _ALL_SOURCE 1\n> \t#define _GNU_SOURCE 1\n> \t#define _BSD_SOURCE 1\n> \t#define _NETBSD_SOURCE 1\n> \t#define _SGI_SOURCE 1\n> \t#define _WIN32_WINNT 0x0502\n> \n> Haven't thought carefully about the consequences, though; your patch\n> is probably safer.\n\n[Sorry for the late reply, I've been away from email for several days]\n\nThis would not fix the compilation errors, since compat/win32/sys/poll.c\ndoes not include the git-compat-util.h header file (and I *don't* think\nit should). ;-)\n\nATB,\nRamsay Jones\n"},{"id":"157562","messageId":"4CFECEBB.7060703@ramsay1.demon.co.uk","threadId":"25955","inReplyTo":"201012042222.23384.j6t@kdbg.org","subject":"Re: [PATCH 01/14] msvc: Fix compilation errors in compat/win32/sys/poll.c","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2010-12-08T00:18:03Z","receivedAt":"2010-12-08T00:18:03Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Johannes Sixt wrote:\n> On Samstag, 4. Dezember 2010, Ramsay Jones wrote:\n>> diff --git a/compat/win32/sys/poll.c b/compat/win32/sys/poll.c\n>> index 7e74ebe..708a6c9 100644\n>> --- a/compat/win32/sys/poll.c\n>> +++ b/compat/win32/sys/poll.c\n>> @@ -34,6 +34,9 @@\n>>\n>>  #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__\n>>  # define WIN32_NATIVE\n>> +# if defined (_MSC_VER)\n>> +#  define _WIN32_WINNT 0x0502\n>> +# endif\n>>  # include <winsock2.h>\n>>  # include <windows.h>\n>>  # include <io.h>\n> \n> Don't you have to do the same in git-compat-util.h?\n\nNo. compat/win32/sys/poll.c doesn't include git-compat-util.h (and I\ndon't think it should), so adding it there would not solve the immediate\nproblem. Also, I don't see any reason to restrict the API used by both\nMinGW and msvc in other parts of git.\n\nATB,\nRamsay Jones\n"},{"id":"157620","messageId":"201012082042.06935.j6t@kdbg.org","threadId":"25955","inReplyTo":"4CFECEBB.7060703@ramsay1.demon.co.uk","subject":"Re: [PATCH 01/14] msvc: Fix compilation errors in compat/win32/sys/poll.c","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-12-08T19:42:06Z","receivedAt":"2010-12-08T19:42:06Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Mittwoch, 8. Dezember 2010, Ramsay Jones wrote:\n> Johannes Sixt wrote:\n> > On Samstag, 4. Dezember 2010, Ramsay Jones wrote:\n> >> diff --git a/compat/win32/sys/poll.c b/compat/win32/sys/poll.c\n> >> index 7e74ebe..708a6c9 100644\n> >> --- a/compat/win32/sys/poll.c\n> >> +++ b/compat/win32/sys/poll.c\n> >> @@ -34,6 +34,9 @@\n> >>\n> >>  #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__\n> >>  # define WIN32_NATIVE\n> >> +# if defined (_MSC_VER)\n> >> +#  define _WIN32_WINNT 0x0502\n> >> +# endif\n> >>  # include <winsock2.h>\n> >>  # include <windows.h>\n> >>  # include <io.h>\n> >\n> > Don't you have to do the same in git-compat-util.h?\n>\n> No. compat/win32/sys/poll.c doesn't include git-compat-util.h (and I\n> don't think it should),\n\nI know and I agree.\n\n> so adding it there would not solve the immediate \n> problem.\n\nDidn't I say: \"do the same...\"? :-) So the question remains open. After all, \nby doing so, you would make sure that the rest of git sees the same API \n(struct definitions and #defined constants) as compat/win32/sys/poll.c, no?\n\n-- Hannes\n"},{"id":"157866","messageId":"201012112309.51102.j6t@kdbg.org","threadId":"25955","inReplyTo":"4D039E73.80301@ramsay1.demon.co.uk","subject":"Re: [PATCH 01/14] msvc: Fix compilation errors in compat/win32/sys/poll.c","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-12-11T22:09:51Z","receivedAt":"2010-12-11T22:09:51Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Samstag, 11. Dezember 2010, Ramsay Jones wrote:\n> Before sending the patch, I generated a\n> before and after pre-processor file and spent about 2-3 hours using tkdiff,\n> vim, grep etc., to try and determine if it was a \"safe\" change.\n\nThanks. This dispels my concerns.\n\n-- Hannes\n"}]}