From c4ccbcce6cb1e5f981d25dffb1eaba7e290de987 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 11 Jul 2007 18:09:08 +0000 Subject: [PATCH] 2007-07-11 Jeff Johnston * libc/include/math.h: Fix so C99 functions/macros are accessible when -std=c99 is used when compiling and not when using C89. --- newlib/ChangeLog | 5 ++ newlib/libc/include/math.h | 102 ++++++++++++++++++------------------- 2 files changed, 56 insertions(+), 51 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 60a6edc62..484c0e08b 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2007-07-11 Jeff Johnston + + * libc/include/math.h: Fix so C99 functions/macros are accessible + when -std=c99 is used when compiling and not when using C89. + 2007-07-06 Corinna Vinschen * libc/include/wchar.h: Declare wcstol, wcstoll, wcstoul, diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h index d8987cb48..9bfaca2a9 100644 --- a/newlib/libc/include/math.h +++ b/newlib/libc/include/math.h @@ -1,4 +1,5 @@ #ifndef _MATH_H_ + #define _MATH_H_ #include @@ -109,7 +110,7 @@ extern double fmod _PARAMS((double, double)); #endif /* ! defined (__math_68881) */ #endif /* ! defined (_REENT_ONLY) */ -#if !defined(__STRICT_ANSI__) || defined(__cplusplus) +#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L /* ISO C99 types and macros. */ @@ -231,15 +232,6 @@ extern double fdim _PARAMS((double, double)); extern double fmax _PARAMS((double, double)); extern double fmin _PARAMS((double, double)); extern double fma _PARAMS((double, double, double)); -extern void sincos _PARAMS((double, double *, double *)); - -/* GNU extensions */ -# ifndef exp10 -extern double exp10 _PARAMS((double)); -# endif -# ifndef pow10 -extern double pow10 _PARAMS((double)); -# endif #ifndef __math_68881 extern double log1p _PARAMS((double)); @@ -251,32 +243,17 @@ extern double acosh _PARAMS((double)); extern double atanh _PARAMS((double)); extern double remainder _PARAMS((double, double)); extern double gamma _PARAMS((double)); -extern double gamma_r _PARAMS((double, int *)); extern double lgamma _PARAMS((double)); -extern double lgamma_r _PARAMS((double, int *)); extern double erf _PARAMS((double)); extern double erfc _PARAMS((double)); -extern double y0 _PARAMS((double)); -extern double y1 _PARAMS((double)); -extern double yn _PARAMS((int, double)); -extern double j0 _PARAMS((double)); -extern double j1 _PARAMS((double)); -extern double jn _PARAMS((int, double)); #define log2(x) (log (x) / M_LOG2_E) #ifndef __math_68881 extern double hypot _PARAMS((double, double)); #endif -extern double cabs(); -extern double drem _PARAMS((double, double)); - #endif /* ! defined (_REENT_ONLY) */ -#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) */ - -#if !defined(__STRICT_ANSI__) || defined(__cplusplus) - /* Single precision versions of ANSI functions. */ extern float atanf _PARAMS((float)); @@ -305,10 +282,6 @@ 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. */ extern float exp2f _PARAMS((float)); @@ -341,9 +314,56 @@ extern float rintf _PARAMS((float)); extern float scalbnf _PARAMS((float, int)); extern float log1pf _PARAMS((float)); extern float expm1f _PARAMS((float)); + +#ifndef _REENT_ONLY +extern float acoshf _PARAMS((float)); +extern float atanhf _PARAMS((float)); +extern float remainderf _PARAMS((float, float)); +extern float gammaf _PARAMS((float)); +extern float lgammaf _PARAMS((float)); +extern float erff _PARAMS((float)); +extern float erfcf _PARAMS((float)); +#define log2f(x) (logf (x) / (float) M_LOG2_E) +extern float hypotf _PARAMS((float, float)); +#endif /* ! defined (_REENT_ONLY) */ + +#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L */ + +#if !defined (__STRICT_ANSI__) || defined(__cplusplus) + +extern double cabs(); +extern double drem _PARAMS((double, double)); +extern void sincos _PARAMS((double, double *, double *)); +extern double gamma_r _PARAMS((double, int *)); +extern double lgamma_r _PARAMS((double, int *)); + +extern double y0 _PARAMS((double)); +extern double y1 _PARAMS((double)); +extern double yn _PARAMS((int, double)); +extern double j0 _PARAMS((double)); +extern double j1 _PARAMS((double)); +extern double jn _PARAMS((int, double)); + +extern float cabsf(); +extern float dremf _PARAMS((float, float)); extern void sincosf _PARAMS((float, float *, float *)); +extern float gammaf_r _PARAMS((float, int *)); +extern float lgammaf_r _PARAMS((float, int *)); + +extern float y0f _PARAMS((float)); +extern float y1f _PARAMS((float)); +extern float ynf _PARAMS((int, float)); +extern float j0f _PARAMS((float)); +extern float j1f _PARAMS((float)); +extern float jnf _PARAMS((int, float)); /* GNU extensions */ +# ifndef exp10 +extern double exp10 _PARAMS((double)); +# endif +# ifndef pow10 +extern double pow10 _PARAMS((double)); +# endif # ifndef exp10f extern float exp10f _PARAMS((float)); # endif @@ -351,29 +371,9 @@ extern float exp10f _PARAMS((float)); extern float pow10f _PARAMS((float)); # endif -#ifndef _REENT_ONLY -extern float acoshf _PARAMS((float)); -extern float atanhf _PARAMS((float)); -extern float remainderf _PARAMS((float, float)); -extern float gammaf _PARAMS((float)); -extern float gammaf_r _PARAMS((float, int *)); -extern float lgammaf _PARAMS((float)); -extern float lgammaf_r _PARAMS((float, int *)); -extern float erff _PARAMS((float)); -extern float erfcf _PARAMS((float)); -extern float y0f _PARAMS((float)); -extern float y1f _PARAMS((float)); -extern float ynf _PARAMS((int, float)); -extern float j0f _PARAMS((float)); -extern float j1f _PARAMS((float)); -extern float jnf _PARAMS((int, float)); -#define log2f(x) (logf (x) / (float) M_LOG2_E) -extern float hypotf _PARAMS((float, float)); +#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) */ -extern float cabsf(); -extern float dremf _PARAMS((float, float)); - -#endif /* ! defined (_REENT_ONLY) */ +#ifndef __STRICT_ANSI__ /* The gamma functions use a global variable, signgam. */ #ifndef _REENT_ONLY