xref: /llvm-project/libcxx/test/std/depr/depr.c.headers/fenv_h.compile.pass.cpp (revision ae85b39396a69afa5c58f06c2f9a4a0d94e94ef6)
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(0)));
66 ASSERT_SAME_TYPE(int, decltype(::fegetexceptflag(&fex, 0)));
67 ASSERT_SAME_TYPE(int, decltype(::feraiseexcept(0)));
68 ASSERT_SAME_TYPE(int, decltype(::fesetexceptflag(&fex, 0)));
69 ASSERT_SAME_TYPE(int, decltype(::fetestexcept(0)));
70 ASSERT_SAME_TYPE(int, decltype(::fegetround()));
71 ASSERT_SAME_TYPE(int, decltype(::fesetround(0)));
72 ASSERT_SAME_TYPE(int, decltype(::fegetenv(&fenv)));
73 ASSERT_SAME_TYPE(int, decltype(::feholdexcept(&fenv)));
74 ASSERT_SAME_TYPE(int, decltype(::fesetenv(&fenv)));
75 ASSERT_SAME_TYPE(int, decltype(::feupdateenv(&fenv)));
76