summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAdam Eijdenberg <adam.eijdenberg@gmail.com>2015-08-04 19:08:22 -0700
committerEmilia Kasper <emilia@openssl.org>2015-09-01 20:18:46 +0200
commitfb029cebaeb6b0dbdb05a26a515e38a52a3c0fa1 (patch)
tree36dea3d54c14d8e5bbefdd9d26eb5f6825ddb3d3 /include
parent08a721ac613d69217b474a61882971ae9d4586d1 (diff)
RT3984: Fix clang compiler warning on Mac OS X where %ld is used for uint64_t.
clang suggests %llu instead, but it isn't clear that is portable on all platforms. C99 and above define a handy macro for us, so we try to use that definition and fall back to current definition if needed (though we switch to 'u' for unsigned). Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'include')
-rw-r--r--include/openssl/e_os2.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/openssl/e_os2.h b/include/openssl/e_os2.h
index 177b0981e3..9f7dcf1619 100644
--- a/include/openssl/e_os2.h
+++ b/include/openssl/e_os2.h
@@ -294,6 +294,22 @@ typedef unsigned __int64 uint64_t;
# include <stdint.h>
# endif
+/*
+ * We need a format operator for some client tools for uint64_t.
+ * This is an attempt at doing so in a portable manner.
+ * If we can't use a built-in definition, we'll revert to the previous
+ * behavior that was hard-coded but now causing compiler warnings on
+ * some systems (e.g. Mac OS X).
+ */
+# ifndef PRIu64
+# if (__STDC_VERSION__ >= 199901L)
+# include <inttypes.h>
+# endif
+# ifndef PRIu64
+# define PRIu64 "lu"
+# endif
+# endif
+
#ifdef __cplusplus
}
#endif