summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-03-20 03:16:12 +0000
committerUlrich Drepper <drepper@redhat.com>1997-03-20 03:16:12 +0000
commitf47163fad39f55b785d8b9331bf6103f8a120745 (patch)
tree38baf624746c994d2e2294bd45e0b9372a6b2093 /math
parent4bf5771c2352bfd187300b9c3679b11c7918c67b (diff)
Make compatible with traditional preprocessor;
requires carefull placement of whitespace in macro arguments. Use __CONCAT instead of ##. Declare long double functions only if __STDC__ or __GNUC__. Include <__math.h> also if __LIBC_M81_MATH_INLINES is defined. Include <__math.h> if __NO_MATH_INLINES is not defined and we want optimization.
Diffstat (limited to 'math')
-rw-r--r--math/math.h44
1 files changed, 38 insertions, 6 deletions
diff --git a/math/math.h b/math/math.h
index eb8a4f202d..a2b98f8853 100644
--- a/math/math.h
+++ b/math/math.h
@@ -44,15 +44,15 @@ __BEGIN_DECLS
and can declare the float versions `namef' and `__namef'. */
#define __MATHCALL(function,suffix, args) \
- __MATHDECL (_Mdouble_, function,suffix, args)
+ __MATHDECL (_Mdouble_,function,suffix, args)
#define __MATHDECL(type, function,suffix, args) \
__MATHDECL_1(type, function,suffix, args); \
- __MATHDECL_1(type, __##function,suffix, args)
+ __MATHDECL_1(type, __CONCAT(__,function),suffix, args)
#define __MATHDECL_1(type, function,suffix, args) \
extern type __MATH_PRECNAME(function,suffix) args
#define _Mdouble_ double
-#define __MATH_PRECNAME(name,r) name##r
+#define __MATH_PRECNAME(name,r) __CONCAT(name,r)
#include <mathcalls.h>
#undef _Mdouble_
#undef __MATH_PRECNAME
@@ -67,7 +67,11 @@ __BEGIN_DECLS
#define _Mfloat_ float
#endif
#define _Mdouble_ _Mfloat_
+#ifdef __STDC__
#define __MATH_PRECNAME(name,r) name##f##r
+#else
+#define __MATH_PRECNAME(name,r) name/**/f/**/r
+#endif
#include <mathcalls.h>
#undef _Mdouble_
#undef __MATH_PRECNAME
@@ -79,7 +83,11 @@ __BEGIN_DECLS
#define _Mlong_double_ long double
#endif
#define _Mdouble_ _Mlong_double_
+#ifdef __STDC__
#define __MATH_PRECNAME(name,r) name##l##r
+#else
+#define __MATH_PRECNAME(name,r) name/**/l/**/r
+#endif
#include <mathcalls.h>
#undef _Mdouble_
#undef __MATH_PRECNAME
@@ -87,6 +95,12 @@ __BEGIN_DECLS
#endif /* Use misc. */
+#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC9X
+/* This variable is used by `gamma' and `lgamma'. */
+extern int signgam;
+#endif
+
+
#ifdef __USE_MISC
/* Support for various different standard error handling behaviors. */
@@ -99,13 +113,17 @@ extern _LIB_VERSION_TYPE _LIB_VERSION;
#endif
-#if defined __USE_SVID && !defined __cplusplus
+#ifdef __USE_SVID
/* In SVID error handling, `matherr' is called with this description
of the exceptional condition.
We have a problem when using C++ since `exception' is reserved in
C++. */
+#ifdef __cplusplus
+struct __exception
+#else
struct exception
+#endif
{
int type;
char *name;
@@ -114,8 +132,13 @@ struct exception
double retval;
};
+#ifdef __cplusplus
+extern int __matherr __P ((struct __exception *));
+extern int matherr __P ((struct __exception *));
+#else
extern int __matherr __P ((struct exception *));
extern int matherr __P ((struct exception *));
+#endif
#define X_TLOSS 1.41484755040568800000e+16
@@ -131,7 +154,15 @@ extern int matherr __P ((struct exception *));
#define HUGE FLT_MAX
#include <float.h> /* Defines FLT_MAX. */
-#endif /* SVID && !C++ */
+#else /* !SVID */
+
+#ifdef __USE_XOPEN
+/* X/Open wants another strange constant. */
+#define MAXFLOAT FLT_MAX
+#include <float.h>
+#endif
+
+#endif /* SVID */
#ifdef __USE_BSD
@@ -164,7 +195,8 @@ extern int matherr __P ((struct exception *));
/* Get machine-dependent inline versions (if there are any). */
-#if defined (__NO_MATH_INLINES) || defined (__OPTIMIZE__)
+#if (!defined __NO_MATH_INLINES && defined __OPTIMIZE__) \
+ || defined __LIBC_M81_MATH_INLINES
#include <__math.h>
#endif