This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C99/C++ patch for /usr/include/math.h


David,

  Could you provide more details on the failure.  Does the latest version of the testcases test long
double by any chance?  The newlib version matches the C99 sample definition except that it is
missing long double support.

-- Jeff J.

Billinghurst, David (CRTS) wrote:
I have been working through some gcc-3.4 libstdc++-v3 testsuite failures on cygwin.

The tests:
 - 26_numerics/c99_classification_macros_c++.cc
 - 26_numerics/c99_classification_macros_c.cc
fail because C99 and C++ disagree over fpclassify()

The following patch to /usr/include/math.h does the job, but I haven't checked it against the standards.  I don't have a newlib tree at present, so I am unsure
which source file needs the patch.

Tested by successful compilation of above tests.

2003-07-05 David Billinghurst <David.Billinghurst@riotinto.com>

* math.h: Do not define ISO C99 types and macros for C++

--- math.h.orig 2003-07-05 09:10:07.000000000 +1000
+++ math.h 2003-07-05 09:23:25.000000000 +1000
@@ -63,9 +63,8 @@
#endif /* ! defined (__math_68881) */
#endif /* ! defined (_REENT_ONLY) */
-#ifndef __STRICT_ANSI__
-
/* ISO C99 types and macros. */
+#if ! defined (__STRICT_ANSI__) && ! defined (__cplusplus)
#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD 0
@@ -116,8 +115,10 @@
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
fpclassify(__x) == FP_NAN || fpclassify(__y) == FP_NAN;}))
-/* Non ANSI double precision functions. */
+#endif /* ! defined (__STRICT_ANSI__) && ! defined (__cplusplus) */
+/* Non ANSI double precision functions. */
+#ifndef __STRICT_ANSI__
extern double infinity _PARAMS((void));
extern double nan _PARAMS((void));
extern int isnan _PARAMS((double));





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]