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 | 9df08f0 | 2014-12-11 15:37:22 +0000 | [diff] [blame] | 8 | // |
| 9 | // XFAIL: newlib |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 10 | |
| 11 | // <fenv.h> |
| 12 | |
| 13 | #include <fenv.h> |
| 14 | #include <type_traits> |
| 15 | |
Marshall Clow | 7fc6a55 | 2019-05-31 18:35:30 +0000 | [diff] [blame] | 16 | #include "test_macros.h" |
| 17 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 18 | #ifndef FE_DIVBYZERO |
| 19 | #error FE_DIVBYZERO not defined |
| 20 | #endif |
| 21 | |
| 22 | #ifndef FE_INEXACT |
| 23 | #error FE_INEXACT not defined |
| 24 | #endif |
| 25 | |
| 26 | #ifndef FE_INVALID |
| 27 | #error FE_INVALID not defined |
| 28 | #endif |
| 29 | |
| 30 | #ifndef FE_OVERFLOW |
| 31 | #error FE_OVERFLOW not defined |
| 32 | #endif |
| 33 | |
| 34 | #ifndef FE_UNDERFLOW |
| 35 | #error FE_UNDERFLOW not defined |
| 36 | #endif |
| 37 | |
| 38 | #ifndef FE_ALL_EXCEPT |
| 39 | #error FE_ALL_EXCEPT not defined |
| 40 | #endif |
| 41 | |
| 42 | #ifndef FE_DOWNWARD |
| 43 | #error FE_DOWNWARD not defined |
| 44 | #endif |
| 45 | |
| 46 | #ifndef FE_TONEAREST |
| 47 | #error FE_TONEAREST not defined |
| 48 | #endif |
| 49 | |
| 50 | #ifndef FE_TOWARDZERO |
| 51 | #error FE_TOWARDZERO not defined |
| 52 | #endif |
| 53 | |
| 54 | #ifndef FE_UPWARD |
| 55 | #error FE_UPWARD not defined |
| 56 | #endif |
| 57 | |
| 58 | #ifndef FE_DFL_ENV |
| 59 | #error FE_DFL_ENV not defined |
| 60 | #endif |
| 61 | |
JF Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 62 | int main(int, char**) |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 63 | { |
Eric Fiselier | 76af416 | 2016-05-02 20:08:16 +0000 | [diff] [blame] | 64 | fenv_t fenv = {}; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 65 | fexcept_t fex = 0; |
Eric Fiselier | cf39dd4 | 2019-02-11 23:47:19 +0000 | [diff] [blame] | 66 | static_assert((std::is_same<decltype(::feclearexcept(0)), int>::value), ""); |
| 67 | static_assert((std::is_same<decltype(::fegetexceptflag(&fex, 0)), int>::value), ""); |
| 68 | static_assert((std::is_same<decltype(::feraiseexcept(0)), int>::value), ""); |
| 69 | static_assert((std::is_same<decltype(::fesetexceptflag(&fex, 0)), int>::value), ""); |
| 70 | static_assert((std::is_same<decltype(::fetestexcept(0)), int>::value), ""); |
| 71 | static_assert((std::is_same<decltype(::fegetround()), int>::value), ""); |
| 72 | static_assert((std::is_same<decltype(::fesetround(0)), int>::value), ""); |
| 73 | static_assert((std::is_same<decltype(::fegetenv(&fenv)), int>::value), ""); |
| 74 | static_assert((std::is_same<decltype(::feholdexcept(&fenv)), int>::value), ""); |
| 75 | static_assert((std::is_same<decltype(::fesetenv(&fenv)), int>::value), ""); |
| 76 | static_assert((std::is_same<decltype(::feupdateenv(&fenv)), int>::value), ""); |
JF Bastien | 2df59c5 | 2019-02-04 20:31:13 +0000 | [diff] [blame] | 77 | |
| 78 | return 0; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 79 | } |