| Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 +0000 | [diff] [blame^] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| Jonathan Roelofs | 2f63b50 | 2014-12-11 16:17:26 +0000 | [diff] [blame] | 8 | // |
| 9 | // UNSUPPORTED: newlib |
| Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 10 | |
| 11 | // <cfenv> |
| 12 | |
| 13 | #include <cfenv> |
| 14 | #include <type_traits> |
| 15 | |
| 16 | #ifndef FE_DIVBYZERO |
| 17 | #error FE_DIVBYZERO not defined |
| 18 | #endif |
| 19 | |
| 20 | #ifndef FE_INEXACT |
| 21 | #error FE_INEXACT not defined |
| 22 | #endif |
| 23 | |
| 24 | #ifndef FE_INVALID |
| 25 | #error FE_INVALID not defined |
| 26 | #endif |
| 27 | |
| 28 | #ifndef FE_OVERFLOW |
| 29 | #error FE_OVERFLOW not defined |
| 30 | #endif |
| 31 | |
| 32 | #ifndef FE_UNDERFLOW |
| 33 | #error FE_UNDERFLOW not defined |
| 34 | #endif |
| 35 | |
| 36 | #ifndef FE_ALL_EXCEPT |
| 37 | #error FE_ALL_EXCEPT not defined |
| 38 | #endif |
| 39 | |
| 40 | #ifndef FE_DOWNWARD |
| 41 | #error FE_DOWNWARD not defined |
| 42 | #endif |
| 43 | |
| 44 | #ifndef FE_TONEAREST |
| 45 | #error FE_TONEAREST not defined |
| 46 | #endif |
| 47 | |
| 48 | #ifndef FE_TOWARDZERO |
| 49 | #error FE_TOWARDZERO not defined |
| 50 | #endif |
| 51 | |
| 52 | #ifndef FE_UPWARD |
| 53 | #error FE_UPWARD not defined |
| 54 | #endif |
| 55 | |
| 56 | #ifndef FE_DFL_ENV |
| 57 | #error FE_DFL_ENV not defined |
| 58 | #endif |
| 59 | |
| 60 | int main() |
| 61 | { |
| Ed Schouten | 69722ab | 2015-03-15 18:36:31 +0000 | [diff] [blame] | 62 | std::fenv_t fenv; |
| 63 | std::fexcept_t fex; |
| Eric Fiselier | fb42f4c | 2016-05-02 19:15:48 +0000 | [diff] [blame] | 64 | ((void)fenv); // Prevent unused warning |
| 65 | ((void)fex); // Prevent unused warning |
| Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 66 | static_assert((std::is_same<decltype(std::feclearexcept(0)), int>::value), ""); |
| 67 | static_assert((std::is_same<decltype(std::fegetexceptflag(&fex, 0)), int>::value), ""); |
| 68 | static_assert((std::is_same<decltype(std::feraiseexcept(0)), int>::value), ""); |
| 69 | static_assert((std::is_same<decltype(std::fesetexceptflag(&fex, 0)), int>::value), ""); |
| 70 | static_assert((std::is_same<decltype(std::fetestexcept(0)), int>::value), ""); |
| 71 | static_assert((std::is_same<decltype(std::fegetround()), int>::value), ""); |
| 72 | static_assert((std::is_same<decltype(std::fesetround(0)), int>::value), ""); |
| 73 | static_assert((std::is_same<decltype(std::fegetenv(&fenv)), int>::value), ""); |
| 74 | static_assert((std::is_same<decltype(std::feholdexcept(&fenv)), int>::value), ""); |
| 75 | static_assert((std::is_same<decltype(std::fesetenv(&fenv)), int>::value), ""); |
| 76 | static_assert((std::is_same<decltype(std::feupdateenv(&fenv)), int>::value), ""); |
| 77 | } |