changeset 723:10f2eba7c59b

Perhaps improve type definitions for MinGW v8+
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 18 Oct 2021 01:04:46 +0300
parents 4ca6a3b30fe8
children 388d72f4189d
files th_types.h
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/th_types.h	Sat Jan 02 11:35:54 2021 +0200
+++ b/th_types.h	Mon Oct 18 01:04:46 2021 +0300
@@ -14,6 +14,13 @@
 #define TH_TYPES_H 1
 
 
+// Meh, this is a hack due to the crap non-portability of 64bit
+// printf PRI* type specifiers/modifiers
+#if !defined(TH_USE_BONK_TYPES) && (defined(__MINGW32__) || defined(__MINGW64__))
+#  define __USE_MINGW_ANSI_STDIO 1
+#endif
+
+
 // Check for system type
 #if defined(__WIN64) || defined(_WIN64) || defined(__WIN32) || defined(_WIN32)
 #  define TH_PLAT_WINDOWS 1
@@ -102,7 +109,7 @@
 #  define PRId_SSIZE_T      PRId32
 #  define PRIx_SIZE_T       PRIx32
 #  define PRIX_SIZE_T       PRIX32
-#  ifdef TH_PLAT_WINDOWS
+#  ifdef TH_USE_BONK_TYPES
 #    define PRId_OFF_T      "ld"
 #    define PRIx_OFF_T      "lx"
 #    define PRIX_OFF_T      "lX"
@@ -120,7 +127,7 @@
 #    define UINTPTR_MAX   ( 0xffffffffUL)
 #  endif
 #elif TH_ARCH == 64
-#  ifdef TH_PLAT_WINDOWS // Unsure if this is MinGW64 only thing?
+#  ifdef TH_USE_BONK_TYPES
 #    define PRIu_SIZE_T     "I64u"
 #    define PRId_SSIZE_T    "I64d"
 #    define PRIx_SIZE_T     "I64x"