Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | 5b08a8a | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
Howard Hinnant | 412dbeb | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Jonathan Roelofs | 2f63b50 | 2014-12-11 16:17:26 +0000 | [diff] [blame] | 9 | // |
| 10 | // UNSUPPORTED: newlib |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 11 | |
| 12 | // <cfenv> |
| 13 | |
| 14 | #include <cfenv> |
| 15 | #include <type_traits> |
| 16 | |
| 17 | #ifndef FE_DIVBYZERO |
| 18 | #error FE_DIVBYZERO not defined |
| 19 | #endif |
| 20 | |
| 21 | #ifndef FE_INEXACT |
| 22 | #error FE_INEXACT not defined |
| 23 | #endif |
| 24 | |
| 25 | #ifndef FE_INVALID |
| 26 | #error FE_INVALID not defined |
| 27 | #endif |
| 28 | |
| 29 | #ifndef FE_OVERFLOW |
| 30 | #error FE_OVERFLOW not defined |
| 31 | #endif |
| 32 | |
| 33 | #ifndef FE_UNDERFLOW |
| 34 | #error FE_UNDERFLOW not defined |
| 35 | #endif |
| 36 | |
| 37 | #ifndef FE_ALL_EXCEPT |
| 38 | #error FE_ALL_EXCEPT not defined |
| 39 | #endif |
| 40 | |
| 41 | #ifndef FE_DOWNWARD |
| 42 | #error FE_DOWNWARD not defined |
| 43 | #endif |
| 44 | |
| 45 | #ifndef FE_TONEAREST |
| 46 | #error FE_TONEAREST not defined |
| 47 | #endif |
| 48 | |
| 49 | #ifndef FE_TOWARDZERO |
| 50 | #error FE_TOWARDZERO not defined |
| 51 | #endif |
| 52 | |
| 53 | #ifndef FE_UPWARD |
| 54 | #error FE_UPWARD not defined |
| 55 | #endif |
| 56 | |
| 57 | #ifndef FE_DFL_ENV |
| 58 | #error FE_DFL_ENV not defined |
| 59 | #endif |
| 60 | |
| 61 | int main() |
| 62 | { |
Ed Schouten | 69722ab | 2015-03-15 18:36:31 +0000 | [diff] [blame] | 63 | std::fenv_t fenv; |
| 64 | std::fexcept_t fex; |
Eric Fiselier | fb42f4c | 2016-05-02 19:15:48 +0000 | [diff] [blame] | 65 | ((void)fenv); // Prevent unused warning |
| 66 | ((void)fex); // Prevent unused warning |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 67 | static_assert((std::is_same<decltype(std::feclearexcept(0)), int>::value), ""); |
| 68 | static_assert((std::is_same<decltype(std::fegetexceptflag(&fex, 0)), int>::value), ""); |
| 69 | static_assert((std::is_same<decltype(std::feraiseexcept(0)), int>::value), ""); |
| 70 | static_assert((std::is_same<decltype(std::fesetexceptflag(&fex, 0)), int>::value), ""); |
| 71 | static_assert((std::is_same<decltype(std::fetestexcept(0)), int>::value), ""); |
| 72 | static_assert((std::is_same<decltype(std::fegetround()), int>::value), ""); |
| 73 | static_assert((std::is_same<decltype(std::fesetround(0)), int>::value), ""); |
| 74 | static_assert((std::is_same<decltype(std::fegetenv(&fenv)), int>::value), ""); |
| 75 | static_assert((std::is_same<decltype(std::feholdexcept(&fenv)), int>::value), ""); |
| 76 | static_assert((std::is_same<decltype(std::fesetenv(&fenv)), int>::value), ""); |
| 77 | static_assert((std::is_same<decltype(std::feupdateenv(&fenv)), int>::value), ""); |
| 78 | } |