{"thread":{"id":"41864","subject":"[PATCH 2/2] MSVC: VS2013 comes with inttypes.h","startedAt":"2016-03-29T16:27:00Z","lastAt":"2016-03-30T18:19:01Z","messageCount":9,"participants":["Sven Strickroth","Junio C Hamano","Sebastian Schuberth","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"282067","messageId":"56FAACD4.9080504@cs-ware.de","threadId":"41864","inReplyTo":null,"subject":"[PATCH 2/2] MSVC: VS2013 comes with inttypes.h","fromName":"Sven Strickroth","fromEmail":"sven@cs-ware.de","sentAt":"2016-03-29T16:27:00Z","receivedAt":"2016-03-29T16:27:00Z","isPatch":true,"sender":{"key":"sven@cs-ware.de","avatar":null},"body":"Reduce the number of defines which need to be managed within vanilal git.\n\nSigned-off-by: Sven Strickroth <sven@cs-ware.de>\n---\n compat/mingw.h                  | 2 +-\n compat/vcbuild/include/unistd.h | 2 ++\n 2 files changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 6b6d695..5d7f0dd 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);\n extern void build_libgit_environment(void);\n extern const char *program_data_config(void);\n #define git_program_data_config program_data_config\n-#ifndef __MINGW64_VERSION_MAJOR\n+#if !defined(__MINGW64_VERSION_MAJOR) || !defined(_MSC_VER) || _MSC_VER < 1800\n #define PRIuMAX \"I64u\"\n #define PRId64 \"I64d\"\n #else\ndiff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h\nindex c65c2cd..b4b7b7c 100644\n--- a/compat/vcbuild/include/unistd.h\n+++ b/compat/vcbuild/include/unistd.h\n@@ -45,11 +45,13 @@ typedef unsigned long long uintmax_t;\n \n typedef int64_t off64_t;\n \n+#if !defined(_MSC_VER) || _MSC_VER < 1800\n #define INTMAX_MIN  _I64_MIN\n #define INTMAX_MAX  _I64_MAX\n #define UINTMAX_MAX _UI64_MAX\n \n #define UINT32_MAX 0xffffffff  /* 4294967295U */\n+#endif\n \n #define STDIN_FILENO  0\n #define STDOUT_FILENO 1\n-- \n2.7.4.windows.1\n"},{"id":"282069","messageId":"xmqqegatz0xi.fsf@gitster.mtv.corp.google.com","threadId":"41864","inReplyTo":"56FAACD4.9080504@cs-ware.de","subject":"Re: [PATCH 2/2] MSVC: VS2013 comes with inttypes.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-29T16:47:05Z","receivedAt":"2016-03-29T16:47:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sven Strickroth <sven@cs-ware.de> writes:\n\n> Reduce the number of defines which need to be managed within vanilal git.\n\nHmph.\n\n>\n> Signed-off-by: Sven Strickroth <sven@cs-ware.de>\n> ---\n\nI am not qualified to judge the correctness of the assertions this\nchange makes:\n\n * MSVC at or newer than version 1800 have PRIuMAX and PRId64\n * MSVC at or newer than version 1800 have {UINT,INT}MAX_{MIN,MAX}\n\nand will wait for Windows folks to Ack.\n\nThanks.\n\n>  compat/mingw.h                  | 2 +-\n>  compat/vcbuild/include/unistd.h | 2 ++\n>  2 files changed, 3 insertions(+), 1 deletion(-)\n>\n> diff --git a/compat/mingw.h b/compat/mingw.h\n> index 6b6d695..5d7f0dd 100644\n> --- a/compat/mingw.h\n> +++ b/compat/mingw.h\n> @@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);\n>  extern void build_libgit_environment(void);\n>  extern const char *program_data_config(void);\n>  #define git_program_data_config program_data_config\n> -#ifndef __MINGW64_VERSION_MAJOR\n> +#if !defined(__MINGW64_VERSION_MAJOR) || !defined(_MSC_VER) || _MSC_VER < 1800\n>  #define PRIuMAX \"I64u\"\n>  #define PRId64 \"I64d\"\n>  #else\n> diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h\n> index c65c2cd..b4b7b7c 100644\n> --- a/compat/vcbuild/include/unistd.h\n> +++ b/compat/vcbuild/include/unistd.h\n> @@ -45,11 +45,13 @@ typedef unsigned long long uintmax_t;\n>  \n>  typedef int64_t off64_t;\n>  \n> +#if !defined(_MSC_VER) || _MSC_VER < 1800\n>  #define INTMAX_MIN  _I64_MIN\n>  #define INTMAX_MAX  _I64_MAX\n>  #define UINTMAX_MAX _UI64_MAX\n>  \n>  #define UINT32_MAX 0xffffffff  /* 4294967295U */\n> +#endif\n>  \n>  #define STDIN_FILENO  0\n>  #define STDOUT_FILENO 1\n"},{"id":"282072","messageId":"56FAB9FD.7080409@cs-ware.de","threadId":"41864","inReplyTo":"56FAACD4.9080504@cs-ware.de","subject":"Re: [PATCH 2/2 V2] MSVC: VS2013 comes with inttypes.h","fromName":"Sven Strickroth","fromEmail":"sven@cs-ware.de","sentAt":"2016-03-29T17:23:09Z","receivedAt":"2016-03-29T17:23:09Z","isPatch":true,"sender":{"key":"sven@cs-ware.de","avatar":null},"body":"Signed-off-by: Sven Strickroth <email@cs-ware.de>\n---\n compat/mingw.h                  | 2 +-\n compat/vcbuild/include/unistd.h | 4 ++++\n 2 files changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 6b6d695..137f42e 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);\n extern void build_libgit_environment(void);\n extern const char *program_data_config(void);\n #define git_program_data_config program_data_config\n-#ifndef __MINGW64_VERSION_MAJOR\n+#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)\n #define PRIuMAX \"I64u\"\n #define PRId64 \"I64d\"\n #else\ndiff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h\nindex c65c2cd..b7cc48c 100644\n--- a/compat/vcbuild/include/unistd.h\n+++ b/compat/vcbuild/include/unistd.h\n@@ -45,11 +45,15 @@ typedef unsigned long long uintmax_t;\n \n typedef int64_t off64_t;\n \n+#if !defined(_MSC_VER) || _MSC_VER < 1800\n #define INTMAX_MIN  _I64_MIN\n #define INTMAX_MAX  _I64_MAX\n #define UINTMAX_MAX _UI64_MAX\n \n #define UINT32_MAX 0xffffffff  /* 4294967295U */\n+#else\n+#include<inttypes.h>\n+#endif\n \n #define STDIN_FILENO  0\n #define STDOUT_FILENO 1\n-- \n2.7.4.windows.1\n"},{"id":"282073","messageId":"xmqq4mbpyyp3.fsf@gitster.mtv.corp.google.com","threadId":"41864","inReplyTo":"56FAB9FD.7080409@cs-ware.de","subject":"Re: [PATCH 2/2 V2] MSVC: VS2013 comes with inttypes.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-29T17:35:20Z","receivedAt":"2016-03-29T17:35:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sven Strickroth <sven@cs-ware.de> writes:\n\n> Signed-off-by: Sven Strickroth <email@cs-ware.de>\n> ---\n\nAh, I didn't finish the comment I started to write here for the\nfirst round.  My \"Hmph\" was meant to be followed by something like\n\"Compared to 1/2 which clearly described what got changed, this does\nnot say much to summarize what it did to help readers\".\n\nRe-reading the patch text, I tend to agree with you that the title\n\"comes with inttypes.h\" may be sufficient for readers to reason\nabout the change, and it would not be necessary to explain that we\ncan lose fallback definitions by including it.\n\n>  compat/mingw.h                  | 2 +-\n>  compat/vcbuild/include/unistd.h | 4 ++++\n>  2 files changed, 5 insertions(+), 1 deletion(-)\n>\n> diff --git a/compat/mingw.h b/compat/mingw.h\n> index 6b6d695..137f42e 100644\n> --- a/compat/mingw.h\n> +++ b/compat/mingw.h\n> @@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);\n>  extern void build_libgit_environment(void);\n>  extern const char *program_data_config(void);\n>  #define git_program_data_config program_data_config\n> -#ifndef __MINGW64_VERSION_MAJOR\n> +#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)\n>  #define PRIuMAX \"I64u\"\n>  #define PRId64 \"I64d\"\n>  #else\n> diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h\n> index c65c2cd..b7cc48c 100644\n> --- a/compat/vcbuild/include/unistd.h\n> +++ b/compat/vcbuild/include/unistd.h\n> @@ -45,11 +45,15 @@ typedef unsigned long long uintmax_t;\n>  \n>  typedef int64_t off64_t;\n>  \n> +#if !defined(_MSC_VER) || _MSC_VER < 1800\n>  #define INTMAX_MIN  _I64_MIN\n>  #define INTMAX_MAX  _I64_MAX\n>  #define UINTMAX_MAX _UI64_MAX\n>  \n>  #define UINT32_MAX 0xffffffff  /* 4294967295U */\n> +#else\n> +#include<inttypes.h>\n\nSomebody lost a SP here, it seems.\n\n> +#endif\n>  \n>  #define STDIN_FILENO  0\n>  #define STDOUT_FILENO 1\n"},{"id":"282202","messageId":"56FB93B9.7090306@gmail.com","threadId":"41864","inReplyTo":"56FAB9FD.7080409@cs-ware.de","subject":"Re: [PATCH 2/2 V2] MSVC: VS2013 comes with inttypes.h","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2016-03-30T08:52:09Z","receivedAt":"2016-03-30T08:52:09Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On 3/29/2016 19:23, Sven Strickroth wrote:\n\n> --- a/compat/mingw.h\n> +++ b/compat/mingw.h\n> @@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);\n>   extern void build_libgit_environment(void);\n>   extern const char *program_data_config(void);\n>   #define git_program_data_config program_data_config\n> -#ifndef __MINGW64_VERSION_MAJOR\n> +#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)\n>   #define PRIuMAX \"I64u\"\n>   #define PRId64 \"I64d\"\n>   #else\n\nACK for this part. For reference see [1].\n\n> diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h\n> index c65c2cd..b7cc48c 100644\n> --- a/compat/vcbuild/include/unistd.h\n> +++ b/compat/vcbuild/include/unistd.h\n> @@ -45,11 +45,15 @@ typedef unsigned long long uintmax_t;\n>   \n>   typedef int64_t off64_t;\n>   \n> +#if !defined(_MSC_VER) || _MSC_VER < 1800\n>   #define INTMAX_MIN  _I64_MIN\n>   #define INTMAX_MAX  _I64_MAX\n>   #define UINTMAX_MAX _UI64_MAX\n>   \n>   #define UINT32_MAX 0xffffffff  /* 4294967295U */\n> +#else\n> +#include<inttypes.h>\n> +#endif\n\nIf we would do \"#include <stdint.h>\" here instead, we could lower the _MSC_VER requirement to at least 1700. According to the comment at [2] we could lower it even to 1600.\n\nAlso the original code is missing a single space after \"#include\".\n\n[1] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/\n[2] https://stackoverflow.com/questions/126279/c99-stdint-h-header-and-ms-visual-studio#comment4620359_126279\n\nRegards,\nSebastian\n"},{"id":"282223","messageId":"56FBBA80.8090908@cs-ware.de","threadId":"41864","inReplyTo":"56FB93B9.7090306@gmail.com","subject":"Re: [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions","fromName":"Sven Strickroth","fromEmail":"sven@cs-ware.de","sentAt":"2016-03-30T11:37:36Z","receivedAt":"2016-03-30T11:37:36Z","isPatch":true,"sender":{"key":"sven@cs-ware.de","avatar":null},"body":"VS2010 comes with stdint.h [1]\nVS2013 comes with inttypes.h [2]\n\n[1] https://stackoverflow.com/a/2628014/3906760\n[2] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/\n\nSigned-off-by: Sven Strickroth <sven@cs-ware.de>\n---\n compat/mingw.h                  | 2 +-\n compat/vcbuild/include/unistd.h | 4 ++++\n 2 files changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 6b6d695..137f42e 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);\n extern void build_libgit_environment(void);\n extern const char *program_data_config(void);\n #define git_program_data_config program_data_config\n-#ifndef __MINGW64_VERSION_MAJOR\n+#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)\n #define PRIuMAX \"I64u\"\n #define PRId64 \"I64d\"\n #else\ndiff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h\nindex c65c2cd..b7cc48c 100644\n--- a/compat/vcbuild/include/unistd.h\n+++ b/compat/vcbuild/include/unistd.h\n@@ -45,11 +45,15 @@ typedef unsigned long long uintmax_t;\n \n typedef int64_t off64_t;\n \n+#if !defined(_MSC_VER) || _MSC_VER < 1600\n #define INTMAX_MIN  _I64_MIN\n #define INTMAX_MAX  _I64_MAX\n #define UINTMAX_MAX _UI64_MAX\n \n #define UINT32_MAX 0xffffffff  /* 4294967295U */\n+#else\n+#include <stdint.h>\n+#endif\n \n #define STDIN_FILENO  0\n #define STDOUT_FILENO 1\n-- \n2.7.4.windows.1\n"},{"id":"282224","messageId":"56FBBB3B.8000004@gmail.com","threadId":"41864","inReplyTo":"56FBBA80.8090908@cs-ware.de","subject":"Re: [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2016-03-30T11:40:43Z","receivedAt":"2016-03-30T11:40:43Z","isPatch":true,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"On 3/30/2016 13:37, Sven Strickroth wrote:\n\n> VS2010 comes with stdint.h [1]\n> VS2013 comes with inttypes.h [2]\n>\n> [1] https://stackoverflow.com/a/2628014/3906760\n> [2] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/\n>\n> Signed-off-by: Sven Strickroth <sven@cs-ware.de>\n\nACK.\n\nRegards,\nSebastian\n"},{"id":"282225","messageId":"alpine.DEB.2.20.1603301341120.4690@virtualbox","threadId":"41864","inReplyTo":"56FBBA80.8090908@cs-ware.de","subject":"Re: [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-03-30T11:42:04Z","receivedAt":"2016-03-30T11:42:04Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Sven,\n\nOn Wed, 30 Mar 2016, Sven Strickroth wrote:\n\n> VS2010 comes with stdint.h [1]\n> VS2013 comes with inttypes.h [2]\n> \n> [1] https://stackoverflow.com/a/2628014/3906760\n> [2] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/\n> \n> Signed-off-by: Sven Strickroth <sven@cs-ware.de>\n\nMuch, much, much better commit message (even if there is still room for\na more pleasant read).\n\nACK\nDscho\n"},{"id":"282257","messageId":"xmqqbn5vu8ve.fsf@gitster.mtv.corp.google.com","threadId":"41864","inReplyTo":"56FBBA80.8090908@cs-ware.de","subject":"Re: [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-03-30T18:19:01Z","receivedAt":"2016-03-30T18:19:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sven Strickroth <sven@cs-ware.de> writes:\n\n> diff --git a/compat/mingw.h b/compat/mingw.h\n> index 6b6d695..137f42e 100644\n> --- a/compat/mingw.h\n> +++ b/compat/mingw.h\n> @@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);\n>  extern void build_libgit_environment(void);\n>  extern const char *program_data_config(void);\n>  #define git_program_data_config program_data_config\n> -#ifndef __MINGW64_VERSION_MAJOR\n> +#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)\n>  #define PRIuMAX \"I64u\"\n>  #define PRId64 \"I64d\"\n>  #else\n\nI'll wiggle this in, but you seem to be building on top of some\nunrelated work (please avoid sending such a patch in the future).\n\nThanks, all of you.\n\n-- >8 --\nFrom: Sven Strickroth <sven@cs-ware.de>\nDate: Wed, 30 Mar 2016 13:37:36 +0200\nSubject: [PATCH] MSVC: use shipped headers instead of fallback definitions\n\nVS2010 comes with stdint.h [1]\nVS2013 comes with inttypes.h [2]\n\n[1] https://stackoverflow.com/a/2628014/3906760\n[2] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/\n\nSigned-off-by: Sven Strickroth <sven@cs-ware.de>\nAcked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\nAcked-by: Sebastian Schuberth <sschuberth@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n compat/mingw.h                  | 2 +-\n compat/vcbuild/include/unistd.h | 4 ++++\n 2 files changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex c008694..1de70ff 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -406,7 +406,7 @@ static inline void convert_slashes(char *path)\n int mingw_offset_1st_component(const char *path);\n #define offset_1st_component mingw_offset_1st_component\n #define PATH_SEP ';'\n-#ifndef __MINGW64_VERSION_MAJOR\n+#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)\n #define PRIuMAX \"I64u\"\n #define PRId64 \"I64d\"\n #else\ndiff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h\nindex c65c2cd..3a959d1 100644\n--- a/compat/vcbuild/include/unistd.h\n+++ b/compat/vcbuild/include/unistd.h\n@@ -45,11 +45,15 @@ typedef unsigned long long uintmax_t;\n \n typedef int64_t off64_t;\n \n+#if !defined(_MSC_VER) || _MSC_VER < 1600\n #define INTMAX_MIN  _I64_MIN\n #define INTMAX_MAX  _I64_MAX\n #define UINTMAX_MAX _UI64_MAX\n \n #define UINT32_MAX 0xffffffff  /* 4294967295U */\n+#else\n+#include <stdint.h>\n+#endif\n \n #define STDIN_FILENO  0\n #define STDOUT_FILENO 1\n-- \n2.8.0-215-gd29a7d9\n"}]}