Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:35:27

0001 /*=============================================================================
0002     Copyright (c) 2010      Bryce Lelbach
0003 
0004     Distributed under the Boost Software License, Version 1.0. (See accompanying
0005     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 =============================================================================*/
0007 
0008 #include <boost/config.hpp>
0009 
0010 #if defined(BOOST_NO_FENV_H)
0011   #error This platform does not have a floating point environment
0012 #endif
0013 
0014 #if !defined(BOOST_DETAIL_FENV_HPP)
0015 #define BOOST_DETAIL_FENV_HPP
0016 
0017 /* If we're using clang + glibc, we have to get hacky.
0018  * See http://llvm.org/bugs/show_bug.cgi?id=6907 */
0019 #if defined(__clang__)       &&  (__clang_major__ < 3) &&    \
0020     defined(__GNU_LIBRARY__) && /* up to version 5 */ \
0021     defined(__GLIBC__) &&         /* version 6 + */ \
0022     !defined(_FENV_H)
0023   #define _FENV_H
0024 
0025   #include <features.h>
0026   #include <bits/fenv.h>
0027 
0028   extern "C" {
0029     extern int fegetexceptflag (fexcept_t*, int) __THROW;
0030     extern int fesetexceptflag (__const fexcept_t*, int) __THROW;
0031     extern int feclearexcept (int) __THROW;
0032     extern int feraiseexcept (int) __THROW;
0033     extern int fetestexcept (int) __THROW;
0034     extern int fegetround (void) __THROW;
0035     extern int fesetround (int) __THROW;
0036     extern int fegetenv (fenv_t*) __THROW;
0037     extern int fesetenv (__const fenv_t*) __THROW;
0038     extern int feupdateenv (__const fenv_t*) __THROW;
0039     extern int feholdexcept (fenv_t*) __THROW;
0040 
0041     #ifdef __USE_GNU
0042       extern int feenableexcept (int) __THROW;
0043       extern int fedisableexcept (int) __THROW;
0044       extern int fegetexcept (void) __THROW;
0045     #endif
0046   }
0047 
0048   namespace std { namespace tr1 {
0049     using ::fenv_t;
0050     using ::fexcept_t;
0051     using ::fegetexceptflag;
0052     using ::fesetexceptflag;
0053     using ::feclearexcept;
0054     using ::feraiseexcept;
0055     using ::fetestexcept;
0056     using ::fegetround;
0057     using ::fesetround;
0058     using ::fegetenv;
0059     using ::fesetenv;
0060     using ::feupdateenv;
0061     using ::feholdexcept;
0062   } }
0063 
0064 #elif defined(__MINGW32__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408
0065 
0066   // MinGW (32-bit) has a bug in mingw32/bits/c++config.h, it does not define _GLIBCXX_HAVE_FENV_H,
0067   // which prevents the C fenv.h header contents to be included in the C++ wrapper header fenv.h. This is at least
0068   // the case with gcc 4.8.1 packages tested so far, up to 4.8.1-4. Note that there is no issue with
0069   // MinGW-w64.
0070   // To work around the bug we avoid including the C++ wrapper header and include the C header directly
0071   // and import all relevant symbols into std:: ourselves.
0072 
0073   #include <../include/fenv.h>
0074 
0075   namespace std {
0076     using ::fenv_t;
0077     using ::fexcept_t;
0078     using ::fegetexceptflag;
0079     using ::fesetexceptflag;
0080     using ::feclearexcept;
0081     using ::feraiseexcept;
0082     using ::fetestexcept;
0083     using ::fegetround;
0084     using ::fesetround;
0085     using ::fegetenv;
0086     using ::fesetenv;
0087     using ::feupdateenv;
0088     using ::feholdexcept;
0089   }
0090 
0091 #else /* if we're not using GNU's C stdlib, fenv.h should work with clang */
0092 
0093   #if defined(__SUNPRO_CC) /* lol suncc */
0094     #include <stdio.h>
0095   #endif
0096 
0097   #include <fenv.h>
0098 
0099 #endif
0100 
0101 #endif /* BOOST_DETAIL_FENV_HPP */