aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2013-11-13 10:58:31 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2013-11-13 17:02:27 +0100
commitd6f690f7da2712b79550d909c5cd53432302517c (patch)
treee29a0fb7fbeed0c0194ea64a6759e8bd504937a9 /src/util.h
parentb3e579713f14309a330a44171abd47c2e851a7b0 (diff)
downloadbitcoin-d6f690f7da2712b79550d909c5cd53432302517c.tar.xz
Use C99 printf statements in mingw
Otherwise, format specifiers such as %llu will not work on XP or earlier. This bug was introduced with 51ed9ec9. http://sourceforge.net/apps/trac/mingw-w64/wiki/gnu%20printf
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/util.h b/src/util.h
index d3687620dc..9c7f185f13 100644
--- a/src/util.h
+++ b/src/util.h
@@ -44,26 +44,13 @@ static const int64_t CENT = 1000000;
#define UEND(a) ((unsigned char*)&((&(a))[1]))
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
-/* Format characters for (s)size_t and ptrdiff_t */
-#if defined(_MSC_VER) || defined(__MSVCRT__)
- /* (s)size_t and ptrdiff_t have the same size specifier in MSVC:
- http://msdn.microsoft.com/en-us/library/tcxf1dw6%28v=vs.100%29.aspx
- */
- #define PRIszx "Ix"
- #define PRIszu "Iu"
- #define PRIszd "Id"
- #define PRIpdx "Ix"
- #define PRIpdu "Iu"
- #define PRIpdd "Id"
-#else /* C99 standard */
- #define PRIszx "zx"
- #define PRIszu "zu"
- #define PRIszd "zd"
- #define PRIpdx "tx"
- #define PRIpdu "tu"
- #define PRIpdd "td"
-#endif
-
+/* Format characters for (s)size_t and ptrdiff_t (C99 standard) */
+#define PRIszx "zx"
+#define PRIszu "zu"
+#define PRIszd "zd"
+#define PRIpdx "tx"
+#define PRIpdu "tu"
+#define PRIpdd "td"
// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
#define PAIRTYPE(t1, t2) std::pair<t1, t2>
@@ -117,7 +104,7 @@ inline void MilliSleep(int64_t n)
* Parameters count from 1.
*/
#ifdef __GNUC__
-#define ATTR_WARN_PRINTF(X,Y) __attribute__((format(printf,X,Y)))
+#define ATTR_WARN_PRINTF(X,Y) __attribute__((format(gnu_printf,X,Y)))
#else
#define ATTR_WARN_PRINTF(X,Y)
#endif