From 89b781699385e3f537dde0360472805f42cef916 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Tue, 31 Oct 2000 14:40:27 +0000 Subject: [PATCH] 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 . 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 --- libstdc++-v3/ChangeLog | 13 +++++++++++++ libstdc++-v3/include/bits/std_complex.h | 23 ++++++++++++++++------- libstdc++-v3/include/c/bits/std_cwctype.h | 16 ++++++++++++++++ libstdc++-v3/src/complex.cc | 16 ++++++++-------- 4 files changed, 53 insertions(+), 15 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index fde5cdb1cdd..416204166e0 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2000-10-31 Gabriel Dos Reis + + * include/c/bits/std_cwctype.h: #undef possible function-like + macro definitions of iswxxx functions, which might be brought in + by . 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 * acinclude.m4 (GLIBCPP_ENABLE_DEBUG): Raise debugging level from diff --git a/libstdc++-v3/include/bits/std_complex.h b/libstdc++-v3/include/bits/std_complex.h index 63f735181da..056b12076f4 100644 --- a/libstdc++-v3/include/bits/std_complex.h +++ b/libstdc++-v3/include/bits/std_complex.h @@ -176,7 +176,7 @@ namespace std friend class complex; friend class complex; - friend float abs<>(const complex&); + // friend float abs<>(const complex&); friend float arg<>(const complex&); friend complex conj<>(const complex&); @@ -253,7 +253,7 @@ namespace std friend class complex; friend class complex; - friend double abs<>(const complex&); + // friend double abs<>(const complex&); friend double arg<>(const complex&); friend complex conj<>(const complex&); @@ -330,7 +330,7 @@ namespace std friend class complex; friend class complex; - friend long double abs<>(const complex&); + // friend long double abs<>(const complex&); friend long double arg<>(const complex&); friend complex conj<>(const complex&); @@ -927,6 +927,19 @@ namespace std inline _Tp imag(const complex<_Tp>& __z) { return __z.imag(); } + + template + 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. @@ -955,7 +968,3 @@ namespace std } // namespace std #endif /* _CPP_COMPLEX */ - - - - diff --git a/libstdc++-v3/include/c/bits/std_cwctype.h b/libstdc++-v3/include/c/bits/std_cwctype.h index 5757c14b16b..9a6a8914e70 100644 --- a/libstdc++-v3/include/c/bits/std_cwctype.h +++ b/libstdc++-v3/include/c/bits/std_cwctype.h @@ -44,6 +44,22 @@ namespace std using ::wctype_t; using ::wctrans_t; + // Get rid of those macros defined in 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 iswalpha(wint_t); extern "C" int iswblank(wint_t); diff --git a/libstdc++-v3/src/complex.cc b/libstdc++-v3/src/complex.cc index 6af7ce06365..2f7cfc48a60 100644 --- a/libstdc++-v3/src/complex.cc +++ b/libstdc++-v3/src/complex.cc @@ -45,14 +45,14 @@ namespace std { - template<> - FLT - abs(const complex& __x) - { - // We don't use cabs here because some systems (IRIX 6.5, for - // example) define their own incompatible version. - return hypot (__real__ __x._M_value, __imag__ __x._M_value); - } +// template<> +// FLT +// abs(const complex& __x) +// { +// // We don't use cabs here because some systems (IRIX 6.5, for +// // example) define their own incompatible version. +// return hypot (__real__ __x._M_value, __imag__ __x._M_value); +// } template<> FLT -- 2.30.2