diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-07-03 10:59:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-07-03 10:59:31 -0400 |
commit | 536103221911692d546d7325435812c29bb32ff1 (patch) | |
tree | 2206786e9004fbc86962e2f0257d0a49c7297cf6 /src/common/util.c | |
parent | 3483f7c00349be6cba7b703f2e5ee94563d0c6eb (diff) | |
download | tor-536103221911692d546d7325435812c29bb32ff1.tar.gz tor-536103221911692d546d7325435812c29bb32ff1.zip |
Fix -Wfloat-conversion C warnings on mingw in clamp_double_to_int64.
We just have to suppress these warnings: 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.
Fixes bug 22801; bugfix on 0.2.8.1-alpha.
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c index f3effe0957..b2b97613a7 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -5537,6 +5537,15 @@ clamp_double_to_int64(double number) { int exp; +#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; @@ -5562,5 +5571,8 @@ 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 } |