1 | //===----------------------------------------------------------------------===// |
2 | // |
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 |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // Picolibc does not define some of the floating point environment macros for |
10 | // arm platforms without hardware floating point support. |
11 | // UNSUPPORTED: LIBCXX-PICOLIBC-FIXME |
12 | |
13 | // <fenv.h> |
14 | |
15 | #include <fenv.h> |
16 | |
17 | #include "test_macros.h" |
18 | |
19 | #ifndef FE_DIVBYZERO |
20 | #error FE_DIVBYZERO not defined |
21 | #endif |
22 | |
23 | #ifndef FE_INEXACT |
24 | #error FE_INEXACT not defined |
25 | #endif |
26 | |
27 | #ifndef FE_INVALID |
28 | #error FE_INVALID not defined |
29 | #endif |
30 | |
31 | #ifndef FE_OVERFLOW |
32 | #error FE_OVERFLOW not defined |
33 | #endif |
34 | |
35 | #ifndef FE_UNDERFLOW |
36 | #error FE_UNDERFLOW not defined |
37 | #endif |
38 | |
39 | #ifndef FE_ALL_EXCEPT |
40 | #error FE_ALL_EXCEPT not defined |
41 | #endif |
42 | |
43 | #ifndef FE_DOWNWARD |
44 | #error FE_DOWNWARD not defined |
45 | #endif |
46 | |
47 | #ifndef FE_TONEAREST |
48 | #error FE_TONEAREST not defined |
49 | #endif |
50 | |
51 | #ifndef FE_TOWARDZERO |
52 | #error FE_TOWARDZERO not defined |
53 | #endif |
54 | |
55 | #ifndef FE_UPWARD |
56 | #error FE_UPWARD not defined |
57 | #endif |
58 | |
59 | #ifndef FE_DFL_ENV |
60 | #error FE_DFL_ENV not defined |
61 | #endif |
62 | |
63 | fenv_t fenv = {}; |
64 | fexcept_t fex = fexcept_t(); |
65 | ASSERT_SAME_TYPE(int, decltype(::feclearexcept(excepts: 0))); |
66 | ASSERT_SAME_TYPE(int, decltype(::fegetexceptflag(flagp: &fex, excepts: 0))); |
67 | ASSERT_SAME_TYPE(int, decltype(::feraiseexcept(excepts: 0))); |
68 | ASSERT_SAME_TYPE(int, decltype(::fesetexceptflag(flagp: &fex, excepts: 0))); |
69 | ASSERT_SAME_TYPE(int, decltype(::fetestexcept(excepts: 0))); |
70 | ASSERT_SAME_TYPE(int, decltype(::fegetround())); |
71 | ASSERT_SAME_TYPE(int, decltype(::fesetround(rounding_direction: 0))); |
72 | ASSERT_SAME_TYPE(int, decltype(::fegetenv(envp: &fenv))); |
73 | ASSERT_SAME_TYPE(int, decltype(::feholdexcept(envp: &fenv))); |
74 | ASSERT_SAME_TYPE(int, decltype(::fesetenv(envp: &fenv))); |
75 | ASSERT_SAME_TYPE(int, decltype(::feupdateenv(envp: &fenv))); |
76 | |