aboutsummaryrefslogtreecommitdiff
path: root/src/lib/math
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-09-17 14:51:43 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2019-09-17 14:51:43 +0300
commit585eaa123f21c4fed85865b938aeafac47730fec (patch)
treeb6eaf236704293d0c291f1d587a2a4ed62ea920a /src/lib/math
parenta28a682a1fc89eb6f96b5397518c78b85dbf160d (diff)
parent34bab120df213970edf32db1f3462ff2585ee098 (diff)
downloadtor-585eaa123f21c4fed85865b938aeafac47730fec.tar.gz
tor-585eaa123f21c4fed85865b938aeafac47730fec.zip
Merge branch 'tor-github/pr/1323'
Diffstat (limited to 'src/lib/math')
-rw-r--r--src/lib/math/fp.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/lib/math/fp.c b/src/lib/math/fp.c
index 52c57c1d7f..616e4f15c0 100644
--- a/src/lib/math/fp.c
+++ b/src/lib/math/fp.c
@@ -62,12 +62,16 @@ clamp_double_to_int64(double number)
{
int exponent;
-#if defined(MINGW_ANY) && GCC_VERSION >= 409
+#if (defined(MINGW_ANY)||defined(__FreeBSD__)) && GCC_VERSION >= 409
/*
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.
+
+ FreeBSD's math.h uses an __fp_type_select() macro, which dispatches
+ based on sizeof -- again, this can generate type warnings from
+ branches that are not taken.
*/
#define PROBLEMATIC_FLOAT_CONVERSION_WARNING
DISABLE_GCC_WARNING(float-conversion)
@@ -123,16 +127,12 @@ int
tor_isinf(double x)
{
/* Same as above, work around the "double promotion" warnings */
-#if defined(MINGW_ANY) && GCC_VERSION >= 409
-#define PROBLEMATIC_FLOAT_CONVERSION_WARNING
+#ifdef PROBLEMATIC_FLOAT_CONVERSION_WARNING
DISABLE_GCC_WARNING(float-conversion)
-#endif /* defined(MINGW_ANY) && GCC_VERSION >= 409 */
-#if defined(__clang__)
-#if __has_warning("-Wdouble-promotion")
-#define PROBLEMATIC_DOUBLE_PROMOTION_WARNING
+#endif
+#ifdef PROBLEMATIC_DOUBLE_PROMOTION_WARNING
DISABLE_GCC_WARNING(double-promotion)
#endif
-#endif /* defined(__clang__) */
return isinf(x);
#ifdef PROBLEMATIC_DOUBLE_PROMOTION_WARNING
ENABLE_GCC_WARNING(double-promotion)
@@ -141,4 +141,3 @@ ENABLE_GCC_WARNING(double-promotion)
ENABLE_GCC_WARNING(float-conversion)
#endif
}
-