summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2012-12-18 21:20:51 +0000
committerJeff Johnston <jjohnstn@redhat.com>2012-12-18 21:20:51 +0000
commitb060af2264c9cecd960d19cd9f223d6b66ff1acc (patch)
treea91ad6b80273efd5d05072fde05996f4d7b9c10f
parentc91d8a98e3cf55bb1c4284dcce10218b70b58a81 (diff)
downloadcygnal-b060af2264c9cecd960d19cd9f223d6b66ff1acc.tar.gz
cygnal-b060af2264c9cecd960d19cd9f223d6b66ff1acc.tar.bz2
cygnal-b060af2264c9cecd960d19cd9f223d6b66ff1acc.zip
2012-12-18 Craig Howland <howland@LGSInnovations.com>
* libc/include/math.h: Add recognition of values 1 and 2 for FLT_EVAL_METHOD.
-rw-r--r--newlib/ChangeLog5
-rw-r--r--newlib/libc/include/math.h34
2 files changed, 35 insertions, 4 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 1043f89ee..887c18a9c 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,8 @@
+2012-12-18 Craig Howland <howland@LGSInnovations.com>
+
+ * libc/include/math.h: Add recognition of values 1 and 2 for
+ FLT_EVAL_METHOD.
+
2012-12-18 Corinna Vinschen <vinschen@redhat.com>
* libc/stdio/puts.c (_puts_r): Fix typo in previous patch. Add local
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index e9328c55a..47725de37 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -140,11 +140,37 @@ extern double fmod _PARAMS((double, double));
/* ISO C99 types and macros. */
-#ifndef FLT_EVAL_METHOD
-#define FLT_EVAL_METHOD 0
-typedef float float_t;
-typedef double double_t;
+/* FIXME: FLT_EVAL_METHOD should somehow be gotten from float.h (which is hard,
+ * considering that the standard says the includes it defines should not
+ * include other includes that it defines) and that value used. (This can be
+ * solved, but autoconf has a bug which makes the solution more difficult, so
+ * it has been skipped for now.) */
+#if !defined(FLT_EVAL_METHOD) && defined(__FLT_EVAL_METHOD__)
+ #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+ #define __TMP_FLT_EVAL_METHOD
#endif /* FLT_EVAL_METHOD */
+#if defined FLT_EVAL_METHOD
+ #if FLT_EVAL_METHOD == 0
+ typedef float float_t;
+ typedef double double_t;
+ #elif FLT_EVAL_METHOD == 1
+ typedef double float_t;
+ typedef double double_t;
+ #elif FLT_EVAL_METHOD == 2
+ typedef long double float_t;
+ typedef long double double_t;
+ #else
+ /* Implementation-defined. Assume float_t and double_t have been
+ * defined previously for this configuration (e.g. config.h). */
+ #endif
+#else
+ /* Assume basic definitions. */
+ typedef float float_t;
+ typedef double double_t;
+#endif
+#if defined(__TMP_FLT_EVAL_METHOD)
+ #undef FLT_EVAL_METHOD
+#endif
#define FP_NAN 0
#define FP_INFINITE 1