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]

patch for g++ -ansi for math.h



When 'g++ -ansi' is used, __STRICT_ANSI__ is defined.  Normally this
is exactly what you'd want.  However, the C++ standard adds a few
single-precision math functions to the usual list of C89 math.h
functions, and this was causing

#include <complex>

to fail when built with 'g++ -ansi' and newlib.

On Linux, this is dealt with by defining _GNU_SOURCE in g++, which
declares these and many other things.

OK to commit?

-- 
Geoff Keating <geoffk@redhat.com>

===File ~/patches/newlib-mathfloat.patch====================
2001-10-22  Geoffrey Keating  <geoffk@redhat.com>

	* libc/include/math.h: The C++ standard adds the single-precision
	versions of the elementary functions.

Index: libc/include/math.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/math.h,v
retrieving revision 1.7
diff -p -u -p -r1.7 math.h
--- math.h	2001/01/29 22:40:50	1.7
+++ math.h	2001/10/22 20:06:54
@@ -114,6 +114,10 @@ extern double drem _PARAMS((double, doub
 
 #endif /* ! defined (_REENT_ONLY) */
 
+#endif /* ! defined (__STRICT_ANSI__) */
+
+#if !defined(__STRICT_ANSI__) || defined(__cplusplus)
+
 /* Single precision versions of ANSI functions.  */
 
 extern float atanf _PARAMS((float));
@@ -141,6 +145,10 @@ extern float powf _PARAMS((float, float)
 extern float sqrtf _PARAMS((float));
 extern float fmodf _PARAMS((float, float));
 #endif /* ! defined (_REENT_ONLY) */
+
+#endif /* !defined(__STRICT_ANSI__) || defined(__cplusplus) */
+
+#ifndef __STRICT_ANSI__
 
 /* Other single precision functions.  */
 
============================================================


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