Avoid compilation errors with MSVC option -fp:strict.
authorBruno Haible <bruno@clisp.org>
Tue, 28 Feb 2012 10:50:03 +0000 (11:50 +0100)
committerBruno Haible <bruno@clisp.org>
Tue, 28 Feb 2012 10:50:03 +0000 (11:50 +0100)
* lib/floor.c: Use MSVC specific pragma fenv_access.
* lib/ceil.c: Likewise.
* lib/trunc.c: Likewise.
* lib/round.c: Likewise.
* lib/rint.c: Likewise.
* lib/fma.c: Likewise.
* lib/integer_length.c: Likewise.
* m4/round.m4 (gl_FUNC_ROUND): Likewise.
* m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise.
* tests/test-floor2.c: Likewise.
* tests/test-floorf2.c: Likewise.
* tests/test-ceil2.c: Likewise.
* tests/test-ceilf2.c: Likewise.
* tests/test-trunc2.c: Likewise.
* tests/test-truncf2.c: Likewise.
Reported by Michael Goffioul <michael.goffioul@gmail.com>.

16 files changed:
ChangeLog
lib/ceil.c
lib/floor.c
lib/fma.c
lib/integer_length.c
lib/rint.c
lib/round.c
lib/trunc.c
m4/round.m4
m4/roundf.m4
tests/test-ceil2.c
tests/test-ceilf2.c
tests/test-floor2.c
tests/test-floorf2.c
tests/test-trunc2.c
tests/test-truncf2.c

index 686f0a6..9e2c0cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2012-02-28  Bruno Haible  <bruno@clisp.org>
+
+       Avoid compilation errors with MSVC option -fp:strict.
+       * lib/floor.c: Use MSVC specific pragma fenv_access.
+       * lib/ceil.c: Likewise.
+       * lib/trunc.c: Likewise.
+       * lib/round.c: Likewise.
+       * lib/rint.c: Likewise.
+       * lib/fma.c: Likewise.
+       * lib/integer_length.c: Likewise.
+       * m4/round.m4 (gl_FUNC_ROUND): Likewise.
+       * m4/roundf.m4 (gl_FUNC_ROUNDF): Likewise.
+       * tests/test-floor2.c: Likewise.
+       * tests/test-floorf2.c: Likewise.
+       * tests/test-ceil2.c: Likewise.
+       * tests/test-ceilf2.c: Likewise.
+       * tests/test-trunc2.c: Likewise.
+       * tests/test-truncf2.c: Likewise.
+       Reported by Michael Goffioul <michael.goffioul@gmail.com>.
+
 2012-02-27  Bruno Haible  <bruno@clisp.org>
 
        Tests for module 'sqrtl-ieee'.
index 7a05ace..c3d26c1 100644 (file)
 # define MINUS_ZERO L_(-0.0)
 #endif
 
+/* 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
+
 /* 2^(MANT_DIG-1).  */
 static const DOUBLE TWO_MANT_DIG =
   /* Assume MANT_DIG <= 5 * 31.
index 86ae3ac..9f4c951 100644 (file)
 # define L_(literal) literal##f
 #endif
 
+/* 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
+
 /* 2^(MANT_DIG-1).  */
 static const DOUBLE TWO_MANT_DIG =
   /* Assume MANT_DIG <= 5 * 31.
index b37f7eb..9882e88 100644 (file)
--- a/lib/fma.c
+++ b/lib/fma.c
 #undef MIN
 #define MIN(a,b) ((a) < (b) ? (a) : (b))
 
+/* 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
+
 /* It is possible to write an implementation of fused multiply-add with
    floating-point operations alone.  See
      Sylvie Boldo, Guillaume Melquiond:
index 0719ff3..d89df69 100644 (file)
 
 #include "float+.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
+
 #define NBITS (sizeof (unsigned int) * CHAR_BIT)
 
 int
index 822e671..6da390a 100644 (file)
 # define MINUS_ZERO L_(-0.0)
 #endif
 
+/* 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
+
 DOUBLE
 RINT (DOUBLE x)
 {
index 0933484..b52bd35 100644 (file)
 # define MINUS_ZERO L_(-0.0)
 #endif
 
+/* 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
+
 /* If we're being included from test-round2[f].c, it already defined names for
    our round implementations.  Otherwise, pick the preferred implementation for
    this machine. */
index 0049cdd..27c881c 100644 (file)
 # define MINUS_ZERO L_(-0.0)
 #endif
 
+/* 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
+
 /* 2^(MANT_DIG-1).  */
 static const DOUBLE TWO_MANT_DIG =
   /* Assume MANT_DIG <= 5 * 31.
index c97f435..e2acf93 100644 (file)
@@ -1,4 +1,4 @@
-# round.m4 serial 13
+# round.m4 serial 14
 dnl Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -25,6 +25,9 @@ AC_DEFUN([gl_FUNC_ROUND],
           AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <float.h>
 #include <math.h>
+#ifdef _MSC_VER
+# pragma fenv_access (off)
+#endif
 int main()
 {
   /* 2^DBL_MANT_DIG.  */
index ffacba7..58f4287 100644 (file)
@@ -1,4 +1,4 @@
-# roundf.m4 serial 14
+# roundf.m4 serial 15
 dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -25,6 +25,9 @@ AC_DEFUN([gl_FUNC_ROUNDF],
           AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <float.h>
 #include <math.h>
+#ifdef _MSC_VER
+# pragma fenv_access (off)
+#endif
 int main()
 {
   /* 2^FLT_MANT_DIG.  */
index 31baeb8..bff6730 100644 (file)
 #include "minus-zero.h"
 #include "macros.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
+
 
 /* The reference implementation, taken from lib/ceil.c.  */
 
index 69fdb67..189de0f 100644 (file)
 #include "minus-zero.h"
 #include "macros.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
+
 
 /* The reference implementation, taken from lib/ceil.c.  */
 
index 292fbc5..19e5ab1 100644 (file)
 #include "isnand-nolibm.h"
 #include "macros.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
+
 
 /* The reference implementation, taken from lib/floor.c.  */
 
index 1413778..beaf70b 100644 (file)
 #include "isnanf-nolibm.h"
 #include "macros.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
+
 
 /* The reference implementation, taken from lib/floor.c.  */
 
index 3b15799..61f88b5 100644 (file)
 #include "minus-zero.h"
 #include "macros.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
+
 
 /* The reference implementation, taken from lib/trunc.c.  */
 
index 96ba9a1..3b67d75 100644 (file)
 #include "minus-zero.h"
 #include "macros.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
+
 
 /* The reference implementation, taken from lib/trunc.c.  */