summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2015-02-10 09:53:32 (GMT)
committerAndreas Schneider <asn@cryptomilk.org>2015-02-10 14:49:30 (GMT)
commita1bfbd86b20877a20c1e5f70271b3cf3d94a01a0 (patch)
treefbfb64a192cc7340d5801e085c8accf0dfd75dc5
parentb470f1d71459f12b1c0440f6c69f33a1f27a2db6 (diff)
downloadcmocka-a1bfbd86b20877a20c1e5f70271b3cf3d94a01a0.zip
cmocka-a1bfbd86b20877a20c1e5f70271b3cf3d94a01a0.tar.gz
cmocka-a1bfbd86b20877a20c1e5f70271b3cf3d94a01a0.tar.bz2
cmocka: Fix printf integer formats.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/cmocka.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/cmocka.c b/src/cmocka.c
index 885cf33..c0a1bcf 100644
--- a/src/cmocka.c
+++ b/src/cmocka.c
@@ -47,21 +47,53 @@
WINBASEAPI BOOL WINAPI IsDebuggerPresent(VOID);
#ifndef PRIdS
-#define PRIdS "Id"
+# define PRIdS "Id"
#endif
#ifndef PRIu64
-#define PRIu64 "I64u"
+# define PRIu64 "I64u"
+#endif
+
+#ifndef PRIuMAX
+# define PRIuMAX PRIu64
+#endif
+
+#ifndef PRIxMAX
+#define PRIxMAX "I64x"
+#endif
+
+#ifndef PRIXMAX
+#define PRIXMAX "I64X"
#endif
#else /* _WIN32 */
+#ifndef __PRI64_PREFIX
+# if __WORDSIZE == 64
+# define __PRI64_PREFIX "l"
+# else
+# define __PRI64_PREFIX "ll"
+# endif
+#endif
+
#ifndef PRIdS
-#define PRIdS "zd"
+# define PRIdS "zd"
#endif
#ifndef PRIu64
-#define PRIu64 "llu"
+# define PRIu64 __PRI64_PREFIX "u"
+#endif
+
+#ifndef PRIuMAX
+# define PRIuMAX __PRI64_PREFIX "u"
+#endif
+
+#ifndef PRIxMAX
+#define PRIxMAX __PRI64_PREFIX "x"
+#endif
+
+#ifndef PRIXMAX
+#define PRIXMAX __PRI64_PREFIX "X"
#endif
#include <signal.h>