|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r66458 - in trunk/boost: detail math/tools test
From: admin_at_[hidden]
Date: 2010-11-08 12:10:28
Author: wash
Date: 2010-11-08 12:10:25 EST (Mon, 08 Nov 2010)
New Revision: 66458
URL: http://svn.boost.org/trac/boost/changeset/66458
Log:
Added a detail header for fenv. Please use boost/detail/fenv.hpp in Boost code
to avoid problems with Clang/glibc.
Added:
trunk/boost/detail/fenv.hpp (contents, props changed)
Text files modified:
trunk/boost/math/tools/config.hpp | 4 ++--
trunk/boost/test/execution_monitor.hpp | 9 +++------
2 files changed, 5 insertions(+), 8 deletions(-)
Added: trunk/boost/detail/fenv.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/detail/fenv.hpp 2010-11-08 12:10:25 EST (Mon, 08 Nov 2010)
@@ -0,0 +1,71 @@
+/*=============================================================================
+ Copyright (c) 2010 Bryce Lelbach
+
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#if !defined(BOOST_DETAIL_FENV_HPP)
+#define BOOST_DETAIL_FENV_HPP
+
+/* If we're using clang + glibc, we have to get hacky.
+ * See http://llvm.org/bugs/show_bug.cgi?id=6907 */
+#if defined(__clang__) && \
+ defined(__GNU_LIBRARY__) && /* up to version 5 */ \
+ defined(__GLIBC__) /* version 6 + */
+
+ #define _FENV_H
+
+ #include <features.h>
+ #include <bits/fenv.h>
+
+ extern "C" {
+ extern int fegetexceptflag (fexcept_t*, int) __THROW;
+ extern int fesetexceptflag (__const fexcept_t*, int) __THROW;
+ extern int feclearexcept (int) __THROW;
+ extern int feraiseexcept (int) __THROW;
+ extern int fetestexcept (int) __THROW;
+ extern int fegetround (void) __THROW;
+ extern int fesetround (int) __THROW;
+ extern int fegetenv (fenv_t*) __THROW;
+ extern int fesetenv (__const fenv_t*) __THROW;
+ extern int feupdateenv (__const fenv_t*) __THROW;
+ extern int feholdexcept (fenv_t*) __THROW;
+
+ #ifdef __USE_GNU
+ extern int feenableexcept (int) __THROW;
+ extern int fedisableexcept (int) __THROW;
+ extern int fegetexcept (void) __THROW;
+ #endif
+ }
+
+ namespace std { namespace tr1 {
+ using ::fenv_t;
+ using ::fexcept_t;
+ using ::fegetexceptflag;
+ using ::fesetexceptflag;
+ using ::feclearexcept;
+ using ::feraiseexcept;
+ using ::fetestexcept;
+ using ::fegetround;
+ using ::fesetround;
+ using ::fegetenv;
+ using ::fesetenv;
+ using ::feupdateenv;
+ using ::feholdexcept;
+ } }
+
+#else /* if we're not using GNU's C stdlib, fenv.h should work with clang */
+
+ #if defined(__CYGWIN__) /* lol cygwin */
+ #warn The <fenv.h> header is not available for this platform
+ #elif defined(__SUNPRO_CC) /* lol suncc */
+ #include <stdio.h>
+ #include <fenv.h>
+ #else
+ #include <fenv.h>
+ #endif
+
+#endif
+
+#endif /* BOOST_DETAIL_FENV_HPP */
Modified: trunk/boost/math/tools/config.hpp
==============================================================================
--- trunk/boost/math/tools/config.hpp (original)
+++ trunk/boost/math/tools/config.hpp 2010-11-08 12:10:25 EST (Mon, 08 Nov 2010)
@@ -255,9 +255,9 @@
} // namespace tools
}} // namespace boost namespace math
-#if (defined(__linux__) && !defined(__UCLIBC__) && !defined(__clang__)) || defined(__QNX__) || defined(__IBMCPP__)
+#if (defined(__linux__) && !defined(__UCLIBC__)) || defined(__QNX__) || defined(__IBMCPP__)
- #include <fenv.h>
+ #include <boost/detail/fenv.hpp>
namespace boost{ namespace math{
namespace detail
Modified: trunk/boost/test/execution_monitor.hpp
==============================================================================
--- trunk/boost/test/execution_monitor.hpp (original)
+++ trunk/boost/test/execution_monitor.hpp 2010-11-08 12:10:25 EST (Mon, 08 Nov 2010)
@@ -77,12 +77,9 @@
#else // based on ISO C standard
-# if !defined(__CYGWIN__) && !defined(BOOST_CLANG)
-# if defined(__SUNPRO_CC)
-# include <stdio.h>
-# endif
-# include <fenv.h>
-# endif
+#if !defined(__CYGWIN__)
+ #include <boost/detail/fenv.hpp>
+#endif
#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk