aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2019-02-28 15:05:13 +0100
committerCorinna Vinschen <corinna@vinschen.de>2019-02-28 15:07:14 +0100
commit90232fa641692f1bf8ba100af00714f448cc7527 (patch)
treeb5fcee390eb7fe37324980a64f1920783934878c
parent639645a2fd753f29ed9693b7c34f015c01de1741 (diff)
downloadnewlib-90232fa641692f1bf8ba100af00714f448cc7527.zip
newlib-90232fa641692f1bf8ba100af00714f448cc7527.tar.gz
newlib-90232fa641692f1bf8ba100af00714f448cc7527.tar.bz2
Cygwin: fenv.h: Add feature test macros, fix values
- feenableexcept,fedisableexcept, fegetexcept are GNU-only - fegetprec, fesetprec are Solaris, use __MISC_VISIBLE - _feinitialise is Cygwin-internal only - Replace self-named FP precision values to Solaris values - Document fegetprec, fesetprec as Solaris functions, not as GNU functions Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/fenv.cc2
-rw-r--r--winsup/cygwin/include/fenv.h56
-rw-r--r--winsup/doc/posix.xml4
3 files changed, 35 insertions, 27 deletions
diff --git a/winsup/cygwin/fenv.cc b/winsup/cygwin/fenv.cc
index 3adc8a9..396f98a 100644
--- a/winsup/cygwin/fenv.cc
+++ b/winsup/cygwin/fenv.cc
@@ -401,7 +401,7 @@ fesetprec (int prec)
unsigned short cw;
/* Will succeed for any valid value of the input parameter. */
- if (prec < FE_SINGLEPREC || prec > FE_EXTENDEDPREC)
+ if (prec < FE_FLTPREC || prec > FE_LDBLPREC)
return EINVAL;
/* Get control word. */
diff --git a/winsup/cygwin/include/fenv.h b/winsup/cygwin/include/fenv.h
index 7ce3a93..a355c47 100644
--- a/winsup/cygwin/include/fenv.h
+++ b/winsup/cygwin/include/fenv.h
@@ -106,11 +106,13 @@ typedef __uint32_t fexcept_t;
#define FE_TOWARDZERO (3)
#define FE_UPWARD (2)
-/* Precision bit values. Not defined by Posix, but follow logically. */
-#define FE_SINGLEPREC (0)
-#define FE_RESERVEDPREC (1)
-#define FE_DOUBLEPREC (2)
-#define FE_EXTENDEDPREC (3)
+/* Precision values defined by Solaris, the only known system actually
+ implementing fegetprec/fesetprec. */
+#ifdef __MISC_VISIBLE /* FIXME? */
+#define FE_FLTPREC (0)
+#define FE_DBLPREC (2)
+#define FE_LDBLPREC (3)
+#endif
/* The <fenv.h> header shall define the following constant, which
represents the default floating-point environment (that is, the one
@@ -138,30 +140,36 @@ extern const fenv_t *_fe_nomask_env;
/* The following shall be declared as functions and may also be
defined as macros. Function prototypes shall be provided. */
-extern int feclearexcept (int excepts);
-extern int fegetexceptflag (fexcept_t *flagp, int excepts);
-extern int feraiseexcept (int excepts);
-extern int fesetexceptflag (const fexcept_t *flagp, int excepts);
-extern int fetestexcept (int excepts);
+extern int feclearexcept (int __excepts);
+extern int fegetexceptflag (fexcept_t *__flagp, int __excepts);
+extern int feraiseexcept (int __excepts);
+extern int fesetexceptflag (const fexcept_t *__flagp, int __excepts);
+extern int fetestexcept (int __excepts);
extern int fegetround (void);
-extern int fesetround (int round);
-extern int fegetenv (fenv_t *envp);
-extern int feholdexcept (fenv_t *envp);
-extern int fesetenv (const fenv_t *envp);
-extern int feupdateenv (const fenv_t *envp);
-
-/* These are not defined in Posix, but make sense by obvious extension. */
-extern int fegetprec (void);
-extern int fesetprec (int prec);
-
-/* This is Cygwin-custom, not from the standard, for use in the Cygwin CRT. */
-extern void _feinitialise (void);
+extern int fesetround (int __round);
+extern int fegetenv (fenv_t *__envp);
+extern int feholdexcept (fenv_t *__envp);
+extern int fesetenv (const fenv_t *__envp);
+extern int feupdateenv (const fenv_t *__envp);
+#if __GNU_VISIBLE
/* These are GNU extensions defined in glibc. */
-extern int feenableexcept (int excepts);
-extern int fedisableexcept (int excepts);
+extern int feenableexcept (int __excepts);
+extern int fedisableexcept (int __excepts);
extern int fegetexcept (void);
+#endif
+
+/* FIXME, what guard shall we use for Solaris extensions? */
+#if __MISC_VISIBLE
+/* These are defined in Solaris libm.a */
+extern int fegetprec (void);
+extern int fesetprec (int __prec);
+#endif
+#ifdef __INSIDE_CYGWIN__
+/* This is Cygwin-custom, not from the standard, for use in the Cygwin CRT. */
+extern void _feinitialise ();
+#endif
#ifdef __cplusplus
}
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index 0755bed..d49cf55 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -1319,8 +1319,6 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).</para>
fedisableexcept
feenableexcept
fegetexcept
- fegetprec
- fesetprec
ffsl
ffsll
fgets_unlocked
@@ -1443,6 +1441,8 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008).</para>
acltotext
endmntent
facl
+ fegetprec
+ fesetprec
futimesat
getmntent
memalign