aboutsummaryrefslogtreecommitdiff
path: root/src/cmocka.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2020-10-05 13:36:22 +0200
committerAndreas Schneider <asn@cryptomilk.org>2020-10-12 08:25:26 +0200
commit00b3deb56dc45819496277d28435a273e6b9b602 (patch)
tree4a2a6c802aa5d7f75263eaeff89cbab43caca820 /src/cmocka.c
parent36b929f0fbfc17a70a5b61a0583dfdac147244c4 (diff)
downloadcmocka-00b3deb56dc45819496277d28435a273e6b9b602.tar.gz
cmocka-00b3deb56dc45819496277d28435a273e6b9b602.tar.xz
cmocka-00b3deb56dc45819496277d28435a273e6b9b602.zip
cmocka: Move PrintFormat defines to C file
Diffstat (limited to 'src/cmocka.c')
-rw-r--r--src/cmocka.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/cmocka.c b/src/cmocka.c
index d94feb0..513eb9d 100644
--- a/src/cmocka.c
+++ b/src/cmocka.c
@@ -109,6 +109,39 @@
# define cm_longjmp(env, val) longjmp(env, val)
#endif
+/* Printf format used to display uintmax_t as a hexidecimal. */
+#ifndef UintMaxTypePrintfFormat
+# ifdef _WIN32
+# define UintMaxTypePrintfFormat "0x%I64x"
+# else
+# if __WORDSIZE == 64
+# define UintMaxTypePrintfFormat "%#lx"
+# else
+# define UintMaxTypePrintfFormat "%#llx"
+# endif
+# endif /* _WIN32 */
+#endif /* UintMaxTypePrintfFormat */
+
+/* Printf format used to display uintmax_t as a decimal. */
+#ifndef UintMaxTypePrintfFormatDecimal
+# ifdef _WIN32
+# define UintMaxTypePrintfFormatDecimal "%I64u"
+# else
+# if __WORDSIZE == 64
+# define UintMaxTypePrintfFormatDecimal "%lu"
+# else
+# define UintMaxTypePrintfFormatDecimal "%llu"
+# endif
+# endif /* _WIN32 */
+#endif /* UintMaxTypePrintfFormat */
+
+#ifndef FloatPrintfFormat
+# define FloatPrintfFormat "%f"
+#endif /* FloatPrintfFormat */
+
+#ifndef DoublePrintfFormat
+# define DoublePrintfFormat "%f"
+#endif /* DoublePrintfFormat */
/*
* Declare and initialize a uintmax_t variable name