Use inttypes.h on VC++ 2013 and up
authorBen Vanik <ben.vanik@gmail.com>
Sun, 2 Apr 2017 22:26:06 +0000 (15:26 -0700)
committerAndreas Schuh <andreas.schuh.84@gmail.com>
Tue, 16 May 2017 10:37:59 +0000 (11:37 +0100)
Warnings will spit out on newer compilers due to PRI* being redefined.
Tested with VC++ 2015 and 2017. [Blog post](https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/) describing the defines being added in 2013.

src/windows_port.h

index 554b9c9..61cf5b7 100644 (file)
@@ -109,10 +109,14 @@ inline void setenv(const char* name, const char* value, int) {
 #define unlink   _unlink
 #endif
 
+#if defined(_MSC_VER) && _MSC_VER >= 1800
+#include <inttypes.h>
+#else
 #define PRId32  "d"
 #define PRIu32  "u"
 #define PRId64  "I64d"
 #define PRIu64  "I64u"
+#endif
 
 #if !defined(__MINGW32__) && !defined(__MINGW64__)
 #define strtoq   _strtoi64