summaryrefslogtreecommitdiff
path: root/boost/detail/fenv.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/detail/fenv.hpp')
-rw-r--r--boost/detail/fenv.hpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/boost/detail/fenv.hpp b/boost/detail/fenv.hpp
index f048706416..b268f5c1cc 100644
--- a/boost/detail/fenv.hpp
+++ b/boost/detail/fenv.hpp
@@ -14,7 +14,7 @@
#if !defined(BOOST_DETAIL_FENV_HPP)
#define BOOST_DETAIL_FENV_HPP
-/* If we're using clang + glibc, we have to get hacky.
+/* If we're using clang + glibc, we have to get hacky.
* See http://llvm.org/bugs/show_bug.cgi?id=6907 */
#if defined(__clang__) && (__clang_major__ < 3) && \
defined(__GNU_LIBRARY__) && /* up to version 5 */ \
@@ -61,14 +61,41 @@
using ::feholdexcept;
} }
+#elif defined(__MINGW32__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408
+
+ // MinGW (32-bit) has a bug in mingw32/bits/c++config.h, it does not define _GLIBCXX_HAVE_FENV_H,
+ // which prevents the C fenv.h header contents to be included in the C++ wrapper header fenv.h. This is at least
+ // the case with gcc 4.8.1 packages tested so far, up to 4.8.1-4. Note that there is no issue with
+ // MinGW-w64.
+ // To work around the bug we avoid including the C++ wrapper header and include the C header directly
+ // and import all relevant symbols into std:: ourselves.
+
+ #include <../include/fenv.h>
+
+ namespace std {
+ 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(__SUNPRO_CC) /* lol suncc */
#include <stdio.h>
#endif
-
+
#include <fenv.h>
#endif
#endif /* BOOST_DETAIL_FENV_HPP */
-