changeset 16693:55c4c6aa19f4

Avoid compilation errors with MSVC option -fp:strict. * lib/cbrt.c: Use MSVC specific pragma fenv_access. * lib/cbrtf.c: Likewise. Reported by Michael Goffioul <michael.goffioul@gmail.com>.
author Bruno Haible <bruno@clisp.org>
date Tue, 13 Mar 2012 23:57:11 +0100
parents fec1c580b58c
children 37aa30e20e53
files ChangeLog lib/cbrt.c lib/cbrtf.c
diffstat 3 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-03-13  Bruno Haible  <bruno@clisp.org>
+
+	Avoid compilation errors with MSVC option -fp:strict.
+	* lib/cbrt.c: Use MSVC specific pragma fenv_access.
+	* lib/cbrtf.c: Likewise.
+	Reported by Michael Goffioul <michael.goffioul@gmail.com>.
+
 2012-03-12  Bruno Haible  <bruno@clisp.org>
 
 	uninorm: Don't crash in out-of-memory conditions.
--- a/lib/cbrt.c
+++ b/lib/cbrt.c
@@ -22,6 +22,12 @@
 /* Specification.  */
 #include <math.h>
 
+/* MSVC with option -fp:strict refuses to compile constant initializers that
+   contain floating-point operations.  Pacify this compiler.  */
+#ifdef _MSC_VER
+# pragma fenv_access (off)
+#endif
+
 /* Code based on glibc/sysdeps/ieee754/dbl-64/s_cbrt.c.  */
 
 #define CBRT2 1.2599210498948731648             /* 2^(1/3) */
--- a/lib/cbrtf.c
+++ b/lib/cbrtf.c
@@ -22,6 +22,12 @@
 /* Specification.  */
 #include <math.h>
 
+/* MSVC with option -fp:strict refuses to compile constant initializers that
+   contain floating-point operations.  Pacify this compiler.  */
+#ifdef _MSC_VER
+# pragma fenv_access (off)
+#endif
+
 /* Code based on glibc/sysdeps/ieee754/flt-32/s_cbrtf.c.  */
 
 #define CBRT2 1.2599210498948731648             /* 2^(1/3) */