summaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-07-05 11:19:03 -0400
committerNick Mathewson <nickm@torproject.org>2017-07-05 11:19:03 -0400
commit0f97f963e3c267852a3f28538c5ddb196ce0bb42 (patch)
tree82714b9cc7c68d2f5c69ab717a8c096a3e69787c /src/common/util.c
parente88aa98451e5fe28b2840cf218dba67e4596aa56 (diff)
parent8bc70a2ad2c0363986e4b002ceaf259908d67e70 (diff)
downloadtor-0f97f963e3c267852a3f28538c5ddb196ce0bb42.tar.gz
tor-0f97f963e3c267852a3f28538c5ddb196ce0bb42.zip
Merge branch 'maint-0.3.0' into maint-0.3.1
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 745b3a8961..07502e2e6c 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -5598,6 +5598,15 @@ clamp_double_to_int64(double number)
{
int exponent;
+#if defined(__MINGW32__) || defined(__MINGW64__)
+/*
+ Mingw's math.h uses gcc's __builtin_choose_expr() facility to declare
+ isnan, isfinite, and signbit. But as implemented in at least some
+ versions of gcc, __builtin_choose_expr() can generate type warnings
+ even from branches that are not taken. So, suppress those warnings.
+*/
+DISABLE_GCC_WARNING(float-conversion)
+#endif
/* NaN is a special case that can't be used with the logic below. */
if (isnan(number)) {
return 0;
@@ -5623,6 +5632,9 @@ clamp_double_to_int64(double number)
/* Handle infinities and finite numbers with magnitude >= 2^63. */
return signbit(number) ? INT64_MIN : INT64_MAX;
+#if defined(__MINGW32__) || defined(__MINGW64__)
+ENABLE_GCC_WARNING(float-conversion)
+#endif
}
/** Return a uint64_t value from <b>a</b> in network byte order. */