aboutsummaryrefslogtreecommitdiff
path: root/src/lib/math/fp.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-09-10 10:53:39 -0400
committerNick Mathewson <nickm@torproject.org>2019-09-10 10:55:44 -0400
commit51475aee57523318d0b0a9e47dedad89ef1b578c (patch)
tree67540cb3b6afba164bc6ed54fe9888863f81e9a3 /src/lib/math/fp.c
parent04618371497bd5040d3af3e6fd782c361a7ba3a5 (diff)
downloadtor-51475aee57523318d0b0a9e47dedad89ef1b578c.tar.gz
tor-51475aee57523318d0b0a9e47dedad89ef1b578c.zip
fp.c: Suppress float-conversion warnings on FreeBSD.
We used to do this on Windows only, but it appears to affect multiple platforms when building with certain versions of GCC, and a common pattern for defining the floating-point classifier functions. Fixes part of 31687. I'm calling this a bugfux on 31687, when we started suppressing these warnings on Windows.
Diffstat (limited to 'src/lib/math/fp.c')
-rw-r--r--src/lib/math/fp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/math/fp.c b/src/lib/math/fp.c
index 4419635dfe..eafad358c3 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)