Some shadow fixes.

Steven King sxking@uswest.net
Thu May 18 13:18:00 GMT 2000


This patch fixes some typos that prevent compilation and adds some required
symbols. Additionally, I've restructured the way cmath exposes the double
precision routines, using a inline forwarding function instead of a using
directive makes for better looking error messages.  I'm somewhat of the opinion
that all of the shadowed functions should be done this way.

2000-05-18 Steven King <sxking@uswest.net>

 	* shadow/math.h: Add ::abs(float), ::abs(double) as inline forwarding
	call to std::abs(float), std::abs(double);
 	* shadow/stdlib.h: Replace using directive with inline forwarding call
	so that math.h and stdlib.h may be included in any order.
	* shadow/time.h: Fix typo
	* shadow/wchar.h: Protect wcsdup  with ifdef __USE_GNU
	* shadow/bits/std_cassert.h: Add namespace definitions
	* shadow/bits/std_cmath.h: Add required definitions for float.  Replace
	using directives with inline forwarding functions for double.
	* shadow/bits/std_cstdlib.h: Inline exit.  Fix typos in div, ldiv. Add
	definition for overloaded abs(long) and div(long).  Comment out using
	directive for abs.
	* shadow/bits/std_ctime.h: Add using directives for ctime, clock,
	difftime, mktime, time.
	* shadow/bits/std_cwchar.h: Protect wcsdup with ifdef __USE_GNU.

Index: math.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/math.h,v
retrieving revision 1.1
diff -r1.1 math.h
37a38,42
> 
>   //we cant use using ::std::abs; here
>   inline float abs (float __x) { return std::abs (__x); }
>   inline double abs (double __x) { return std::abs (__x); }
> 
Index: stdlib.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/stdlib.h,v
retrieving revision 1.1
diff -r1.1 stdlib.h
60c60,64
<   using ::std::abs;
---
>  
>   // we cant use ::std::abs; here
>   inline int abs(int __x) { return std::abs (__x); }
>   inline long abs(long __x) { return std::abs (__x); }
> 
Index: time.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/time.h,v
retrieving revision 1.1
diff -r1.1 time.h
36c36
< #undef __need_timespec))
---
> #undef __need_timespec
Index: wchar.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/wchar.h,v
retrieving revision 1.1
diff -r1.1 wchar.h
68a69
> # ifdef __USE_GNU
69a71
> # endif
Index: bits/std_cassert.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/bits/std_cassert.h,v
retrieving revision 1.2
diff -r1.2 std_cassert.h
39,42c39,45
< extern "C" {
< # pragma system_header
< # include_next <assert.h>
< }
---
>   namespace _C_Swamp {
> 	 extern "C" {
> #     pragma system_header
> #     include_next <assert.h>
>     }
>     namespace _C_Shadow { }
>   } // close namespace ::_C_Swamp::
Index: bits/std_cmath.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/bits/std_cmath.h,v
retrieving revision 1.2
diff -r1.2 std_cmath.h
103,147d102
<       inline double acos(double __x)
<         { return ::_C_Swamp::_CPP_acos_capture(__x); }
<       inline double asin(double __x)
<         { return ::_C_Swamp::_CPP_asin_capture(__x); }
<       inline double atan(double __x)
<         { return ::_C_Swamp::_CPP_atan_capture(__x); }
<       inline double atan2(double __y, double __x)
<       	{ return ::_C_Swamp::_CPP_atan2_capture(__y,__x); }
<       inline double cos(double __x)
<         { return ::_C_Swamp::_CPP_cos_capture(__x); }
<       inline double sin(double __x)
<         { return ::_C_Swamp::_CPP_sin_capture(__x); }
<       inline double tan(double __x)
<         { return ::_C_Swamp::_CPP_tan_capture(__x); }
<       inline double cosh(double __x)
<         { return ::_C_Swamp::_CPP_cosh_capture(__x); }
<       inline double sinh(double __x)
<         { return ::_C_Swamp::_CPP_sinh_capture(__x); }
<       inline double tanh(double __x)
<         { return ::_C_Swamp::_CPP_tanh_capture(__x); }
<       inline double exp(double __x)
<         { return ::_C_Swamp::_CPP_exp_capture(__x); }
<       inline double frexp(double __x, int* __exp)
<       	{ return ::_C_Swamp::_CPP_frexp_capture(__x, __exp); }
<       inline double ldexp(double __x, int __exp)
<       	{ return ::_C_Swamp::_CPP_ldexp_capture(__x, __exp); }
<       inline double log(double __x)
<         { return ::_C_Swamp::_CPP_log_capture(__x); }
<       inline double log10(double __x)
<         { return ::_C_Swamp::_CPP_log10_capture(__x); }
<       inline double modf(double __x, double* __iptr)
<       	{ return ::_C_Swamp::_CPP_modf_capture(__x, __iptr); }
<       inline double pow(double __x, double __y)
<       	{ return ::_C_Swamp::_CPP_pow_capture(__x, __y); }
<       inline double sqrt(double __x)
<         { return ::_C_Swamp::_CPP_sqrt_capture(__x); }
<       inline double ceil(double __x)
<         { return ::_C_Swamp::_CPP_ceil_capture(__x); }
<       inline double fabs(double __x)
<         { return ::_C_Swamp::_CPP_fabs_capture(__x); }
<       inline double floor(double __x)
<         { return ::_C_Swamp::_CPP_floor_capture(__x); }
<       inline double fmod(double __x, double __y)
<       	{ return ::_C_Swamp::_CPP_fmod_capture(__x, __y); }
< 
153,174c108,214
<     using ::_C_Swamp::_C_Shadow::acos;
<     using ::_C_Swamp::_C_Shadow::asin;
<     using ::_C_Swamp::_C_Shadow::atan;
<     using ::_C_Swamp::_C_Shadow::atan2;
<     using ::_C_Swamp::_C_Shadow::cos;
<     using ::_C_Swamp::_C_Shadow::sin;
<     using ::_C_Swamp::_C_Shadow::tan;
<     using ::_C_Swamp::_C_Shadow::cosh;
<     using ::_C_Swamp::_C_Shadow::sinh;
<     using ::_C_Swamp::_C_Shadow::tanh;
<     using ::_C_Swamp::_C_Shadow::exp;
<     using ::_C_Swamp::_C_Shadow::frexp;
<     using ::_C_Swamp::_C_Shadow::ldexp;
<     using ::_C_Swamp::_C_Shadow::log;
<     using ::_C_Swamp::_C_Shadow::log10;
<     using ::_C_Swamp::_C_Shadow::modf;
<     using ::_C_Swamp::_C_Shadow::pow;
<     using ::_C_Swamp::_C_Shadow::sqrt;
<     using ::_C_Swamp::_C_Shadow::ceil;
<     using ::_C_Swamp::_C_Shadow::fabs;
<     using ::_C_Swamp::_C_Shadow::floor;
<     using ::_C_Swamp::_C_Shadow::fmod;
---
> 
>     inline double abs (double __x)
>       { return ::_C_Swamp::_CPP_fabs_capture (__x); }
>     inline double acos(double __x)
>       { return ::_C_Swamp::_CPP_acos_capture(__x); }
>     inline double asin(double __x)
>       { return ::_C_Swamp::_CPP_asin_capture(__x); }
>     inline double atan(double __x)
>       { return ::_C_Swamp::_CPP_atan_capture(__x); }
>     inline double atan2(double __y, double __x)
>       { return ::_C_Swamp::_CPP_atan2_capture(__y,__x); }
>     inline double ceil(double __x)
>       { return ::_C_Swamp::_CPP_ceil_capture(__x); }
>     inline double cos(double __x)
>       { return ::_C_Swamp::_CPP_cos_capture(__x); }
>     inline double cosh(double __x)
>       { return ::_C_Swamp::_CPP_cosh_capture(__x); }
>     inline double exp(double __x)
>       { return ::_C_Swamp::_CPP_exp_capture(__x); }
>     inline double fabs(double __x)
>       { return ::_C_Swamp::_CPP_fabs_capture(__x); }
>     inline double floor(double __x)
>       { return ::_C_Swamp::_CPP_floor_capture(__x); }
>     inline double fmod(double __x, double __y)
>       { return ::_C_Swamp::_CPP_fmod_capture(__x, __y); }
>     inline double frexp(double __x, int* __exp)
>       { return ::_C_Swamp::_CPP_frexp_capture(__x, __exp); }
>     inline double ldexp(double __x, int __exp)
>       { return ::_C_Swamp::_CPP_ldexp_capture(__x, __exp); }
>     inline double log(double __x)
>       { return ::_C_Swamp::_CPP_log_capture(__x); }
>     inline double log10(double __x)
>       { return ::_C_Swamp::_CPP_log10_capture(__x); }
>     inline double modf(double __x, double* __iptr)
>       { return ::_C_Swamp::_CPP_modf_capture(__x, __iptr); }
>     inline double pow(double __x, double __y)
>       { return ::_C_Swamp::_CPP_pow_capture(__x, __y); }
> 
>     // XXX 
>     inline double pow (double, int);
> 
>     inline double sin(double __x)
>       { return ::_C_Swamp::_CPP_sin_capture(__x); }
>     inline double sqrt(double __x)
>       { return ::_C_Swamp::_CPP_sqrt_capture(__x); }
>     inline double sinh(double __x)
>       { return ::_C_Swamp::_CPP_sinh_capture(__x); }
>     inline double tan(double __x)
>       { return ::_C_Swamp::_CPP_tan_capture(__x); }
>     inline double tanh(double __x)
>       { return ::_C_Swamp::_CPP_tanh_capture(__x); }
>     
>     // float -- suboptimally uses the double precision routines
>     //
>     inline float abs (float __x)
>       { return fabs (static_cast<double>(__x)); }
>     inline float acos (float __x)
>       { return acos (static_cast<double>(__x)); }
>     inline float asin (float __x)
>       { return asin (static_cast<double>(__x)); }
>     inline float atan (float __x)
>       { return atan (static_cast<double>(__x)); }
>     inline float atan2 (float __x, float __y)
>       { return atan2 (static_cast<double>(__x), static_cast<double>(__y)); }
>     inline float ceil (float __x)
>       { return ceil (static_cast<double>(__x)); }
>     inline float cos (float __x)
>       { return cos (static_cast<double>(__x)); }
>     inline float cosh (float __x)
>       { return cosh (static_cast<double>(__x)); }
>     inline float exp (float __x)
>       { return exp (static_cast<double>(__x)); }
>     inline float fabs (float __x)
>       { return fabs (static_cast<double>(__x)); }
>     inline float floor(float __x)
>       { return floor (static_cast<double>(__x)); }
>     inline float fmod (float __x, float __y)
>       { return fmod (static_cast<double>(__x), static_cast<double>(__y)); }
>     inline float frexp (float __x, int* __exp)
>       { return frexp (static_cast<double>(__x), __exp); }
>     inline float ldexp (float __x, int __exp)
>       { return ldexp (static_cast<double>(__x), __exp); }
>     inline float log (float __x)
>       { return log (static_cast<double>(__x)); }
>     inline float log10 (float __x)
>       { return log10 (static_cast<double>(__x)); }
>     inline float modf (float __x, float* __iptr)
>       {
>          double __tmp;
>          double __res = modf (static_cast<double>(__x), &__tmp);
>          *__iptr = static_cast<float> (__tmp);
>          return __res;
>       }
>     inline float pow (float __x, float __y)
>       { return pow (__x, __y); }
>     inline float pow (float __x, int __y)
>       { return pow (static_cast<double>(__x), __y); }
>     inline float sin (float __x)
>       { return sin (static_cast<double>(__x)); }
>     inline float sinh (float __x)
>       { return sinh (static_cast<double>(__x)); }
>     inline float sqrt (float __x)
>       { return sqrt (static_cast<double>(__x)); }
>     inline float tan (float __x)
>       { return tan (static_cast<double>(__x)); }
>     inline float tanh (float __x)
>       { return tanh (static_cast<double>(__x)); }
179a220,242
>        // using ::std::abs;
>        using ::std::acos;
>        using ::std::asin;
>        using ::std::atan;
>        using ::std::atan2;
>        using ::std::cos;
>        using ::std::sin;
>        using ::std::tan;
>        using ::std::cosh;
>        using ::std::sinh;
>        using ::std::tanh;
>        using ::std::exp;
>        using ::std::frexp;
>        using ::std::ldexp;
>        using ::std::log;
>        using ::std::log10;
>        using ::std::modf;
>        using ::std::pow;
>        using ::std::sqrt;
>        using ::std::ceil;
>        using ::std::fabs;
>        using ::std::floor;
>        using ::std::fmod;
Index: bits/std_cstdlib.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/bits/std_cstdlib.h,v
retrieving revision 1.2
diff -r1.2 std_cstdlib.h
158c158
<     void exit(int __i)   // XXX must define correctly for C++, like atexit().
---
>     inline void exit(int __i)   // XXX must define correctly for C++, like atexit().
172c172
< 		  size_t __size, int (*__cmp)(const void*, const void*))
---
>       size_t __size, int (*__cmp)(const void*, const void*))
180c180
< 	              int (*__cmp)(const void*, const void*)) 
---
>                int (*__cmp)(const void*, const void*)) 
188c188
<       { _div_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
---
>       { div_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
191,192c191,196
<     inline ldiv_t ldiv(long __num, long __den)
<       { _ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
---
>     inline ldiv_t ldiv(long __n, long __d)
>       { ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
>     inline long abs(long __x)
>       { return __x >= 0 ? __x : -__x; }
>     inline ldiv_t div(long __n, long __d)
>       { ldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
212c216
<       using ::std::abs;
---
>       // using ::std::abs;
Index: bits/std_ctime.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/bits/std_ctime.h,v
retrieving revision 1.2
diff -r1.2 std_ctime.h
121a122,126
>       using ::std::ctime;
>       using ::std::clock;
>       using ::std::difftime;
>       using ::std::mktime;
>       using ::std::time;
Index: bits/std_cwchar.h
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/shadow/bits/std_cwchar.h,v
retrieving revision 1.2
diff -r1.2 std_cwchar.h
101a102
> #ifdef __USE_GNU
102a104
> #endif
215a218
> #ifdef __USE_GNU
216a220
> #endif


More information about the Libstdc++ mailing list