From 709f271858a43c04832a06de3d38e2da10c7328a Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Tue, 1 Jan 2002 20:50:16 +0100 Subject: [PATCH] stubs.c (sinf,cosf): Implement stubs to enable the equivalent ___builtin__ versions. 2002-01-01 Roger Sayle * libmath/stubs.c (sinf,cosf): Implement stubs to enable the equivalent ___builtin__ versions. * include/c_shadow/bits/std_cmath.h: All __builtin math functions are available in libstdc++ as the necessary stub implementations are provided by libmath/stubs.c. From-SVN: r48445 --- libstdc++-v3/ChangeLog | 31 ++++--- .../include/c_shadow/bits/std_cmath.h | 86 +------------------ libstdc++-v3/libmath/stubs.c | 6 +- 3 files changed, 24 insertions(+), 99 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 76e4c76d566..9d61d6756f3 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2002-01-01 Roger Sayle + + * libmath/stubs.c (sinf,cosf): Implement stubs to enable the + equivalent ___builtin__ versions. + + * include/c_shadow/bits/std_cmath.h: All __builtin math functions + are available in libstdc++ as the necessary stub implementations + are provided by libmath/stubs.c. + 2002-01-01 Jason Thorpe * configure.in: Add support for NetBSD cross compiles. @@ -55,7 +64,7 @@ * include/backward/algo.h: Include , tweak using declarations. - + 2001-12-29 Richard Henderson * config/os/hpux/bits/os_defines.h: Don't define __glibcpp_long_bits. @@ -132,7 +141,7 @@ (back_insert_iterator): Uglify member container to _M_container. (front_insert_iterator): Same. (insert_iterator): Same. - + 2001-12-25 Gabriel Dos Reis * include/bits/std_limits.h (__glibcpp_xxx_is_modulo): New @@ -156,7 +165,7 @@ for strtoll and strtoull. 2001-12-21 Jeffrey A Law - + * config/os/hpux/bits/os_defines.h: Include libstdc++-v3/5148 - * testsuite/lib/libstdc++-v3-dg.exp: Append .exe to + * testsuite/lib/libstdc++-v3-dg.exp: Append .exe to executable filenames 2001-12-18 Benjamin Kosnik @@ -222,10 +231,10 @@ enabling gnu model. * aclocal.m4: Rebuild. * configure: Rebuild. - + 2001-12-18 Paolo Carlini Nathan Myers - + * include/bits/basic_string.h (assign(__str, __pos, __n)): Call assign(__s, __n). (assign(__s, __n)): Terminate the string with _S_terminal. @@ -275,7 +284,7 @@ on linux by default. * aclocal.m4: Regenerate. * configure: Regenerate. - + 2001-12-14 Benjamin Kosnik Clean up initialization and simplfy caching of underlying "C" @@ -297,11 +306,11 @@ * config/os/gnu-linux/bits/ctype_inline.h: Tweak. * config/os/gnu-linux/bits/ctype_noninline.h: Adjust initializations. * include/bits/locale_facets.h (ctype::_M_c_locale_ctype): Add. - Adjust ctors, dtors. + Adjust ctors, dtors. (ctype::_M_toupper): Remove const&. (ctype::_M_tolower): Remove const&. - (ctype::_M_ctable): Remove const&. - + (ctype::_M_ctable): Remove const&. + * include/bits/locale_facets.h (collate): Clean up initialization of _M_c_locale_collate in ctors and dtors. * config/locale/collate_members_gnu.cc: Always use extended @@ -316,7 +325,7 @@ * include/bits/localefwd.h: Clean. Move dtor definitions to * src/locale.cc: Here. * testsuite/22_locale/facet.cc: Fix spelling. - + Named locale support for ctype. * acinclude.m4 (GLIBCPP_ENABLE_CLOCALE): Add variable ctype_members_* bits. diff --git a/libstdc++-v3/include/c_shadow/bits/std_cmath.h b/libstdc++-v3/include/c_shadow/bits/std_cmath.h index 77f79bcb652..7201067e303 100644 --- a/libstdc++-v3/include/c_shadow/bits/std_cmath.h +++ b/libstdc++-v3/include/c_shadow/bits/std_cmath.h @@ -1,6 +1,6 @@ // -*- C++ -*- header wrapper. -// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. +// Copyright (C) 1997-1999, 2000, 2002 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -84,16 +84,8 @@ namespace _C_legacy { _CPP_ceil_capture(float __x) { return ceil(static_cast(__x)); } #endif -#if _GLIBCPP_HAVE___BUILTIN_COSF inline float _CPP_cos_capture(float __x) { return __builtin_cosf(__x); } -#elif _GLIBCPP_HAVE_COSF - inline float - _CPP_cos_capture(float __x) { return cosf(__x); } -#else - inline float - _CPP_cos_capture(float __x) { return cos(static_cast(__x)); } -#endif #if _GLIBCPP_HAVE_COSHF inline float @@ -111,16 +103,8 @@ namespace _C_legacy { _CPP_exp_capture(float __x) { return exp(static_cast(__x)); } #endif -#if _GLIBCPP_HAVE___BUILTIN_FABSF inline float _CPP_fabs_capture(float __x) { return __builtin_fabsf(__x); } -#elif _GLIBCPP_HAVE_FABSF - inline float - _CPP_fabs_capture(float __x) { return fabsf(__x); } -#else - inline float - _CPP_fabs_capture(float __x) { return fabs(static_cast(__x)); } -#endif #if _GLIBCPP_HAVE_FLOORF inline float @@ -197,16 +181,8 @@ namespace _C_legacy { float pow(float, int); -#if _GLIBCPP_HAVE___BUILTIN_SINF inline float _CPP_sin_capture(float __x) { return __builtin_sinf(__x); } -#elif _GLIBCPP_HAVE_SINF - inline float - _CPP_sin_capture(float __x) { return sinf(__x); } -#else - inline float - _CPP_sin_capture(float __x) { return sin(static_cast(__x)); } -#endif #if _GLIBCPP_HAVE_SINHF inline float @@ -216,16 +192,8 @@ namespace _C_legacy { _CPP_sinh_capture(float __x) { return sinh(static_cast(__x)); } #endif -#if _GLIBCPP_HAVE___BUILTIN_SQRTF inline float _CPP_sqrt_capture(float __x) { return __builtin_sqrtf(__x); } -#elif _GLIBCPP_HAVE_SQRTF - inline float - _CPP_sqrt_capture(float __x) { return sqrtf(__x); } -#else - inline float - _CPP_sqrt_capture(float __x) { return sqrt(static_cast(__x)); } -#endif #if _GLIBCPP_HAVE_TANF inline float @@ -259,13 +227,8 @@ namespace _C_legacy { inline double _CPP_ceil_capture(double __x) { return ceil(__x); } -#if _GLIBCPP_HAVE___BUILTIN_COS inline double _CPP_cos_capture(double __x) { return __builtin_cos(__x); } -#else - inline double - _CPP_cos_capture(double __x) { return cos(__x); } -#endif inline double _CPP_cosh_capture(double __x) { return cosh(__x); } @@ -273,13 +236,8 @@ namespace _C_legacy { inline double _CPP_exp_capture(double __x) { return exp(__x); } -#if _GLIBCPP_HAVE___BUILTIN_FABS inline double _CPP_fabs_capture(double __x) { return __builtin_fabs(__x); } -#else - inline double - _CPP_fabs_capture(double __x) { return fabs(__x); } -#endif inline double _CPP_floor_capture(double __x) { return floor(__x); } @@ -305,24 +263,14 @@ namespace _C_legacy { inline double _CPP_pow_capture(double __x, double __y) { return pow(__x, __y); } -#if _GLIBCPP_HAVE___BUILTIN_SIN inline double _CPP_sin_capture(double __x) { return __builtin_sin(__x); } -#else - inline double - _CPP_sin_capture(double __x) { return sin(__x); } -#endif inline double _CPP_sinh_capture(double __x) { return sinh(__x); } -#if _GLIBCPP_HAVE___BUILTIN_SQRT inline double _CPP_sqrt_capture(double __x) { return __builtin_sqrt(__x); } -#else - inline double - _CPP_sqrt_capture(double __x) { return sqrt(__x); } -#endif inline double _CPP_tan_capture(double __x) { return tan(__x); } @@ -372,16 +320,8 @@ namespace _C_legacy { _CPP_ceil_capture(long double __x) { return ceil(static_cast(__x)); } #endif -#if _GLIBCPP_HAVE___BUILTIN_COSL inline long double _CPP_cos_capture(long double __x) { return __builtin_cosl(__x); } -#elif _GLIBCPP_HAVE_COSL - inline long double - _CPP_cos_capture(long double __x) { return cosl(__x); } -#else - inline long double - _CPP_cos_capture(long double __x) { return cos(static_cast(__x)); } -#endif #if _GLIBCPP_HAVE_COSHL inline long double @@ -399,16 +339,8 @@ namespace _C_legacy { _CPP_exp_capture(long double __x) { return exp(static_cast(__x)); } #endif -#if _GLIBCPP_HAVE___BUILTIN_FABSL inline long double _CPP_fabs_capture(long double __x) { return __builtin_fabsl(__x); } -#elif _GLIBCPP_HAVE_FABSL - inline long double - _CPP_fabs_capture(long double __x) { return fabsl(__x); } -#else - inline long double - _CPP_fabs_capture(long double __x) { return fabs(static_cast(__x)); } -#endif #if _GLIBCPP_HAVE_FLOORL inline long double @@ -489,16 +421,8 @@ namespace _C_legacy { { return pow(static_cast(__x), static_cast(__y)); } #endif -#if _GLIBCPP_HAVE___BUILTIN_SINL inline long double _CPP_sin_capture(long double __x) { return __builtin_sinl(__x); } -#elif _GLIBCPP_HAVE_SINL - inline long double - _CPP_sin_capture(long double __x) { return sinl(__x); } -#else - inline long double - _CPP_sin_capture(long double __x) { return sin(static_cast(__x)); } -#endif #if _GLIBCPP_HAVE_SINHL inline long double @@ -508,16 +432,8 @@ namespace _C_legacy { _CPP_sinh_capture(long double __x) { return sinh(static_cast(__x)); } #endif -#if _GLIBCPP_HAVE___BUILTIN_SQRTL inline long double _CPP_sqrt_capture(long double __x) { return __builtin_sqrtl(__x); } -#elif _GLIBCPP_HAVE_SQRTL - inline long double - _CPP_sqrt_capture(long double __x) { return sqrtl(__x); } -#else - inline long double - _CPP_sqrt_capture(long double __x) { return sqrt(static_cast(__x)); } -#endif #if _GLIBCPP_HAVE_TANL inline long double diff --git a/libstdc++-v3/libmath/stubs.c b/libstdc++-v3/libmath/stubs.c index 203feeed82c..586fd6db80e 100644 --- a/libstdc++-v3/libmath/stubs.c +++ b/libstdc++-v3/libmath/stubs.c @@ -1,6 +1,6 @@ /* Stub definitions for libmath subpart of libstdc++. */ -/* Copyright (C) 2001 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU ISO C++ Library. This library is free software; you can redistribute it and/or modify it under the @@ -51,7 +51,7 @@ atan2l(long double x, long double y) #endif -#if !defined(HAVE_COSF) && !defined(HAVE___BUILTIN_COSF) +#ifndef HAVE_COSF float cosf(float x) { @@ -186,7 +186,7 @@ powl(long double x, long double y) #endif -#if !defined(HAVE_SINF) && !defined(HAVE___BUILTIN_SINF) +#ifndef HAVE_SINF float sinf(float x) {