| //===- llvm/Support/FEnv.h - Host floating-point exceptions ------*- C++ -*-===// |
| // The LLVM Compiler Infrastructure |
| // This file is distributed under the University of Illinois Open Source |
| // License. See LICENSE.TXT for details. |
| //===----------------------------------------------------------------------===// |
| // This file provides an operating system independent interface to |
| // floating-point exception interfaces. |
| //===----------------------------------------------------------------------===// |
| #ifndef LLVM_SYSTEM_FENV_H |
| #define LLVM_SYSTEM_FENV_H |
| #include "llvm/Config/config.h" |
| // FIXME: Clang's #include handling apparently doesn't work for libstdc++'s |
| // fenv.h; see PR6907 for details. |
| #if defined(__clang__) && defined(_GLIBCXX_FENV_H) |
| /// llvm_fenv_clearexcept - Clear the floating-point exception state. |
| static inline void llvm_fenv_clearexcept() { |
| feclearexcept(FE_ALL_EXCEPT); |
| /// llvm_fenv_testexcept - Test if a floating-point exception was raised. |
| static inline bool llvm_fenv_testexcept() { |
| if (errno_val == ERANGE || errno_val == EDOM) |
| if (fetestexcept(FE_ALL_EXCEPT & ~FE_INEXACT)) |