Fix the x86_64 fenv.h.
We should clean all the fenv.h files up, but not now. I've raised
bug 11050744 as a reminder.
Change-Id: I640c15b0f0477ec1a7891c031860404875bbe4b5
diff --git a/libm/include/amd64/fenv.h b/libm/include/amd64/fenv.h
index 037778e..1dc4215 100644
--- a/libm/include/amd64/fenv.h
+++ b/libm/include/amd64/fenv.h
@@ -1,6 +1,3 @@
-/* $OpenBSD: fenv.h,v 1.4 2011/05/25 21:46:49 martynas Exp $ */
-/* $NetBSD: fenv.h,v 1.1 2010/07/31 21:47:54 joerg Exp $ */
-
/*-
* Copyright (c) 2004-2005 David Schultz <das (at) FreeBSD.ORG>
* All rights reserved.
@@ -33,6 +30,14 @@
#include <sys/types.h>
/*
+ * This file combines the OpenBSD include/fenv.h and machine/fenv.h to fit
+ * the style of the other architectures (where we couldn't just take an
+ * upstream fenv.h and had to write our own).
+ */
+
+__BEGIN_DECLS
+
+/*
* Each symbol representing a floating point exception expands to an integer
* constant expression with values, such that bitwise-inclusive ORs of _all
* combinations_ of the constants result in distinct values.
@@ -95,9 +100,7 @@
* that manage the floating-point environment, namely fesetenv() and
* feupdateenv().
*/
-__BEGIN_DECLS
extern fenv_t __fe_dfl_env;
-__END_DECLS
#define FE_DFL_ENV ((const fenv_t *)&__fe_dfl_env)
/*
@@ -114,4 +117,31 @@
*/
typedef unsigned int fexcept_t;
+/* C99 floating-point exception functions */
+int feclearexcept(int excepts);
+int fegetexceptflag(fexcept_t *flagp, int excepts);
+int fesetexceptflag(const fexcept_t *flagp, int excepts);
+/* feraiseexcept does not set the inexact flag on overflow/underflow */
+int feraiseexcept(int excepts);
+int fetestexcept(int excepts);
+
+/* C99 rounding control functions */
+int fegetround(void);
+int fesetround(int round);
+
+/* C99 floating-point environment functions */
+int fegetenv(fenv_t *__envp);
+int feholdexcept(fenv_t *__envp);
+int fesetenv(const fenv_t *envp);
+int feupdateenv(const fenv_t *__envp);
+
+#if __BSD_VISIBLE
+/* Additional support functions to set/query floating point traps */
+int feenableexcept(int __mask);
+int fedisableexcept(int __mask);
+int fegetexcept(void);
+#endif /* __BSD_VISIBLE */
+
+__END_DECLS
+
#endif /* !_AMD64_FENV_H_ */