[PATCH] headers: get rid of fenv.h copy

11 views
Skip to first unread message

Waldemar Kozaczuk

unread,
Aug 29, 2020, 12:46:53 AM8/29/20
to osv...@googlegroups.com, Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>
---
arch/aarch64/feexcept.cc | 1 +
arch/x64/feexcept.cc | 1 +
include/api/__fenv.h | 15 +++++++++++++++
include/api/fenv.h | 32 +-------------------------------
tests/tst-feexcept.cc | 1 +
5 files changed, 19 insertions(+), 31 deletions(-)
create mode 100644 include/api/__fenv.h
mode change 100644 => 120000 include/api/fenv.h

diff --git a/arch/aarch64/feexcept.cc b/arch/aarch64/feexcept.cc
index 647f0a52..0d296314 100644
--- a/arch/aarch64/feexcept.cc
+++ b/arch/aarch64/feexcept.cc
@@ -8,6 +8,7 @@
#include <osv/types.h>
#include <osv/stubbing.hh>
#include <fenv.h>
+#include <__fenv.h>
// Note that musl's fenv.h does not define feenableexcept and friends, so
// we need to 'extern "C"' them here, as no header file does this.

diff --git a/arch/x64/feexcept.cc b/arch/x64/feexcept.cc
index acfa827c..fd07ad2a 100644
--- a/arch/x64/feexcept.cc
+++ b/arch/x64/feexcept.cc
@@ -7,6 +7,7 @@

#include <osv/types.h>
#include <fenv.h>
+#include <__fenv.h>

int feenableexcept(int mask)
{
diff --git a/include/api/__fenv.h b/include/api/__fenv.h
new file mode 100644
index 00000000..b0b67fb6
--- /dev/null
+++ b/include/api/__fenv.h
@@ -0,0 +1,15 @@
+#ifndef ___FENV_H
+#define ___FENV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int feenableexcept(int);
+int fedisableexcept(int);
+int fegetexcept(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/api/fenv.h b/include/api/fenv.h
deleted file mode 100644
index 45415133..00000000
--- a/include/api/fenv.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef _FENV_H
-#define _FENV_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <bits/fenv.h>
-
-int feclearexcept(int);
-int fegetexceptflag(fexcept_t *, int);
-int feraiseexcept(int);
-int fesetexceptflag(const fexcept_t *, int);
-int fetestexcept(int);
-
-int fegetround(void);
-int fesetround(int);
-
-int fegetenv(fenv_t *);
-int feholdexcept(fenv_t *);
-int fesetenv(const fenv_t *);
-int feupdateenv(const fenv_t *);
-
-int feenableexcept(int);
-int fedisableexcept(int);
-int fegetexcept(void);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/include/api/fenv.h b/include/api/fenv.h
new file mode 120000
index 00000000..a01a36fa
--- /dev/null
+++ b/include/api/fenv.h
@@ -0,0 +1 @@
+../../../musl/include/fenv.h
\ No newline at end of file
diff --git a/tests/tst-feexcept.cc b/tests/tst-feexcept.cc
index f16c5f91..5d5ddc1f 100644
--- a/tests/tst-feexcept.cc
+++ b/tests/tst-feexcept.cc
@@ -9,6 +9,7 @@
// To compile on Linux, use: c++ -std=c++11 tests/tst-feexcept.cc

#include <fenv.h>
+#include <__fenv.h>
#include <signal.h>
#include <assert.h>
#include <setjmp.h>
--
2.26.2

Nadav Har'El

unread,
Aug 30, 2020, 11:18:39 AM8/30/20
to Waldemar Kozaczuk, Osv Dev
Looks good, but again please add a comment on this __fenv.h why it exists.

--
Nadav Har'El
n...@scylladb.com


--
You received this message because you are subscribed to the Google Groups "OSv Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/20200829044642.575295-1-jwkozaczuk%40gmail.com.

Commit Bot

unread,
Sep 7, 2020, 9:25:19 AM9/7/20
to osv...@googlegroups.com, Waldemar Kozaczuk
From: Waldemar Kozaczuk <jwkoz...@gmail.com>
Committer: Waldemar Kozaczuk <jwkoz...@gmail.com>
Branch: master

headers: get rid of fenv.h copy

Signed-off-by: Waldemar Kozaczuk <jwkoz...@gmail.com>

---
diff --git a/arch/aarch64/feexcept.cc b/arch/aarch64/feexcept.cc
--- a/arch/aarch64/feexcept.cc
+++ b/arch/aarch64/feexcept.cc
@@ -8,6 +8,7 @@
#include <osv/types.h>
#include <osv/stubbing.hh>
#include <fenv.h>
+#include <__fenv.h>
// Note that musl's fenv.h does not define feenableexcept and friends, so
// we need to 'extern "C"' them here, as no header file does this.

diff --git a/arch/x64/feexcept.cc b/arch/x64/feexcept.cc
--- a/arch/x64/feexcept.cc
+++ b/arch/x64/feexcept.cc
@@ -7,6 +7,7 @@

#include <osv/types.h>
#include <fenv.h>
+#include <__fenv.h>

int feenableexcept(int mask)
{
diff --git a/include/api/__fenv.h b/include/api/__fenv.h
--- a/include/api/__fenv.h
+++ b/include/api/__fenv.h
@@ -0,0 +1,15 @@
+#ifndef ___FENV_H
+#define ___FENV_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int feenableexcept(int);
+int fedisableexcept(int);
+int fegetexcept(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/api/fenv.h b/include/api/fenv.h
--- a/include/api/fenv.h
+++ b/include/api/fenv.h
--- a/include/api/fenv.h
+++ b/include/api/fenv.h
@@ -0,0 +1 @@
+../../../musl/include/fenv.h
\ No newline at end of file
diff --git a/tests/tst-feexcept.cc b/tests/tst-feexcept.cc
Reply all
Reply to author
Forward
0 new messages