Commit 60e3ab13 authored by Bruno Haible's avatar Bruno Haible

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.
parent 6314401e
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'.
# 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 @@ AC_DEFUN([gl_MATH_H_DEFAULTS],
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])
])
......@@ -10,6 +10,7 @@ configure.ac:
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
......
......@@ -13,6 +13,7 @@ configure.ac:
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
......
......@@ -12,6 +12,7 @@ configure.ac:
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
......
......@@ -11,6 +11,7 @@ float
configure.ac:
gl_LONG_DOUBLE_EXPONENT_LOCATION
AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
Makefile.am:
TESTS += test-isnanl-nolibm
......
......@@ -11,6 +11,7 @@ float
configure.ac:
gl_LONG_DOUBLE_EXPONENT_LOCATION
AC_REQUIRE([gl_LONG_DOUBLE_VS_DOUBLE])
Makefile.am:
TESTS += test-isnanl
......
......@@ -166,7 +166,7 @@ test_isfinitel ()
}
#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
......
......@@ -172,7 +172,7 @@ test_isinfl ()
}
#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
......
......@@ -153,7 +153,7 @@ test_long_double (void)
}
#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
......
......@@ -65,7 +65,7 @@ main ()
}
#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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment