Mercurial > hg > octave-lyh > gnulib-hg
changeset 15901:5711969eba55
isfinite, isinf, isnan tests: Avoid syntax error on MSVC 9.
* m4/math_h.m4 (gl_LONG_DOUBLE_VS_DOUBLE): New macro.
* modules/isfinite-tests (configure.ac): Require
gl_LONG_DOUBLE_VS_DOUBLE.
* modules/isinf-tests (configure.ac): Likewise.
* modules/isnan-tests (configure.ac): Likewise.
* modules/isnanl-tests (configure.ac): Likewise.
* modules/isnanl-nolibm-tests (configure.ac): Likewise.
* tests/test-isfinite.c (test_isfinitel): Avoid 80-bit long double
tests on platforms where 'long double' is the same as 'double'.
* tests/test-isinf.c (test_isinfl): Likewise.
* tests/test-isnan.c (test_long_double): Likewise.
* tests/test-isnanl.h (main): Likewise.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 09 Oct 2011 11:26:58 +0200 |
parents | ee6ece33a21b |
children | 5079d0860767 |
files | ChangeLog m4/math_h.m4 modules/isfinite-tests modules/isinf-tests modules/isnan-tests modules/isnanl-nolibm-tests modules/isnanl-tests tests/test-isfinite.c tests/test-isinf.c tests/test-isnan.c tests/test-isnanl.h |
diffstat | 11 files changed, 57 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2011-10-09 Bruno Haible <bruno@clisp.org> + + isfinite, isinf, isnan tests: Avoid syntax error on MSVC 9. + * m4/math_h.m4 (gl_LONG_DOUBLE_VS_DOUBLE): New macro. + * modules/isfinite-tests (configure.ac): Require + gl_LONG_DOUBLE_VS_DOUBLE. + * modules/isinf-tests (configure.ac): Likewise. + * modules/isnan-tests (configure.ac): Likewise. + * modules/isnanl-tests (configure.ac): Likewise. + * modules/isnanl-nolibm-tests (configure.ac): Likewise. + * tests/test-isfinite.c (test_isfinitel): Avoid 80-bit long double + tests on platforms where 'long double' is the same as 'double'. + * tests/test-isinf.c (test_isinfl): Likewise. + * tests/test-isnan.c (test_long_double): Likewise. + * tests/test-isnanl.h (main): Likewise. + 2011-10-08 Bruno Haible <bruno@clisp.org> Tests for module 'tanhf'.
--- a/m4/math_h.m4 +++ b/m4/math_h.m4 @@ -1,4 +1,4 @@ -# math_h.m4 serial 46 +# math_h.m4 serial 47 dnl Copyright (C) 2007-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -188,3 +188,34 @@ REPLACE_TRUNCF=0; AC_SUBST([REPLACE_TRUNCF]) REPLACE_TRUNCL=0; AC_SUBST([REPLACE_TRUNCL]) ]) + +# gl_LONG_DOUBLE_VS_DOUBLE +# determines whether 'long double' and 'double' have the same representation. +# Sets variable HAVE_SAME_LONG_DOUBLE_AS_DOUBLE to 0 or 1, and defines +# HAVE_SAME_LONG_DOUBLE_AS_DOUBLE accordingly. +# The currently known platforms where this is the case are: +# Linux/HPPA, Minix 3.1.8, AIX 5, AIX 6 and 7 with xlc, MSVC 9. +AC_DEFUN([gl_LONG_DOUBLE_VS_DOUBLE], +[ + AC_CACHE_CHECK([whether long double and double are the same], + [gl_cv_long_double_equals_double], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <float.h>]], + [[typedef int check[sizeof (long double) == sizeof (double) + && LDBL_MANT_DIG == DBL_MANT_DIG + && LDBL_MAX_EXP == DBL_MAX_EXP + && LDBL_MIN_EXP == DBL_MIN_EXP + ? 1 : -1]; + ]])], + [gl_cv_long_double_equals_double=yes], + [gl_cv_long_double_equals_double=no]) + ]) + if test $gl_cv_long_double_equals_double = yes; then + AC_DEFINE([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE], [1], + [Define to 1 if 'long double' and 'double' have the same representation.]) + HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=1 + else + HAVE_SAME_LONG_DOUBLE_AS_DOUBLE=0 + fi + AC_SUBST([HAVE_SAME_LONG_DOUBLE_AS_DOUBLE]) +])
--- a/modules/isfinite-tests +++ b/modules/isfinite-tests @@ -10,6 +10,7 @@ gl_FLOAT_EXPONENT_LOCATION gl_DOUBLE_EXPONENT_LOCATION gl_LONG_DOUBLE_EXPONENT_LOCATION +AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) Makefile.am: TESTS += test-isfinite
--- a/modules/isinf-tests +++ b/modules/isinf-tests @@ -13,6 +13,7 @@ gl_FLOAT_EXPONENT_LOCATION gl_DOUBLE_EXPONENT_LOCATION gl_LONG_DOUBLE_EXPONENT_LOCATION +AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) Makefile.am: TESTS += test-isinf
--- a/modules/isnan-tests +++ b/modules/isnan-tests @@ -12,6 +12,7 @@ gl_FLOAT_EXPONENT_LOCATION gl_DOUBLE_EXPONENT_LOCATION gl_LONG_DOUBLE_EXPONENT_LOCATION +AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) Makefile.am: TESTS += test-isnan
--- a/modules/isnanl-nolibm-tests +++ b/modules/isnanl-nolibm-tests @@ -11,6 +11,7 @@ configure.ac: gl_LONG_DOUBLE_EXPONENT_LOCATION +AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) Makefile.am: TESTS += test-isnanl-nolibm
--- a/modules/isnanl-tests +++ b/modules/isnanl-tests @@ -11,6 +11,7 @@ configure.ac: gl_LONG_DOUBLE_EXPONENT_LOCATION +AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE]) Makefile.am: TESTS += test-isnanl
--- a/tests/test-isfinite.c +++ b/tests/test-isfinite.c @@ -166,7 +166,7 @@ } #endif -#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ # ifdef WORDS_BIGENDIAN
--- a/tests/test-isinf.c +++ b/tests/test-isinf.c @@ -172,7 +172,7 @@ } #endif -#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ # ifdef WORDS_BIGENDIAN
--- a/tests/test-isnan.c +++ b/tests/test-isnan.c @@ -153,7 +153,7 @@ } #endif -#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ # ifdef WORDS_BIGENDIAN
--- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -65,7 +65,7 @@ } #endif -#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) +#if ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE /* Representation of an 80-bit 'long double' as an initializer for a sequence of 'unsigned int' words. */ # ifdef WORDS_BIGENDIAN