Mercurial > hg > octave-jordi > gnulib-hg
changeset 16506:fa4e9b981eb4
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>.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Tue, 28 Feb 2012 11:50:03 +0100 |
parents | 8596c65586a9 |
children | a7ef52eff5fb |
files | 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 |
diffstat | 16 files changed, 106 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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'.
--- a/lib/ceil.c +++ b/lib/ceil.c @@ -54,6 +54,12 @@ # 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.
--- a/lib/floor.c +++ b/lib/floor.c @@ -42,6 +42,12 @@ # 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.
--- a/lib/fma.c +++ b/lib/fma.c @@ -66,6 +66,12 @@ #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:
--- a/lib/integer_length.c +++ b/lib/integer_length.c @@ -25,6 +25,12 @@ #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
--- a/lib/rint.c +++ b/lib/rint.c @@ -53,6 +53,12 @@ # 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) {
--- a/lib/round.c +++ b/lib/round.c @@ -64,6 +64,12 @@ # 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. */
--- a/lib/trunc.c +++ b/lib/trunc.c @@ -54,6 +54,12 @@ # 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.
--- a/m4/round.m4 +++ b/m4/round.m4 @@ -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_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. */
--- a/m4/roundf.m4 +++ b/m4/roundf.m4 @@ -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_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. */
--- a/tests/test-ceil2.c +++ b/tests/test-ceil2.c @@ -32,6 +32,12 @@ #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. */
--- a/tests/test-ceilf2.c +++ b/tests/test-ceilf2.c @@ -32,6 +32,12 @@ #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. */
--- a/tests/test-floor2.c +++ b/tests/test-floor2.c @@ -31,6 +31,12 @@ #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. */
--- a/tests/test-floorf2.c +++ b/tests/test-floorf2.c @@ -31,6 +31,12 @@ #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. */
--- a/tests/test-trunc2.c +++ b/tests/test-trunc2.c @@ -32,6 +32,12 @@ #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. */
--- a/tests/test-truncf2.c +++ b/tests/test-truncf2.c @@ -32,6 +32,12 @@ #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. */