summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-07-26 12:53:38 -0400
committerNick Mathewson <nickm@torproject.org>2017-07-26 12:53:38 -0400
commitd068f3359f86f5f0d5df693e8e0377d0d45540d4 (patch)
tree51ce35bcd667fc63328ca39a9c9c57536ff402d5 /src
parent52c1754ff6b7f181ab40d1f3148ed6a28d60cef5 (diff)
parent3c017e823bdcfeea4316755b208fa2bf9df5fb00 (diff)
downloadtor-d068f3359f86f5f0d5df693e8e0377d0d45540d4.tar.gz
tor-d068f3359f86f5f0d5df693e8e0377d0d45540d4.zip
Merge branch 'maint-0.3.0' into maint-0.3.1
Diffstat (limited to 'src')
-rw-r--r--src/common/util.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index f53a99533b..5b47028097 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -5608,6 +5608,18 @@ clamp_double_to_int64(double number)
#define PROBLEMATIC_FLOAT_CONVERSION_WARNING
DISABLE_GCC_WARNING(float-conversion)
#endif
+
+/*
+ With clang 4.0 we apparently run into "double promotion" warnings here,
+ since clang thinks we're promoting a double to a long double.
+ */
+#if defined(__clang__)
+#if __has_warning("-Wdouble-promotion")
+#define PROBLEMATIC_DOUBLE_PROMOTION_WARNING
+DISABLE_GCC_WARNING(double-promotion)
+#endif
+#endif
+
/* NaN is a special case that can't be used with the logic below. */
if (isnan(number)) {
return 0;
@@ -5633,6 +5645,10 @@ DISABLE_GCC_WARNING(float-conversion)
/* Handle infinities and finite numbers with magnitude >= 2^63. */
return signbit(number) ? INT64_MIN : INT64_MAX;
+
+#ifdef PROBLEMATIC_DOUBLE_PROMOTION_WARNING
+ENABLE_GCC_WARNING(double-promotion)
+#endif
#ifdef PROBLEMATIC_FLOAT_CONVERSION_WARNING
ENABLE_GCC_WARNING(float-conversion)
#endif