summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-01-31 13:12:50 -0700
committerCharles Harris <charlesr.harris@gmail.com>2018-02-02 20:26:22 -0700
commit8ab4c010dc982aafce0b8048f72ede0252c18fb0 (patch)
treecb514eb80ee351f3ce3d0ed894f10f5bf49fb20e /numpy/core/src
parent1706056ab7e3bc321f3bc6f605fdbd6a55fb3c42 (diff)
downloadnumpy-8ab4c010dc982aafce0b8048f72ede0252c18fb0.tar.gz
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
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/npymath/npy_math_complex.c.src12
1 files changed, 9 insertions, 3 deletions
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 <numpy/utils.h>
-
-#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