Thread (6 messages) flat view 6 messages, 3 authors, 2016-06-15

Re: [PATCH 2/2 V2] MSVC: VS2013 comes with inttypes.h

From: Sebastian Schuberth <hidden>
Date: 2016-06-15 23:09:07

On 3/29/2016 19:23, Sven Strickroth wrote:
quoted hunk ↗ jump to hunk
--- 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].
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help