git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 2/2] MSVC: VS2013 comes with inttypes.h
@ 2016-03-29 16:27 Sven Strickroth
  2016-03-29 16:47 ` Junio C Hamano
  2016-03-29 17:23 ` [PATCH 2/2 V2] " Sven Strickroth
  0 siblings, 2 replies; 9+ messages in thread
From: Sven Strickroth @ 2016-03-29 16:27 UTC (permalink / raw)
  To: Git List, Junio C Hamano, Sebastian Schuberth, blees

Reduce the number of defines which need to be managed within vanilal git.

Signed-off-by: Sven Strickroth <sven@cs-ware.de>
---
 compat/mingw.h                  | 2 +-
 compat/vcbuild/include/unistd.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 6b6d695..5d7f0dd 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);
 extern void build_libgit_environment(void);
 extern const char *program_data_config(void);
 #define git_program_data_config program_data_config
-#ifndef __MINGW64_VERSION_MAJOR
+#if !defined(__MINGW64_VERSION_MAJOR) || !defined(_MSC_VER) || _MSC_VER < 1800
 #define PRIuMAX "I64u"
 #define PRId64 "I64d"
 #else
diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
index c65c2cd..b4b7b7c 100644
--- a/compat/vcbuild/include/unistd.h
+++ b/compat/vcbuild/include/unistd.h
@@ -45,11 +45,13 @@ typedef unsigned long long uintmax_t;
 
 typedef int64_t off64_t;
 
+#if !defined(_MSC_VER) || _MSC_VER < 1800
 #define INTMAX_MIN  _I64_MIN
 #define INTMAX_MAX  _I64_MAX
 #define UINTMAX_MAX _UI64_MAX
 
 #define UINT32_MAX 0xffffffff  /* 4294967295U */
+#endif
 
 #define STDIN_FILENO  0
 #define STDOUT_FILENO 1
-- 
2.7.4.windows.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2] MSVC: VS2013 comes with inttypes.h
  2016-03-29 16:27 [PATCH 2/2] MSVC: VS2013 comes with inttypes.h Sven Strickroth
@ 2016-03-29 16:47 ` Junio C Hamano
  2016-03-29 17:23 ` [PATCH 2/2 V2] " Sven Strickroth
  1 sibling, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2016-03-29 16:47 UTC (permalink / raw)
  To: Sven Strickroth; +Cc: Git List, Sebastian Schuberth, blees

Sven Strickroth <sven@cs-ware.de> writes:

> Reduce the number of defines which need to be managed within vanilal git.

Hmph.

>
> Signed-off-by: Sven Strickroth <sven@cs-ware.de>
> ---

I am not qualified to judge the correctness of the assertions this
change makes:

 * MSVC at or newer than version 1800 have PRIuMAX and PRId64
 * MSVC at or newer than version 1800 have {UINT,INT}MAX_{MIN,MAX}

and will wait for Windows folks to Ack.

Thanks.

>  compat/mingw.h                  | 2 +-
>  compat/vcbuild/include/unistd.h | 2 ++
>  2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/compat/mingw.h b/compat/mingw.h
> index 6b6d695..5d7f0dd 100644
> --- a/compat/mingw.h
> +++ b/compat/mingw.h
> @@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);
>  extern void build_libgit_environment(void);
>  extern const char *program_data_config(void);
>  #define git_program_data_config program_data_config
> -#ifndef __MINGW64_VERSION_MAJOR
> +#if !defined(__MINGW64_VERSION_MAJOR) || !defined(_MSC_VER) || _MSC_VER < 1800
>  #define PRIuMAX "I64u"
>  #define PRId64 "I64d"
>  #else
> diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
> index c65c2cd..b4b7b7c 100644
> --- a/compat/vcbuild/include/unistd.h
> +++ b/compat/vcbuild/include/unistd.h
> @@ -45,11 +45,13 @@ typedef unsigned long long uintmax_t;
>  
>  typedef int64_t off64_t;
>  
> +#if !defined(_MSC_VER) || _MSC_VER < 1800
>  #define INTMAX_MIN  _I64_MIN
>  #define INTMAX_MAX  _I64_MAX
>  #define UINTMAX_MAX _UI64_MAX
>  
>  #define UINT32_MAX 0xffffffff  /* 4294967295U */
> +#endif
>  
>  #define STDIN_FILENO  0
>  #define STDOUT_FILENO 1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2 V2] MSVC: VS2013 comes with inttypes.h
  2016-03-29 16:27 [PATCH 2/2] MSVC: VS2013 comes with inttypes.h Sven Strickroth
  2016-03-29 16:47 ` Junio C Hamano
@ 2016-03-29 17:23 ` Sven Strickroth
  2016-03-29 17:35   ` Junio C Hamano
  2016-03-30  8:52   ` Sebastian Schuberth
  1 sibling, 2 replies; 9+ messages in thread
From: Sven Strickroth @ 2016-03-29 17:23 UTC (permalink / raw)
  To: Git List, Junio C Hamano, Sebastian Schuberth, blees

Signed-off-by: Sven Strickroth <email@cs-ware.de>
---
 compat/mingw.h                  | 2 +-
 compat/vcbuild/include/unistd.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 6b6d695..137f42e 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);
 extern void build_libgit_environment(void);
 extern const char *program_data_config(void);
 #define git_program_data_config program_data_config
-#ifndef __MINGW64_VERSION_MAJOR
+#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)
 #define PRIuMAX "I64u"
 #define PRId64 "I64d"
 #else
diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
index c65c2cd..b7cc48c 100644
--- a/compat/vcbuild/include/unistd.h
+++ b/compat/vcbuild/include/unistd.h
@@ -45,11 +45,15 @@ typedef unsigned long long uintmax_t;
 
 typedef int64_t off64_t;
 
+#if !defined(_MSC_VER) || _MSC_VER < 1800
 #define INTMAX_MIN  _I64_MIN
 #define INTMAX_MAX  _I64_MAX
 #define UINTMAX_MAX _UI64_MAX
 
 #define UINT32_MAX 0xffffffff  /* 4294967295U */
+#else
+#include<inttypes.h>
+#endif
 
 #define STDIN_FILENO  0
 #define STDOUT_FILENO 1
-- 
2.7.4.windows.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2 V2] MSVC: VS2013 comes with inttypes.h
  2016-03-29 17:23 ` [PATCH 2/2 V2] " Sven Strickroth
@ 2016-03-29 17:35   ` Junio C Hamano
  2016-03-30  8:52   ` Sebastian Schuberth
  1 sibling, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2016-03-29 17:35 UTC (permalink / raw)
  To: Sven Strickroth; +Cc: Git List, Sebastian Schuberth, blees

Sven Strickroth <sven@cs-ware.de> writes:

> Signed-off-by: Sven Strickroth <email@cs-ware.de>
> ---

Ah, I didn't finish the comment I started to write here for the
first round.  My "Hmph" was meant to be followed by something like
"Compared to 1/2 which clearly described what got changed, this does
not say much to summarize what it did to help readers".

Re-reading the patch text, I tend to agree with you that the title
"comes with inttypes.h" may be sufficient for readers to reason
about the change, and it would not be necessary to explain that we
can lose fallback definitions by including it.

>  compat/mingw.h                  | 2 +-
>  compat/vcbuild/include/unistd.h | 4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/compat/mingw.h b/compat/mingw.h
> index 6b6d695..137f42e 100644
> --- a/compat/mingw.h
> +++ b/compat/mingw.h
> @@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);
>  extern void build_libgit_environment(void);
>  extern const char *program_data_config(void);
>  #define git_program_data_config program_data_config
> -#ifndef __MINGW64_VERSION_MAJOR
> +#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)
>  #define PRIuMAX "I64u"
>  #define PRId64 "I64d"
>  #else
> diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
> index c65c2cd..b7cc48c 100644
> --- a/compat/vcbuild/include/unistd.h
> +++ b/compat/vcbuild/include/unistd.h
> @@ -45,11 +45,15 @@ typedef unsigned long long uintmax_t;
>  
>  typedef int64_t off64_t;
>  
> +#if !defined(_MSC_VER) || _MSC_VER < 1800
>  #define INTMAX_MIN  _I64_MIN
>  #define INTMAX_MAX  _I64_MAX
>  #define UINTMAX_MAX _UI64_MAX
>  
>  #define UINT32_MAX 0xffffffff  /* 4294967295U */
> +#else
> +#include<inttypes.h>

Somebody lost a SP here, it seems.

> +#endif
>  
>  #define STDIN_FILENO  0
>  #define STDOUT_FILENO 1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2 V2] MSVC: VS2013 comes with inttypes.h
  2016-03-29 17:23 ` [PATCH 2/2 V2] " Sven Strickroth
  2016-03-29 17:35   ` Junio C Hamano
@ 2016-03-30  8:52   ` Sebastian Schuberth
  2016-03-30 11:37     ` [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions Sven Strickroth
  1 sibling, 1 reply; 9+ messages in thread
From: Sebastian Schuberth @ 2016-03-30  8:52 UTC (permalink / raw)
  To: Sven Strickroth, Git List, Junio C Hamano, blees

On 3/29/2016 19:23, Sven Strickroth wrote:

> --- a/compat/mingw.h
> +++ b/compat/mingw.h
> @@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);
>   extern void build_libgit_environment(void);
>   extern const char *program_data_config(void);
>   #define git_program_data_config program_data_config
> -#ifndef __MINGW64_VERSION_MAJOR
> +#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)
>   #define PRIuMAX "I64u"
>   #define PRId64 "I64d"
>   #else

ACK for this part. For reference see [1].

> diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
> index c65c2cd..b7cc48c 100644
> --- a/compat/vcbuild/include/unistd.h
> +++ b/compat/vcbuild/include/unistd.h
> @@ -45,11 +45,15 @@ typedef unsigned long long uintmax_t;
>   
>   typedef int64_t off64_t;
>   
> +#if !defined(_MSC_VER) || _MSC_VER < 1800
>   #define INTMAX_MIN  _I64_MIN
>   #define INTMAX_MAX  _I64_MAX
>   #define UINTMAX_MAX _UI64_MAX
>   
>   #define UINT32_MAX 0xffffffff  /* 4294967295U */
> +#else
> +#include<inttypes.h>
> +#endif

If 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.

Also the original code is missing a single space after "#include".

[1] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/
[2] https://stackoverflow.com/questions/126279/c99-stdint-h-header-and-ms-visual-studio#comment4620359_126279

Regards,
Sebastian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions
  2016-03-30  8:52   ` Sebastian Schuberth
@ 2016-03-30 11:37     ` Sven Strickroth
  2016-03-30 11:40       ` Sebastian Schuberth
                         ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Sven Strickroth @ 2016-03-30 11:37 UTC (permalink / raw)
  To: Sebastian Schuberth, Git List, Junio C Hamano, blees

VS2010 comes with stdint.h [1]
VS2013 comes with inttypes.h [2]

[1] https://stackoverflow.com/a/2628014/3906760
[2] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/

Signed-off-by: Sven Strickroth <sven@cs-ware.de>
---
 compat/mingw.h                  | 2 +-
 compat/vcbuild/include/unistd.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index 6b6d695..137f42e 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);
 extern void build_libgit_environment(void);
 extern const char *program_data_config(void);
 #define git_program_data_config program_data_config
-#ifndef __MINGW64_VERSION_MAJOR
+#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)
 #define PRIuMAX "I64u"
 #define PRId64 "I64d"
 #else
diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
index c65c2cd..b7cc48c 100644
--- a/compat/vcbuild/include/unistd.h
+++ b/compat/vcbuild/include/unistd.h
@@ -45,11 +45,15 @@ typedef unsigned long long uintmax_t;
 
 typedef int64_t off64_t;
 
+#if !defined(_MSC_VER) || _MSC_VER < 1600
 #define INTMAX_MIN  _I64_MIN
 #define INTMAX_MAX  _I64_MAX
 #define UINTMAX_MAX _UI64_MAX
 
 #define UINT32_MAX 0xffffffff  /* 4294967295U */
+#else
+#include <stdint.h>
+#endif
 
 #define STDIN_FILENO  0
 #define STDOUT_FILENO 1
-- 
2.7.4.windows.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions
  2016-03-30 11:37     ` [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions Sven Strickroth
@ 2016-03-30 11:40       ` Sebastian Schuberth
  2016-03-30 11:42       ` Johannes Schindelin
  2016-03-30 18:19       ` Junio C Hamano
  2 siblings, 0 replies; 9+ messages in thread
From: Sebastian Schuberth @ 2016-03-30 11:40 UTC (permalink / raw)
  To: Sven Strickroth, Git List, Junio C Hamano, blees

On 3/30/2016 13:37, Sven Strickroth wrote:

> VS2010 comes with stdint.h [1]
> VS2013 comes with inttypes.h [2]
>
> [1] https://stackoverflow.com/a/2628014/3906760
> [2] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/
>
> Signed-off-by: Sven Strickroth <sven@cs-ware.de>

ACK.

Regards,
Sebastian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions
  2016-03-30 11:37     ` [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions Sven Strickroth
  2016-03-30 11:40       ` Sebastian Schuberth
@ 2016-03-30 11:42       ` Johannes Schindelin
  2016-03-30 18:19       ` Junio C Hamano
  2 siblings, 0 replies; 9+ messages in thread
From: Johannes Schindelin @ 2016-03-30 11:42 UTC (permalink / raw)
  To: Sven Strickroth; +Cc: Sebastian Schuberth, Git List, Junio C Hamano, blees

Hi Sven,

On Wed, 30 Mar 2016, Sven Strickroth wrote:

> VS2010 comes with stdint.h [1]
> VS2013 comes with inttypes.h [2]
> 
> [1] https://stackoverflow.com/a/2628014/3906760
> [2] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/
> 
> Signed-off-by: Sven Strickroth <sven@cs-ware.de>

Much, much, much better commit message (even if there is still room for
a more pleasant read).

ACK
Dscho

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions
  2016-03-30 11:37     ` [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions Sven Strickroth
  2016-03-30 11:40       ` Sebastian Schuberth
  2016-03-30 11:42       ` Johannes Schindelin
@ 2016-03-30 18:19       ` Junio C Hamano
  2 siblings, 0 replies; 9+ messages in thread
From: Junio C Hamano @ 2016-03-30 18:19 UTC (permalink / raw)
  To: Sven Strickroth; +Cc: Sebastian Schuberth, Johannes Schindelin, Git List, blees

Sven Strickroth <sven@cs-ware.de> writes:

> diff --git a/compat/mingw.h b/compat/mingw.h
> index 6b6d695..137f42e 100644
> --- a/compat/mingw.h
> +++ b/compat/mingw.h
> @@ -415,7 +415,7 @@ int mingw_offset_1st_component(const char *path);
>  extern void build_libgit_environment(void);
>  extern const char *program_data_config(void);
>  #define git_program_data_config program_data_config
> -#ifndef __MINGW64_VERSION_MAJOR
> +#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)
>  #define PRIuMAX "I64u"
>  #define PRId64 "I64d"
>  #else

I'll wiggle this in, but you seem to be building on top of some
unrelated work (please avoid sending such a patch in the future).

Thanks, all of you.

-- >8 --
From: Sven Strickroth <sven@cs-ware.de>
Date: Wed, 30 Mar 2016 13:37:36 +0200
Subject: [PATCH] MSVC: use shipped headers instead of fallback definitions

VS2010 comes with stdint.h [1]
VS2013 comes with inttypes.h [2]

[1] https://stackoverflow.com/a/2628014/3906760
[2] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/

Signed-off-by: Sven Strickroth <sven@cs-ware.de>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 compat/mingw.h                  | 2 +-
 compat/vcbuild/include/unistd.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/compat/mingw.h b/compat/mingw.h
index c008694..1de70ff 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -406,7 +406,7 @@ static inline void convert_slashes(char *path)
 int mingw_offset_1st_component(const char *path);
 #define offset_1st_component mingw_offset_1st_component
 #define PATH_SEP ';'
-#ifndef __MINGW64_VERSION_MAJOR
+#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)
 #define PRIuMAX "I64u"
 #define PRId64 "I64d"
 #else
diff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h
index c65c2cd..3a959d1 100644
--- a/compat/vcbuild/include/unistd.h
+++ b/compat/vcbuild/include/unistd.h
@@ -45,11 +45,15 @@ typedef unsigned long long uintmax_t;
 
 typedef int64_t off64_t;
 
+#if !defined(_MSC_VER) || _MSC_VER < 1600
 #define INTMAX_MIN  _I64_MIN
 #define INTMAX_MAX  _I64_MAX
 #define UINTMAX_MAX _UI64_MAX
 
 #define UINT32_MAX 0xffffffff  /* 4294967295U */
+#else
+#include <stdint.h>
+#endif
 
 #define STDIN_FILENO  0
 #define STDOUT_FILENO 1
-- 
2.8.0-215-gd29a7d9

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-03-30 18:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-29 16:27 [PATCH 2/2] MSVC: VS2013 comes with inttypes.h Sven Strickroth
2016-03-29 16:47 ` Junio C Hamano
2016-03-29 17:23 ` [PATCH 2/2 V2] " Sven Strickroth
2016-03-29 17:35   ` Junio C Hamano
2016-03-30  8:52   ` Sebastian Schuberth
2016-03-30 11:37     ` [PATCH 2/2 V3] MSVC: Use shipped headers instead of fallback definitions Sven Strickroth
2016-03-30 11:40       ` Sebastian Schuberth
2016-03-30 11:42       ` Johannes Schindelin
2016-03-30 18:19       ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).