diff options
| author | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-08 23:22:26 +0000 |
|---|---|---|
| committer | bkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-06-08 23:22:26 +0000 |
| commit | 01dd2c6cba3e1ada73b23bd8db38b4e6a88d7e75 (patch) | |
| tree | 5b2ccfa15614160e0477485463b1b2a6313742bd /libstdc++-v3/include/c_std/bits/std_cmath.h | |
| parent | 572fdaa33c3e33d9d62c123bb1ef6d4dbbceb7c1 (diff) | |
| download | ppe42-gcc-01dd2c6cba3e1ada73b23bd8db38b4e6a88d7e75.tar.gz ppe42-gcc-01dd2c6cba3e1ada73b23bd8db38b4e6a88d7e75.zip | |
2001-06-08 Benjamin Kosnik <bkoz@redhat.com>
libstdc++/2767
libstdc++/2989
libstdc++/2992
* include/std/*: Add copyright notice.
* include/c_std/bits/*: Use using statements instead of extern "C".
* include/c_std/bits/std_cmath.h: Don't overload double versions
of math functions with __buitin versions, use global version to
prevent ambiguities. Remove define hacks.
* include/c_std/bits/std_cwchar.h: Using declarations for "C"
functions that have changed signatures and std::
declarations. Remove define hacks.
* include/c_std/bits/std_cwchar.h: Same, plus remove ambiguous
__builtins in std::. Remove define hacks.
* testsuite/17_intro/headers_c.cc: Add tests.
* testsuite/17_intro/headers_c++.cc: Add test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43061 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/c_std/bits/std_cmath.h')
| -rw-r--r-- | libstdc++-v3/include/c_std/bits/std_cmath.h | 126 |
1 files changed, 27 insertions, 99 deletions
diff --git a/libstdc++-v3/include/c_std/bits/std_cmath.h b/libstdc++-v3/include/c_std/bits/std_cmath.h index 32a79d01431..312e0a69922 100644 --- a/libstdc++-v3/include/c_std/bits/std_cmath.h +++ b/libstdc++-v3/include/c_std/bits/std_cmath.h @@ -31,26 +31,13 @@ // ISO C++ 14882: 26.5 C library // -// Note: This is not a conforming implementation. - #ifndef _CPP_CMATH #define _CPP_CMATH 1 #include <bits/c++config.h> -#include <bits/std_cstdlib.h> - -#pragma GCC system_header - -// Need to mangle these "C" functions. Ideally, we could like to do the -// same for the remaining of the "C" functions but they do not have -// builtin implementations. So, they are still of nuisance. -#define abs __glibcpp_abs -#define cos __glibcpp_cos -#define fabs __glibcpp_fabs -#define sin __glibcpp_sin -#define sqrt __glibcpp_sqrt -#include <math.h> +#pragma GCC system_header +#include_next <math.h> // Get rid of those macros defined in <math.h> in lieu of real functions. #undef abs @@ -91,7 +78,6 @@ namespace std return __x < _Tp() ? -__x : __x; } - // abs. inline float abs(float __x) { return __builtin_fabsf(__x); } @@ -104,8 +90,6 @@ namespace std abs(long double __x) { return __builtin_fabsl(__x); } - - // acos. #if _GLIBCPP_HAVE_ACOSF inline float acos(float __x) { return ::acosf(__x); } @@ -114,7 +98,7 @@ namespace std acos(float __x) { return ::acos(static_cast<double>(__x)); } #endif - extern "C" double acos(double __x); + using ::acos; #if _GLIBCPP_HAVE_ACOSL inline long double @@ -124,8 +108,6 @@ namespace std acos(long double __x) { return ::acos(static_cast<double>(__x)); } #endif - - // asin. #if _GLIBCPP_HAVE_ASINF inline float asin(float __x) { return ::asinf(__x); } @@ -134,7 +116,7 @@ namespace std asin(float __x) { return ::asin(static_cast<double>(__x)); } #endif - extern "C" double asin(double __x); + using ::asin; #if _GLIBCPP_HAVE_ASINL inline long double @@ -144,8 +126,6 @@ namespace std asin(long double __x) { return ::asin(static_cast<double>(__x)); } #endif - - // atan. #if _GLIBCPP_HAVE_ATANF inline float atan(float __x) { return ::atanf(__x); } @@ -154,7 +134,7 @@ namespace std atan(float __x) { return ::atan(static_cast<double>(__x)); } #endif - extern "C" double atan(double __x); + using ::atan; #if _GLIBCPP_HAVE_ATANL inline long double @@ -164,8 +144,6 @@ namespace std atan(long double __x) { return ::atan(static_cast<double>(__x)); } #endif - - // atan2. #if _GLIBCPP_HAVE_ATAN2F inline float atan2(float __y, float __x) { return ::atan2f(__y, __x); } @@ -175,7 +153,7 @@ namespace std { return ::atan2(static_cast<double>(__y), static_cast<double>(__x)); } #endif - extern "C" double atan2(double __y, double __x); + using ::atan2; #if _GLIBCPP_HAVE_ATAN2L inline long double @@ -186,8 +164,6 @@ namespace std { return ::atan2(static_cast<double>(__y), static_cast<double>(__x)); } #endif - - // ceil. #if _GLIBCPP_HAVE_CEILF inline float ceil(float __x) { return ::ceilf(__x); } @@ -196,7 +172,7 @@ namespace std ceil(float __x) { return ::ceil(static_cast<double>(__x)); } #endif - extern "C" double ceil(double __x); + using ::ceil; #if _GLIBCPP_HAVE_CEILL inline long double @@ -206,22 +182,16 @@ namespace std ceil(long double __x) { return ::ceil(static_cast<double>(__x)); } #endif - - // cos. inline float cos(float __x) { return __builtin_cosf(__x); } - inline double - cos(double __x) - { return __builtin_cos(__x); } + using ::cos; inline long double cos(long double __x) { return __builtin_cosl(__x); } - - // cosh. #if _GLIBCPP_HAVE_COSHF inline float cosh(float __x) { return ::coshf(__x); } @@ -230,7 +200,7 @@ namespace std cosh(float __x) { return ::cosh(static_cast<double>(__x)); } #endif - extern "C" double cosh(double __x); + using ::cosh; #if _GLIBCPP_HAVE_COSHL inline long double @@ -240,8 +210,6 @@ namespace std cosh(long double __x) { return ::cosh(static_cast<double>(__x)); } #endif - - // exp. #if _GLIBCPP_HAVE_EXPF inline float exp(float __x) { return ::expf(__x); } @@ -250,7 +218,7 @@ namespace std exp(float __x) { return ::exp(static_cast<double>(__x)); } #endif - extern "C" double exp(double __x); + using ::exp; #if _GLIBCPP_HAVE_EXPL inline long double @@ -260,22 +228,16 @@ namespace std exp(long double __x) { return ::exp(static_cast<double>(__x)); } #endif - - // fabs. inline float fabs(float __x) { return __builtin_fabsf(__x); } - inline double - fabs(double __x) - { return __builtin_fabs(__x); } + using ::fabs; inline long double fabs(long double __x) { return __builtin_fabsl(__x); } - - // floor. #if _GLIBCPP_HAVE_FLOORF inline float floor(float __x) { return ::floorf(__x); } @@ -284,7 +246,7 @@ namespace std floor(float __x) { return ::floor(static_cast<double>(__x)); } #endif - extern "C" double floor(double __x); + using ::floor; #if _GLIBCPP_HAVE_FLOORL inline long double @@ -294,8 +256,6 @@ namespace std floor(long double __x) { return ::floor(static_cast<double>(__x)); } #endif - - // fmod. #if _GLIBCPP_HAVE_FMODF inline float fmod(float __x, float __y) { return ::fmodf(__x, __y); } @@ -305,7 +265,7 @@ namespace std { return ::fmod(static_cast<double>(__x), static_cast<double>(__y)); } #endif - extern "C" double fmod(double __x, double __y); + using ::fmod; #if _GLIBCPP_HAVE_FMODL inline long double @@ -316,8 +276,6 @@ namespace std { return ::fmod(static_cast<double>(__x), static_cast<double>(__y)); } #endif - - // frexp. #if _GLIBCPP_HAVE_FREXPF inline float frexp(float __x, int* __exp) { return ::frexpf(__x, __exp); } @@ -326,7 +284,7 @@ namespace std frexp(float __x, int* __exp) { return ::frexp(__x, __exp); } #endif - extern "C" double frexp(double __x, int* __exp); + using ::frexp; #if _GLIBCPP_HAVE_FREXPL inline long double @@ -337,8 +295,6 @@ namespace std { return ::frexp(static_cast<double>(__x), __exp); } #endif - - // ldexp. #if _GLIBCPP_HAVE_LDEXPF inline float ldexp(float __x, int __exp) { return ::ldexpf(__x, __exp); } @@ -348,7 +304,7 @@ namespace std { return ::ldexp(static_cast<double>(__x), __exp); } #endif - extern "C" double ldexp(double __x, int __exp); + using ::ldexp; #if _GLIBCPP_HAVE_LDEXPL inline long double @@ -359,8 +315,6 @@ namespace std { return ::ldexp(static_cast<double>(__x), __exp); } #endif - - // log. #if _GLIBCPP_HAVE_LOGF inline float log(float __x) { return ::logf(__x); } @@ -369,7 +323,7 @@ namespace std { return ::log(static_cast<double>(__x)); } #endif - extern "C" double log(double __x); + using ::log; #if _GLIBCPP_HAVE_LOGL inline long double @@ -379,8 +333,6 @@ namespace std log(long double __x) { return ::log(static_cast<double>(__x)); } #endif - - // log10. #if _GLIBCPP_HAVE_LOG10F inline float log10(float __x) { return ::log10f(__x); } @@ -389,7 +341,7 @@ namespace std log10(float __x) { return ::log10(static_cast<double>(__x)); } #endif - extern "C" double log10(double __x); + using ::log10; #if _GLIBCPP_HAVE_LOG10L inline long double @@ -399,8 +351,6 @@ namespace std log10(long double __x) { return ::log10(static_cast<double>(__x)); } #endif - - // modf. #if _GLIBCPP_HAVE_MODFF inline float modf(float __x, float* __iptr) { return ::modff(__x, __iptr); } @@ -415,7 +365,7 @@ namespace std } #endif - extern "C" double modf(double __x, double* __iptr); + using ::modf; #if _GLIBCPP_HAVE_MODFL inline long double @@ -431,8 +381,6 @@ namespace std } #endif - - // pow. template<typename _Tp> inline _Tp __pow_helper(_Tp __x, int __n) @@ -451,7 +399,7 @@ namespace std { return ::pow(static_cast<double>(__x), static_cast<double>(__y)); } #endif - extern "C" double pow(double __x, double __y); + using ::pow; #if _GLIBCPP_HAVE_POWL inline long double @@ -464,38 +412,26 @@ namespace std inline float pow(float __x, int __n) - { - return __pow_helper(__x, __n); - } + { return __pow_helper(__x, __n); } inline double pow(double __x, int __i) - { - return __pow_helper(__x, __i); - } + { return __pow_helper(__x, __i); } inline long double pow(long double __x, int __n) - { - return __pow_helper(__x, __n); - } - + { return __pow_helper(__x, __n); } - // sin. inline float sin(float __x) { return __builtin_sinf(__x); } - inline double - sin(double __x) - { return __builtin_sin(__x); } + using ::sin; inline long double sin(long double __x) { return __builtin_sinl(__x); } - - // sinh. #if _GLIBCPP_HAVE_SINHF inline float sinh(float __x) { return ::sinhf(__x); } @@ -504,7 +440,7 @@ namespace std sinh(float __x) { return ::sinh(static_cast<double>(__x)); } #endif - extern "C" double sinh(double __x); + using ::sinh; #if _GLIBCPP_HAVE_SINHL inline long double @@ -514,22 +450,16 @@ namespace std sinh(long double __x) { return ::sinh(static_cast<double>(__x)); } #endif - - // sqrt. inline float sqrt(float __x) { return __builtin_sqrtf(__x); } - inline double - sqrt(double __x) - { return __builtin_fsqrt(__x); } + using ::sqrt; inline long double sqrt(long double __x) { return __builtin_sqrtl(__x); } - - // tan. #if _GLIBCPP_HAVE_TANF inline float tan(float __x) { return ::tanf(__x); } @@ -538,7 +468,7 @@ namespace std tan(float __x) { return ::tan(static_cast<double>(__x)); } #endif - extern "C" double tan(double __x); + using ::tan; #if _GLIBCPP_HAVE_TANL inline long double @@ -548,8 +478,6 @@ namespace std tan(long double __x) { return ::tan(static_cast<double>(__x)); } #endif - - // tanh. #if _GLIBCPP_HAVE_TANHF inline float tanh(float __x) { return ::tanhf(__x); } @@ -558,7 +486,7 @@ namespace std tanh(float __x) { return ::tanh(static_cast<double>(__x)); } #endif - extern "C" double tanh(double __x); + using ::tanh; #if _GLIBCPP_HAVE_TANHL inline long double |

