Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1 | // -*- C++ -*- |
Louis Dionne | eb8650a | 2021-11-17 21:25:01 | [diff] [blame] | 2 | //===----------------------------------------------------------------------===// |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 3 | // |
Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 | [diff] [blame] | 4 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 | // See https://llvm.org/LICENSE.txt for license information. |
| 6 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_CFENV |
| 11 | #define _LIBCPP_CFENV |
| 12 | |
| 13 | /* |
| 14 | cfenv synopsis |
| 15 | |
| 16 | This entire header is C99 / C++0X |
| 17 | |
| 18 | Macros: |
| 19 | |
| 20 | FE_DIVBYZERO |
| 21 | FE_INEXACT |
| 22 | FE_INVALID |
| 23 | FE_OVERFLOW |
| 24 | FE_UNDERFLOW |
| 25 | FE_ALL_EXCEPT |
| 26 | FE_DOWNWARD |
| 27 | FE_TONEAREST |
| 28 | FE_TOWARDZERO |
| 29 | FE_UPWARD |
| 30 | FE_DFL_ENV |
| 31 | |
| 32 | namespace std |
| 33 | { |
| 34 | |
| 35 | Types: |
| 36 | |
| 37 | fenv_t |
| 38 | fexcept_t |
| 39 | |
| 40 | int feclearexcept(int excepts); |
| 41 | int fegetexceptflag(fexcept_t* flagp, int excepts); |
| 42 | int feraiseexcept(int excepts); |
| 43 | int fesetexceptflag(const fexcept_t* flagp, int excepts); |
| 44 | int fetestexcept(int excepts); |
| 45 | int fegetround(); |
| 46 | int fesetround(int round); |
| 47 | int fegetenv(fenv_t* envp); |
| 48 | int feholdexcept(fenv_t* envp); |
| 49 | int fesetenv(const fenv_t* envp); |
| 50 | int feupdateenv(const fenv_t* envp); |
| 51 | |
| 52 | } // std |
| 53 | */ |
| 54 | |
Louis Dionne | 385cc25 | 2022-03-25 16:55:36 | [diff] [blame] | 55 | #include <__assert> // all public C++ headers provide the assertion handler |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 56 | #include <__config> |
Louis Dionne | 8cedff1 | 2022-08-08 21:03:56 | [diff] [blame^] | 57 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 58 | #include <fenv.h> |
| 59 | |
Louis Dionne | 8cedff1 | 2022-08-08 21:03:56 | [diff] [blame^] | 60 | #ifndef _LIBCPP_FENV_H |
| 61 | # error <cfenv> tried including <fenv.h> but didn't find libc++'s <fenv.h> header. \ |
| 62 | This usually means that your header search paths are not configured properly. \ |
| 63 | The header search paths should contain the C++ Standard Library headers before \ |
| 64 | any C Standard Library, and you are probably using compiler flags that make that \ |
| 65 | not be the case. |
| 66 | #endif |
| 67 | |
Howard Hinnant | 073458b | 2011-10-17 20:05:10 | [diff] [blame] | 68 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Arthur O'Dwyer | fa6b9e4 | 2022-02-02 01:16:40 | [diff] [blame] | 69 | # pragma GCC system_header |
Howard Hinnant | 073458b | 2011-10-17 20:05:10 | [diff] [blame] | 70 | #endif |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 71 | |
| 72 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 73 | |
Louis Dionne | a9c9183 | 2021-06-02 14:41:37 | [diff] [blame] | 74 | using ::fenv_t _LIBCPP_USING_IF_EXISTS; |
| 75 | using ::fexcept_t _LIBCPP_USING_IF_EXISTS; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 76 | |
Louis Dionne | a9c9183 | 2021-06-02 14:41:37 | [diff] [blame] | 77 | using ::feclearexcept _LIBCPP_USING_IF_EXISTS; |
| 78 | using ::fegetexceptflag _LIBCPP_USING_IF_EXISTS; |
| 79 | using ::feraiseexcept _LIBCPP_USING_IF_EXISTS; |
| 80 | using ::fesetexceptflag _LIBCPP_USING_IF_EXISTS; |
| 81 | using ::fetestexcept _LIBCPP_USING_IF_EXISTS; |
| 82 | using ::fegetround _LIBCPP_USING_IF_EXISTS; |
| 83 | using ::fesetround _LIBCPP_USING_IF_EXISTS; |
| 84 | using ::fegetenv _LIBCPP_USING_IF_EXISTS; |
| 85 | using ::feholdexcept _LIBCPP_USING_IF_EXISTS; |
| 86 | using ::fesetenv _LIBCPP_USING_IF_EXISTS; |
| 87 | using ::feupdateenv _LIBCPP_USING_IF_EXISTS; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 88 | |
| 89 | _LIBCPP_END_NAMESPACE_STD |
| 90 | |
Louis Dionne | 4cd6ca1 | 2021-04-20 16:03:32 | [diff] [blame] | 91 | #endif // _LIBCPP_CFENV |