about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-08-24 10:33:57 -0700
committerUlrich Drepper <drepper@redhat.com>2009-08-24 10:33:57 -0700
commit7b943af6cf2bfd4b94be271877a10128c32d03da (patch)
tree61e48476a7cfc36f79a21c828aebda8157d606ef
parentef72d5f1b95fe91b032de0ad1ee777d7cf4fb49f (diff)
downloadglibc-7b943af6cf2bfd4b94be271877a10128c32d03da.tar.gz
glibc-7b943af6cf2bfd4b94be271877a10128c32d03da.tar.xz
glibc-7b943af6cf2bfd4b94be271877a10128c32d03da.zip
Define math_errhandling is possible.
-rw-r--r--ChangeLog4
-rw-r--r--math/math.h11
-rw-r--r--sysdeps/i386/fpu/bits/mathinline.h6
3 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 45ff958cb8..b367ab0782 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-08-24  Ulrich Drepper  <drepper@redhat.com>
 
+	* math/math.h: Define math_errhandling of __FAST_MATH__ is not defined.
+	* sysdeps/i386/fpu/bits/mathinline.h: Undefine math_errhandling if we
+	are using the inline optimizations.
+
 	* sysdeps/x86_64/fpu/bits/mathinline.h (__signbit): Optimize.
 	(__signbitf): Likewise.
 
diff --git a/math/math.h b/math/math.h
index c50b2e7b07..4e65678b8d 100644
--- a/math/math.h
+++ b/math/math.h
@@ -1,5 +1,5 @@
 /* Declarations for math functions.
-   Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006
+   Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -101,7 +101,7 @@ __BEGIN_DECLS
      && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
 #  ifdef __LDBL_COMPAT
 
-#   ifdef __USE_ISOC99 
+#   ifdef __USE_ISOC99
 extern float __nldbl_nexttowardf (float __x, long double __y)
 				  __THROW __attribute__ ((__const__));
 #    ifdef __REDIRECT_NTH
@@ -277,6 +277,13 @@ enum
 # define MATH_ERRNO	1	/* errno set by math functions.  */
 # define MATH_ERREXCEPT	2	/* Exceptions raised by math functions.  */
 
+/* By default all functions support both errno and exception handling.
+   In gcc's fast math mode and if inline functions are defined this
+   might not be true.  */
+# ifndef __FAST_MATH__
+#  define math_errhandling	(MATH_ERRNO | MATH_ERREXCEPT)
+# endif
+
 #endif /* Use ISO C99.  */
 
 #ifdef	__USE_MISC
diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h
index a786cc69cd..8005997520 100644
--- a/sysdeps/i386/fpu/bits/mathinline.h
+++ b/sysdeps/i386/fpu/bits/mathinline.h
@@ -1,5 +1,5 @@
 /* Inline math functions for i387.
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2003,2004,2006,2007
+   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2003,2004,2006,2007,2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by John C. Bowman <bowman@math.ualberta.ca>, 1995.
@@ -153,6 +153,10 @@ __NTH (__signbitl (long double __x))
 #if ((!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) \
      && defined __OPTIMIZE__)
 
+/* The inline functions do not set errno or raise necessarily the
+   correct exceptions.  */
+# undef math_errhandling
+
 /* A macro to define float, double, and long double versions of various
    math functions for the ix87 FPU.  FUNC is the function name (which will
    be suffixed with f and l for the float and long double version,