{"thread":{"id":"34908","subject":"[PATCH] Windows: Do not redefine _WIN32_WINNT","startedAt":"2013-09-11T16:06:31Z","lastAt":"2013-09-12T08:41:29Z","messageCount":5,"participants":["Sebastian Schuberth","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"227458","messageId":"52309507.1090908@gmail.com","threadId":"34908","inReplyTo":null,"subject":"[PATCH] Windows: Do not redefine _WIN32_WINNT","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2013-09-11T16:06:31Z","receivedAt":"2013-09-11T16:06:31Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"With MinGW runtime version 4.0 this interferes with the previous definition\nfrom sdkddkver.h.\n\nSigned-off-by: Sebastian Schuberth <sschuberth@gmail.com>\n---\n compat/nedmalloc/malloc.c.h | 2 ++\n git-compat-util.h           | 2 ++\n 2 files changed, 4 insertions(+)\n\ndiff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h\nindex 1401a67..930d03b 100644\n--- a/compat/nedmalloc/malloc.c.h\n+++ b/compat/nedmalloc/malloc.c.h\n@@ -495,7 +495,9 @@ MAX_RELEASE_CHECK_RATE   default: 4095 unless not HAVE_MMAP\n #endif  /* WIN32 */\n #ifdef WIN32\n #define WIN32_LEAN_AND_MEAN\n+#ifndef _WIN32_WINNT\n #define _WIN32_WINNT 0x403\n+#endif\n #include <windows.h>\n #define HAVE_MMAP 1\n #define HAVE_MORECORE 0\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 664305c..f5c756d 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -93,7 +93,9 @@\n #undef __NO_INLINE__\n \n #ifdef WIN32 /* Both MinGW and MSVC */\n+#ifndef _WIN32_WINNT\n #define _WIN32_WINNT 0x0502\n+#endif\n #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n #include <winsock2.h>\n #include <windows.h>\n-- \n1.8.3.mingw.1.2.g56240b5.dirty\n"},{"id":"227477","messageId":"xmqq4n9rtdol.fsf@gitster.dls.corp.google.com","threadId":"34908","inReplyTo":"52309507.1090908@gmail.com","subject":"Re: [PATCH] Windows: Do not redefine _WIN32_WINNT","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-09-11T18:29:14Z","receivedAt":"2013-09-11T18:29:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sebastian Schuberth <sschuberth@gmail.com> writes:\n\n> diff --git a/git-compat-util.h b/git-compat-util.h\n> index 664305c..f5c756d 100644\n> --- a/git-compat-util.h\n> +++ b/git-compat-util.h\n> @@ -93,7 +93,9 @@\n>  #undef __NO_INLINE__\n>  \n>  #ifdef WIN32 /* Both MinGW and MSVC */\n> +#ifndef _WIN32_WINNT\n>  #define _WIN32_WINNT 0x0502\n> +#endif\n>  #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n>  #include <winsock2.h>\n>  #include <windows.h>\n\nThis unfortunately does not seem to match what I have. I think the\npatch is based on the codebase before these two:\n\n 380395d0 (mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVE, 2013-05-02)\n 41f29991 (msvc: Fix compilation errors caused by poll.h emulation, 2013-01-31)\n\nI could of course wiggle it in, if you want, but I wanted to know\nwhat is going on.  Is it a pre-release freeze period on your side or\nsomething?\n"},{"id":"227490","messageId":"CAHGBnuPdixkH42SNW0enF8C-GFwH8gX8NOXb69VscV3qvA6bxg@mail.gmail.com","threadId":"34908","inReplyTo":"xmqq4n9rtdol.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] Windows: Do not redefine _WIN32_WINNT","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2013-09-11T20:03:27Z","receivedAt":"2013-09-11T20:03:27Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On Wed, Sep 11, 2013 at 8:29 PM, Junio C Hamano <gitster@pobox.com> wrote:\n\n> This unfortunately does not seem to match what I have. I think the\n> patch is based on the codebase before these two:\n>\n>  380395d0 (mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVE, 2013-05-02)\n>  41f29991 (msvc: Fix compilation errors caused by poll.h emulation, 2013-01-31)\n>\n> I could of course wiggle it in, if you want, but I wanted to know\n> what is going on.  Is it a pre-release freeze period on your side or\n> something?\n\nThat's right, I currently have a code freeze at Git 1.8.3 because I\nneed to solve several other issues with Git 1.8.4 on Windows first.\nI'd be grateful if you could \"wiggle it in\".\n\n-- \nSebastian Schuberth\n"},{"id":"227495","messageId":"xmqq61u7rpr3.fsf@gitster.dls.corp.google.com","threadId":"34908","inReplyTo":"CAHGBnuPdixkH42SNW0enF8C-GFwH8gX8NOXb69VscV3qvA6bxg@mail.gmail.com","subject":"Re: [PATCH] Windows: Do not redefine _WIN32_WINNT","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-09-11T21:51:28Z","receivedAt":"2013-09-11T21:51:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sebastian Schuberth <sschuberth@gmail.com> writes:\n\n> On Wed, Sep 11, 2013 at 8:29 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n>> This unfortunately does not seem to match what I have. I think the\n>> patch is based on the codebase before these two:\n>>\n>>  380395d0 (mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVE, 2013-05-02)\n>>  41f29991 (msvc: Fix compilation errors caused by poll.h emulation, 2013-01-31)\n>>\n>> I could of course wiggle it in, if you want, but I wanted to know\n>> what is going on.  Is it a pre-release freeze period on your side or\n>> something?\n>\n> That's right, I currently have a code freeze at Git 1.8.3 because I\n> need to solve several other issues with Git 1.8.4 on Windows first.\n> I'd be grateful if you could \"wiggle it in\".\n\nIt seems that compat/poll/poll.c also defines _WIN32_WINNT (but only\nwith _MSC_VER defined).  The change to git-compat-util.h in this\npatch avoids redefinition for both MinGW and MSVC case.  Do you also\nneed to have this, too?\n\nHere is what I tentatively queued on top of the three from Karsten,\nand your \"Fix stat definitions\".\n\n-- >8 --\nFrom: Sebastian Schuberth <sschuberth@gmail.com>\nDate: Wed, 11 Sep 2013 18:06:31 +0200\nSubject: [PATCH] Windows: do not redefine _WIN32_WINNT\n\nWith MinGW runtime version 4.0 this interferes with the previous\ndefinition from sdkddkver.h.\n\nSigned-off-by: Sebastian Schuberth <sschuberth@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n compat/nedmalloc/malloc.c.h | 2 ++\n compat/poll/poll.c          | 2 +-\n git-compat-util.h           | 2 +-\n 3 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/nedmalloc/malloc.c.h b/compat/nedmalloc/malloc.c.h\nindex ed4f1fa..f216a2a 100644\n--- a/compat/nedmalloc/malloc.c.h\n+++ b/compat/nedmalloc/malloc.c.h\n@@ -499,7 +499,9 @@ MAX_RELEASE_CHECK_RATE   default: 4095 unless not HAVE_MMAP\n #endif  /* WIN32 */\n #ifdef WIN32\n #define WIN32_LEAN_AND_MEAN\n+#ifndef _WIN32_WINNT\n #define _WIN32_WINNT 0x403\n+#endif\n #include <windows.h>\n #define HAVE_MMAP 1\n #define HAVE_MORECORE 0\ndiff --git a/compat/poll/poll.c b/compat/poll/poll.c\nindex 4410310..31163f2 100644\n--- a/compat/poll/poll.c\n+++ b/compat/poll/poll.c\n@@ -39,7 +39,7 @@\n \n #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__\n # define WIN32_NATIVE\n-# if defined (_MSC_VER)\n+# if defined (_MSC_VER) && !defined(_WIN32_WINNT)\n #  define _WIN32_WINNT 0x0502\n # endif\n # include <winsock2.h>\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 9549de6..7776f12 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -86,7 +86,7 @@\n #define _SGI_SOURCE 1\n \n #if defined(WIN32) && !defined(__CYGWIN__) /* Both MinGW and MSVC */\n-# if defined (_MSC_VER)\n+# if defined (_MSC_VER) && !defined(_WIN32_WINNT)\n #  define _WIN32_WINNT 0x0502\n # endif\n #define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n-- \n1.8.4-469-g57f7e3a\n"},{"id":"227511","messageId":"CAHGBnuPXPrpfdQYuwHz-AhLWcY3fx7KoWQ9L+RRz9hPnoQL4Dg@mail.gmail.com","threadId":"34908","inReplyTo":"xmqq61u7rpr3.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] Windows: Do not redefine _WIN32_WINNT","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2013-09-12T08:41:29Z","receivedAt":"2013-09-12T08:41:29Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On Wed, Sep 11, 2013 at 11:51 PM, Junio C Hamano <gitster@pobox.com> wrote:\n\n> It seems that compat/poll/poll.c also defines _WIN32_WINNT (but only\n> with _MSC_VER defined).  The change to git-compat-util.h in this\n> patch avoids redefinition for both MinGW and MSVC case.  Do you also\n> need to have this, too?\n\nIn my patch I did not change poll.c because I did only check this\nissue with MinGW, not MSVC, so I never ran into the _MSC_VER code\npath. Back in 1.8.3 git-compat-util.h did define _WIN32_WINNT for both\nMinGW and MSVC, which is why in my patch I had to add the #ifndef /\n#endif. But I believe it's good to have these guards for both MinGW\nand MSVC, actually.\n\n> Here is what I tentatively queued on top of the three from Karsten,\n> and your \"Fix stat definitions\".\n\nLooks good to me, thanks!\n\n-- \nSebastian Schuberth\n"}]}