blob: 5a1633a2936a0f8b2689a3c5953f3152e87f37eb [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Chandler Carruth57b08b02019-01-19 10:56:40 +00003// 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 Hinnant3e519522010-05-11 19:42:16 +00006//
7//===----------------------------------------------------------------------===//
Jonathan Roelofs9df08f02014-12-11 15:37:22 +00008//
9// XFAIL: newlib
Howard Hinnant3e519522010-05-11 19:42:16 +000010
11// <fenv.h>
12
13#include <fenv.h>
14#include <type_traits>
15
Marshall Clow7fc6a552019-05-31 18:35:30 +000016#include "test_macros.h"
17
Howard Hinnant3e519522010-05-11 19:42:16 +000018#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 Bastien2df59c52019-02-04 20:31:13 +000062int main(int, char**)
Howard Hinnant3e519522010-05-11 19:42:16 +000063{
Eric Fiselier76af4162016-05-02 20:08:16 +000064 fenv_t fenv = {};
Howard Hinnant3e519522010-05-11 19:42:16 +000065 fexcept_t fex = 0;
Eric Fiseliercf39dd42019-02-11 23:47:19 +000066 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 Bastien2df59c52019-02-04 20:31:13 +000077
78 return 0;
Howard Hinnant3e519522010-05-11 19:42:16 +000079}