[PATCH 2/3] Add default implementation of fenv.h and all methods

Joel Sherrill joel@rtems.org
Wed Jul 31 23:14:00 GMT 2019


	The default implementation of the fenv.h methods return
	-EOPNOTSUPP.

	The intention of the new fenv.h is that it be portable
	and that architectures provide their own implementation
	of sys/fenv.h.
---
 newlib/libc/include/fenv.h         | 42 ++++++++++++++++++++++++++++++++++
 newlib/libc/include/sys/fenv.h     | 47 ++++++++++++++++++++++++++++++++++++++
 newlib/libm/Makefile.am            |  6 ++---
 newlib/libm/configure.in           |  2 +-
 newlib/libm/fenv/Makefile.am       | 36 +++++++++++++++++++++++++++++
 newlib/libm/fenv/fe_dfl_env.c      | 32 ++++++++++++++++++++++++++
 newlib/libm/fenv/feclearexcept.c   | 35 ++++++++++++++++++++++++++++
 newlib/libm/fenv/fegetenv.c        | 35 ++++++++++++++++++++++++++++
 newlib/libm/fenv/fegetexceptflag.c | 36 +++++++++++++++++++++++++++++
 newlib/libm/fenv/fegetround.c      | 36 +++++++++++++++++++++++++++++
 newlib/libm/fenv/feholdexcept.c    | 36 +++++++++++++++++++++++++++++
 newlib/libm/fenv/feraiseexcept.c   | 36 +++++++++++++++++++++++++++++
 newlib/libm/fenv/fesetenv.c        | 36 +++++++++++++++++++++++++++++
 newlib/libm/fenv/fesetexceptflag.c | 36 +++++++++++++++++++++++++++++
 newlib/libm/fenv/fesetround.c      | 36 +++++++++++++++++++++++++++++
 newlib/libm/fenv/fetestexcept.c    | 36 +++++++++++++++++++++++++++++
 newlib/libm/fenv/feupdateenv.c     | 36 +++++++++++++++++++++++++++++
 17 files changed, 555 insertions(+), 4 deletions(-)
 create mode 100644 newlib/libc/include/fenv.h
 create mode 100644 newlib/libc/include/sys/fenv.h
 create mode 100644 newlib/libm/fenv/Makefile.am
 create mode 100644 newlib/libm/fenv/fe_dfl_env.c
 create mode 100644 newlib/libm/fenv/feclearexcept.c
 create mode 100644 newlib/libm/fenv/fegetenv.c
 create mode 100644 newlib/libm/fenv/fegetexceptflag.c
 create mode 100644 newlib/libm/fenv/fegetround.c
 create mode 100644 newlib/libm/fenv/feholdexcept.c
 create mode 100644 newlib/libm/fenv/feraiseexcept.c
 create mode 100644 newlib/libm/fenv/fesetenv.c
 create mode 100644 newlib/libm/fenv/fesetexceptflag.c
 create mode 100644 newlib/libm/fenv/fesetround.c
 create mode 100644 newlib/libm/fenv/fetestexcept.c
 create mode 100644 newlib/libm/fenv/feupdateenv.c

diff --git a/newlib/libc/include/fenv.h b/newlib/libc/include/fenv.h
new file mode 100644
index 0000000..4795cc9
--- /dev/null
+++ b/newlib/libc/include/fenv.h
@@ -0,0 +1,42 @@
+/* Copyright (c) 2017  SiFive Inc. All rights reserved.
+
+   This copyrighted material is made available to anyone wishing to use,
+   modify, copy, or redistribute it subject to the terms and conditions
+   of the FreeBSD License.   This program is distributed in the hope that
+   it will be useful, but WITHOUT ANY WARRANTY expressed or implied,
+   including the implied warranties of MERCHANTABILITY or FITNESS FOR
+   A PARTICULAR PURPOSE.  A copy of this license is available at
+   http://www.opensource.org/licenses.
+*/
+
+#ifndef _FENV_H
+#define _FENV_H
+
+#include <sys/fenv.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Exception */
+int feclearexcept(int excepts);
+int fegetexceptflag(fexcept_t *flagp, int excepts);
+int feraiseexcept(int excepts);
+int fesetexceptflag(const fexcept_t *flagp, int excepts);
+int fetestexcept(int excepts);
+
+/* Rounding mode */
+int fegetround(void);
+int fesetround(int rounding_mode);
+
+/* Float environment */
+int fegetenv(fenv_t *envp);
+int feholdexcept(fenv_t *envp);
+int fesetenv(const fenv_t *envp);
+int feupdateenv(const fenv_t *envp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/newlib/libc/include/sys/fenv.h b/newlib/libc/include/sys/fenv.h
new file mode 100644
index 0000000..8edae90
--- /dev/null
+++ b/newlib/libc/include/sys/fenv.h
@@ -0,0 +1,47 @@
+/* Copyright (c) 2017  SiFive Inc. All rights reserved.
+
+   This copyrighted material is made available to anyone wishing to use,
+   modify, copy, or redistribute it subject to the terms and conditions
+   of the FreeBSD License.   This program is distributed in the hope that
+   it will be useful, but WITHOUT ANY WARRANTY expressed or implied,
+   including the implied warranties of MERCHANTABILITY or FITNESS FOR
+   A PARTICULAR PURPOSE.  A copy of this license is available at
+   http://www.opensource.org/licenses.
+*/
+
+/*
+ * A unique target specific version of this file should be implemented
+ * for each architecture supporting the fenv.h methods.
+ *
+ * Note: This version is not intended to be functional on any architecture
+ *       and just provides a template to start from when porting.
+ */
+
+
+#ifndef _SYS_FENV_H
+#define _SYS_FENV_H
+
+#include <stddef.h>
+
+#define FE_INVALID   0x00000010
+#define FE_DIVBYZERO 0x00000008
+#define FE_OVERFLOW  0x00000004
+#define FE_UNDERFLOW 0x00000002
+#define FE_INEXACT   0x00000001
+
+#define FE_ALL_EXCEPT (FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW|FE_UNDERFLOW|FE_INEXACT)
+
+#define FE_TONEAREST_MM 0x00000004
+#define FE_UPWARD     	0x00000003
+#define FE_DOWNWARD   	0x00000002
+#define FE_TOWARDZERO 	0x00000001
+#define FE_TONEAREST  	0x00000000
+
+#define FE_RMODE_MASK   0x7
+
+typedef size_t fenv_t;
+typedef size_t fexcept_t;
+extern const fenv_t fe_dfl_env;
+#define FE_DFL_ENV fe_dfl_env_p
+
+#endif /* _FENV_H_ */
diff --git a/newlib/libm/Makefile.am b/newlib/libm/Makefile.am
index 8bc2c2c..fb752f7 100644
--- a/newlib/libm/Makefile.am
+++ b/newlib/libm/Makefile.am
@@ -8,17 +8,17 @@ else
 MATHDIR = math
 endif
 
-SUBDIRS = $(MATHDIR) common complex machine 
+SUBDIRS = $(MATHDIR) common complex fenv machine 
 
 libm_la_LDFLAGS = -Xcompiler -nostdlib
 
 if USE_LIBTOOL
-SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) complex/libcomplex.$(aext)  $(LIBM_MACHINE_LIB)
+SUBLIBS = $(MATHDIR)/lib$(MATHDIR).$(aext) common/libcommon.$(aext) complex/libcomplex.$(aext) fenv/libfenv.$(aext) $(LIBM_MACHINE_LIB)
 noinst_LTLIBRARIES = libm.la
 libm_la_SOURCES =
 libm_la_LIBADD = $(SUBLIBS)
 else
-SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) complex/lib.$(aext) $(LIBM_MACHINE_LIB)
+SUBLIBS = $(MATHDIR)/lib.$(aext) common/lib.$(aext) complex/lib.$(aext) fenv/lib.$(aext) $(LIBM_MACHINE_LIB)
 noinst_LIBRARIES = libm.a
 libm.a: $(SUBLIBS)
 	rm -f $@
diff --git a/newlib/libm/configure.in b/newlib/libm/configure.in
index 9bd107c..aec22bd 100644
--- a/newlib/libm/configure.in
+++ b/newlib/libm/configure.in
@@ -62,5 +62,5 @@ fi
 
 AC_SUBST(LIBM_MACHINE_LIB)
 
-AC_CONFIG_FILES([Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile])
+AC_CONFIG_FILES([Makefile math/Makefile mathfp/Makefile common/Makefile complex/Makefile fenv/Makefile])
 AC_OUTPUT
diff --git a/newlib/libm/fenv/Makefile.am b/newlib/libm/fenv/Makefile.am
new file mode 100644
index 0000000..fef5c36
--- /dev/null
+++ b/newlib/libm/fenv/Makefile.am
@@ -0,0 +1,36 @@
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+src =	feclearexcept.c fe_dfl_env.c fegetenv.c fegetexceptflag.c \
+	fegetround.c feholdexcept.c feraiseexcept.c fesetenv.c \
+	fesetexceptflag.c fesetround.c fetestexcept.c feupdateenv.c
+
+libcommon_la_LDFLAGS = -Xcompiler -nostdlib
+lib_a_CFLAGS = -fbuiltin -fno-math-errno
+
+if USE_LIBTOOL
+noinst_LTLIBRARIES = libcommon.la
+libcommon_la_SOURCES = $(src)
+noinst_DATA = objectlist.awk.in
+else
+noinst_LIBRARIES = lib.a
+lib_a_SOURCES = $(src)
+lib_a_CFLAGS += $(AM_CFLAGS)
+noinst_DATA =
+endif # USE_LIBTOOL
+
+include $(srcdir)/../../Makefile.shared
+
+CHEWOUT_FILES =	feclearexcept.def fe_dfl_env.def fegetenv.def \
+	fegetexceptflag.def fegetround.def feholdexcept.def \
+	feraiseexcept.def fesetenv.def fesetexceptflag.def fesetround.def \
+	fetestexcept.def feupdateenv.def
+
+CHAPTERS =
+
+# A partial dependency list.
+
+$(lib_a_OBJECTS): $(srcdir)/../../libc/include/fenv.h
diff --git a/newlib/libm/fenv/fe_dfl_env.c b/newlib/libm/fenv/fe_dfl_env.c
new file mode 100644
index 0000000..5db1b83
--- /dev/null
+++ b/newlib/libm/fenv/fe_dfl_env.c
@@ -0,0 +1,32 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+
+const fenv_t fe_dfl_env = { 0 };
+const fenv_t *fe_dfl_env_p = &fe_dfl_env;
diff --git a/newlib/libm/fenv/feclearexcept.c b/newlib/libm/fenv/feclearexcept.c
new file mode 100644
index 0000000..31d5001
--- /dev/null
+++ b/newlib/libm/fenv/feclearexcept.c
@@ -0,0 +1,35 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int feclearexcept(int excepts)
+{
+  return -EOPNOTSUPP;
+}
diff --git a/newlib/libm/fenv/fegetenv.c b/newlib/libm/fenv/fegetenv.c
new file mode 100644
index 0000000..0d34f41
--- /dev/null
+++ b/newlib/libm/fenv/fegetenv.c
@@ -0,0 +1,35 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int fegetenv(fenv_t *envp)
+{
+  return -EOPNOTSUPP;
+}
diff --git a/newlib/libm/fenv/fegetexceptflag.c b/newlib/libm/fenv/fegetexceptflag.c
new file mode 100644
index 0000000..cb4eaf8
--- /dev/null
+++ b/newlib/libm/fenv/fegetexceptflag.c
@@ -0,0 +1,36 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int fegetexceptflag(fexcept_t *flagp, int excepts)
+{
+  return -EOPNOTSUPP;
+}
+
diff --git a/newlib/libm/fenv/fegetround.c b/newlib/libm/fenv/fegetround.c
new file mode 100644
index 0000000..ceda28d
--- /dev/null
+++ b/newlib/libm/fenv/fegetround.c
@@ -0,0 +1,36 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int fegetround(void)
+{
+  return -EOPNOTSUPP;
+}
+
diff --git a/newlib/libm/fenv/feholdexcept.c b/newlib/libm/fenv/feholdexcept.c
new file mode 100644
index 0000000..f570003
--- /dev/null
+++ b/newlib/libm/fenv/feholdexcept.c
@@ -0,0 +1,36 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int feholdexcept(fenv_t *envp)
+{
+  return -EOPNOTSUPP;
+}
+
diff --git a/newlib/libm/fenv/feraiseexcept.c b/newlib/libm/fenv/feraiseexcept.c
new file mode 100644
index 0000000..27104bd
--- /dev/null
+++ b/newlib/libm/fenv/feraiseexcept.c
@@ -0,0 +1,36 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int feraiseexcept(int excepts)
+{
+  return -EOPNOTSUPP;
+}
+
diff --git a/newlib/libm/fenv/fesetenv.c b/newlib/libm/fenv/fesetenv.c
new file mode 100644
index 0000000..30232bc
--- /dev/null
+++ b/newlib/libm/fenv/fesetenv.c
@@ -0,0 +1,36 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int fesetenv(const fenv_t *envp)
+{
+  return -EOPNOTSUPP;
+}
+
diff --git a/newlib/libm/fenv/fesetexceptflag.c b/newlib/libm/fenv/fesetexceptflag.c
new file mode 100644
index 0000000..0a31f54
--- /dev/null
+++ b/newlib/libm/fenv/fesetexceptflag.c
@@ -0,0 +1,36 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int fesetexceptflag(const fexcept_t *flagp, int excepts)
+{
+  return -EOPNOTSUPP;
+}
+
diff --git a/newlib/libm/fenv/fesetround.c b/newlib/libm/fenv/fesetround.c
new file mode 100644
index 0000000..ef79cf8
--- /dev/null
+++ b/newlib/libm/fenv/fesetround.c
@@ -0,0 +1,36 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int fesetround(int round)
+{
+  return -EOPNOTSUPP;
+}
+
diff --git a/newlib/libm/fenv/fetestexcept.c b/newlib/libm/fenv/fetestexcept.c
new file mode 100644
index 0000000..4a6a305
--- /dev/null
+++ b/newlib/libm/fenv/fetestexcept.c
@@ -0,0 +1,36 @@
+
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int fetestexcept(int excepts)
+{
+  return -EOPNOTSUPP;
+}
diff --git a/newlib/libm/fenv/feupdateenv.c b/newlib/libm/fenv/feupdateenv.c
new file mode 100644
index 0000000..e301efb
--- /dev/null
+++ b/newlib/libm/fenv/feupdateenv.c
@@ -0,0 +1,36 @@
+/*
+  (c) Copyright 2019 Joel Sherrill <joel@rtems.org
+  All rights reserved.
+
+  Redistribution and use in source and binary forms, with or without
+  modification, are permitted provided that the following conditions
+  are met:
+
+  1. Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+  2. Redistributions in binary form must reproduce the above copyright
+     notice, this list of conditions and the following disclaimer in the
+     documentation and/or other materials provided with the distribution.
+
+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <fenv.h>
+#include <errno.h>
+
+int feupdateenv(const fenv_t *envp)
+{
+  return -EOPNOTSUPP;
+}
+
-- 
1.8.3.1



More information about the Newlib mailing list