From 8ab4c010dc982aafce0b8048f72ede0252c18fb0 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Wed, 31 Jan 2018 13:12:50 -0700 Subject: BUG: Fix unused-result warning. Fixes the `raise_inexact` macro, used as an efficient way to raise the inexact floating point exception, to no longer issue an unused-result warning. The warning is enabled in Python >= 3.5. There is an extended discussion of the macro and its intent at: https://lists.freebsd.org/pipermail/freebsd-hackers/2017-May/051004.html --- numpy/core/src/npymath/npy_math_complex.c.src | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'numpy/core/src') diff --git a/numpy/core/src/npymath/npy_math_complex.c.src b/numpy/core/src/npymath/npy_math_complex.c.src index fb31e8e6a..ea784ec5b 100644 --- a/numpy/core/src/npymath/npy_math_complex.c.src +++ b/numpy/core/src/npymath/npy_math_complex.c.src @@ -35,11 +35,17 @@ #include "npy_math_private.h" #include - -#define raise_inexact() do { volatile npy_float junk = 1 + tiny; } while(0) +/* + * Hack inherited from BSD, the intent is to set the FPU inexact + * flag in an efficient way. The flag is IEEE specific. See + * https://github.com/freebsd/freebsd/blob/4c6378299/lib/msun/src/catrig.c#L42 + */ +#define raise_inexact() do { \ + volatile npy_float NPY_UNUSED(junk) = 1 + tiny; \ +} while (0) -static __COMP_NPY_UNUSED npy_float tiny = 3.9443045e-31f; +static const volatile npy_float tiny = 3.9443045e-31f; /**begin repeat -- cgit v1.2.1