aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-07-05 11:18:59 -0400
committerNick Mathewson <nickm@torproject.org>2017-07-05 11:18:59 -0400
commitbb97f680e74170673246b3de32e847ade46840f2 (patch)
tree0781fc127b838294d676ee48695da8c92bf21adc /src
parentec9c6d77234809d5bdc06357100ca4bffbbec18c (diff)
parent536103221911692d546d7325435812c29bb32ff1 (diff)
downloadtor-bb97f680e74170673246b3de32e847ade46840f2.tar.gz
tor-bb97f680e74170673246b3de32e847ade46840f2.zip
Merge branch 'bug22801_028' into maint-0.2.9
Diffstat (limited to 'src')
-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 a7bce2ea6c..b7468dfcb3 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -5695,6 +5695,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;
@@ -5720,6 +5729,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. */