Commit 89b78169 by Gabriel Dos Reis Committed by Gabriel Dos Reis

std_cwctype.h: #undef possible function-like macro definitions of iswxxx functions...

	* include/c/bits/std_cwctype.h: #undef possible function-like
	macro definitions of iswxxx functions, which might be brought in
	by <wctype.h>.  Those macro definitions prevent build on some
	linux-based systems.

	* include/bits/std_complex.h (complex<>): Comment out friend
	declarations of abs<> specializations.
	(abs): Define primary template.

	* src/complex.cc (abs): Comment out specialization definition.

From-SVN: r37157
parent 8bb16620
2000-10-31 Gabriel Dos Reis <gdr@codesourcery.com>
* include/c/bits/std_cwctype.h: #undef possible function-like
macro definitions of iswxxx functions, which might be brought in
by <wctype.h>. Those macro definitions prevent build on some
linux-based systems.
* include/bits/std_complex.h (complex<>): Comment out friend
declarations of abs<> specializations.
(abs): Define primary template.
* src/complex.cc (abs): Comment out specialization definition.
2000-10-30 Phil Edwards <pme@sources.redhat.com> 2000-10-30 Phil Edwards <pme@sources.redhat.com>
* acinclude.m4 (GLIBCPP_ENABLE_DEBUG): Raise debugging level from * acinclude.m4 (GLIBCPP_ENABLE_DEBUG): Raise debugging level from
......
...@@ -176,7 +176,7 @@ namespace std ...@@ -176,7 +176,7 @@ namespace std
friend class complex<double>; friend class complex<double>;
friend class complex<long double>; friend class complex<long double>;
friend float abs<>(const complex<float>&); // friend float abs<>(const complex<float>&);
friend float arg<>(const complex<float>&); friend float arg<>(const complex<float>&);
friend complex<float> conj<>(const complex<float>&); friend complex<float> conj<>(const complex<float>&);
...@@ -253,7 +253,7 @@ namespace std ...@@ -253,7 +253,7 @@ namespace std
friend class complex<float>; friend class complex<float>;
friend class complex<long double>; friend class complex<long double>;
friend double abs<>(const complex<double>&); // friend double abs<>(const complex<double>&);
friend double arg<>(const complex<double>&); friend double arg<>(const complex<double>&);
friend complex<double> conj<>(const complex<double>&); friend complex<double> conj<>(const complex<double>&);
...@@ -330,7 +330,7 @@ namespace std ...@@ -330,7 +330,7 @@ namespace std
friend class complex<float>; friend class complex<float>;
friend class complex<double>; friend class complex<double>;
friend long double abs<>(const complex<long double>&); // friend long double abs<>(const complex<long double>&);
friend long double arg<>(const complex<long double>&); friend long double arg<>(const complex<long double>&);
friend complex<long double> conj<>(const complex<long double>&); friend complex<long double> conj<>(const complex<long double>&);
...@@ -928,6 +928,19 @@ namespace std ...@@ -928,6 +928,19 @@ namespace std
imag(const complex<_Tp>& __z) imag(const complex<_Tp>& __z)
{ return __z.imag(); } { return __z.imag(); }
template<typename _Tp>
inline _Tp
abs(const complex<_Tp>& __z)
{
_Tp __x = __z.real();
_Tp __y = __z.imag();
_Tp __s = abs(__x) + abs(__y);
if (__s == _Tp()) // well ...
return __s;
__x /= __s; __y /= __s;
return __s * sqrt(__x * __x + __y * __y);
}
// We use here a few more specializations. // We use here a few more specializations.
template<> template<>
...@@ -955,7 +968,3 @@ namespace std ...@@ -955,7 +968,3 @@ namespace std
} // namespace std } // namespace std
#endif /* _CPP_COMPLEX */ #endif /* _CPP_COMPLEX */
...@@ -44,6 +44,22 @@ namespace std ...@@ -44,6 +44,22 @@ namespace std
using ::wctype_t; using ::wctype_t;
using ::wctrans_t; using ::wctrans_t;
// Get rid of those macros defined in <wctype.h> in lieu of real functions.
#undef iswalnum
#undef iswalpha
#undef iswblank
#undef iswcntrl
#undef iswdigit
#undef iswgraph
#undef iswlower
#undef iswprint
#undef iswprint
#undef iswpunct
#undef iswspace
#undef iswupper
#undef iswxdigit
#undef iswctype
extern "C" int iswalnum(wint_t); extern "C" int iswalnum(wint_t);
extern "C" int iswalpha(wint_t); extern "C" int iswalpha(wint_t);
extern "C" int iswblank(wint_t); extern "C" int iswblank(wint_t);
......
...@@ -45,14 +45,14 @@ ...@@ -45,14 +45,14 @@
namespace std namespace std
{ {
template<> // template<>
FLT // FLT
abs(const complex<FLT>& __x) // abs(const complex<FLT>& __x)
{ // {
// We don't use cabs here because some systems (IRIX 6.5, for // // We don't use cabs here because some systems (IRIX 6.5, for
// example) define their own incompatible version. // // example) define their own incompatible version.
return hypot (__real__ __x._M_value, __imag__ __x._M_value); // return hypot (__real__ __x._M_value, __imag__ __x._M_value);
} // }
template<> template<>
FLT FLT
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment