C99/C++ patch for /usr/include/math.h
Billinghurst, David (CRTS)
David.Billinghurst@riotinto.com
Tue Jul 8 11:12:00 GMT 2003
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));
More information about the Newlib
mailing list