Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame^] | 1 | /*============================================================================= |
| 2 | Copyright (c) 2010 Bryce Lelbach |
| 3 | |
| 4 | Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 5 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | =============================================================================*/ |
| 7 | |
| 8 | #include <ndnboost/config.hpp> |
| 9 | |
| 10 | #if defined(BOOST_NO_FENV_H) |
| 11 | #error This platform does not have a floating point environment |
| 12 | #endif |
| 13 | |
| 14 | #if !defined(BOOST_DETAIL_FENV_HPP) |
| 15 | #define BOOST_DETAIL_FENV_HPP |
| 16 | |
| 17 | /* If we're using clang + glibc, we have to get hacky. |
| 18 | * See http://llvm.org/bugs/show_bug.cgi?id=6907 */ |
| 19 | #if defined(__clang__) && (__clang_major__ < 3) && \ |
| 20 | defined(__GNU_LIBRARY__) && /* up to version 5 */ \ |
| 21 | defined(__GLIBC__) && /* version 6 + */ \ |
| 22 | !defined(_FENV_H) |
| 23 | #define _FENV_H |
| 24 | |
| 25 | #include <features.h> |
| 26 | #include <bits/fenv.h> |
| 27 | |
| 28 | extern "C" { |
| 29 | extern int fegetexceptflag (fexcept_t*, int) __THROW; |
| 30 | extern int fesetexceptflag (__const fexcept_t*, int) __THROW; |
| 31 | extern int feclearexcept (int) __THROW; |
| 32 | extern int feraiseexcept (int) __THROW; |
| 33 | extern int fetestexcept (int) __THROW; |
| 34 | extern int fegetround (void) __THROW; |
| 35 | extern int fesetround (int) __THROW; |
| 36 | extern int fegetenv (fenv_t*) __THROW; |
| 37 | extern int fesetenv (__const fenv_t*) __THROW; |
| 38 | extern int feupdateenv (__const fenv_t*) __THROW; |
| 39 | extern int feholdexcept (fenv_t*) __THROW; |
| 40 | |
| 41 | #ifdef __USE_GNU |
| 42 | extern int feenableexcept (int) __THROW; |
| 43 | extern int fedisableexcept (int) __THROW; |
| 44 | extern int fegetexcept (void) __THROW; |
| 45 | #endif |
| 46 | } |
| 47 | |
| 48 | namespace std { namespace tr1 { |
| 49 | using ::fenv_t; |
| 50 | using ::fexcept_t; |
| 51 | using ::fegetexceptflag; |
| 52 | using ::fesetexceptflag; |
| 53 | using ::feclearexcept; |
| 54 | using ::feraiseexcept; |
| 55 | using ::fetestexcept; |
| 56 | using ::fegetround; |
| 57 | using ::fesetround; |
| 58 | using ::fegetenv; |
| 59 | using ::fesetenv; |
| 60 | using ::feupdateenv; |
| 61 | using ::feholdexcept; |
| 62 | } } |
| 63 | |
| 64 | #else /* if we're not using GNU's C stdlib, fenv.h should work with clang */ |
| 65 | #if defined(__SUNPRO_CC) /* lol suncc */ |
| 66 | #include <stdio.h> |
| 67 | #endif |
| 68 | |
| 69 | #include <fenv.h> |
| 70 | |
| 71 | #endif |
| 72 | |
| 73 | #endif /* BOOST_DETAIL_FENV_HPP */ |
| 74 | |