diff options
author | Jason Merrill <jason@gcc.gnu.org> | 1997-09-28 15:21:52 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1997-09-28 15:21:52 -0400 |
commit | 905a881f36b6aea9113a3b369e36e85033bbea84 (patch) | |
tree | 7aef137939c350e874afb60ab37aff07275f8500 /libstdc++/std | |
parent | 920253a3bc1649fb4a0f5f5f48e57d92d4839190 (diff) | |
download | gcc-905a881f36b6aea9113a3b369e36e85033bbea84.zip gcc-905a881f36b6aea9113a3b369e36e85033bbea84.tar.gz gcc-905a881f36b6aea9113a3b369e36e85033bbea84.tar.bz2 |
[multiple changes]
Sat Sep 27 16:48:00 1997 Jason Merrill <jason@yorick.cygnus.com>
* std/complext.h: Lose injection decls.
* std/fcomplex.h: Likewise.
* std/dcomplex.h: Likewise.
* std/ldcomplex.h: Likewise.
Sat Sep 27 16:47:35 1997 Mark Mitchell <mmitchell@usa.net>
* std/complext.h: Declare templates before making them
friends. Use new friend <> syntax.
* std/complext.cc: Don't rely on guiding declarations.
* std/fcomplex.h: Use new friend <> syntax.
* std/dcomplex.h: Likewise.
* std/ldcomplex.h: Likewise.
From-SVN: r15776
Diffstat (limited to 'libstdc++/std')
-rw-r--r-- | libstdc++/std/complext.cc | 2 | ||||
-rw-r--r-- | libstdc++/std/complext.h | 51 | ||||
-rw-r--r-- | libstdc++/std/dcomplex.h | 38 | ||||
-rw-r--r-- | libstdc++/std/fcomplex.h | 38 | ||||
-rw-r--r-- | libstdc++/std/ldcomplex.h | 38 |
5 files changed, 27 insertions, 140 deletions
diff --git a/libstdc++/std/complext.cc b/libstdc++/std/complext.cc index d50bf08..60227f2 100644 --- a/libstdc++/std/complext.cc +++ b/libstdc++/std/complext.cc @@ -236,7 +236,7 @@ pow (const complex<FLOAT>& xin, int y) if (y < 0) { y = -y; - x = 1/x; + x = FLOAT(1)/x; } for (;;) { diff --git a/libstdc++/std/complext.h b/libstdc++/std/complext.h index 57976f0..6c55037 100644 --- a/libstdc++/std/complext.h +++ b/libstdc++/std/complext.h @@ -41,6 +41,16 @@ class istream; class ostream; extern "C++" { +template <class _FLT> class complex; +template <class _FLT> complex<_FLT>& + __doapl (complex<_FLT>* ths, const complex<_FLT>& r); +template <class _FLT> complex<_FLT>& + __doami (complex<_FLT>* ths, const complex<_FLT>& r); +template <class _FLT> complex<_FLT>& + __doaml (complex<_FLT>* ths, const complex<_FLT>& r); +template <class _FLT> complex<_FLT>& + __doadv (complex<_FLT>* ths, const complex<_FLT>& r); + template <class _FLT> class complex { @@ -55,40 +65,10 @@ public: private: _FLT re, im; - friend complex& __doapl (complex *, const complex&); - friend complex& __doami (complex *, const complex&); - friend complex& __doaml (complex *, const complex&); - friend complex& __doadv (complex *, const complex&); - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend _FLT real (const complex&) __attribute__ ((const)); - friend _FLT imag (const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, _FLT) __attribute__ ((const)); - friend complex operator + (_FLT, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, _FLT) __attribute__ ((const)); - friend complex operator - (_FLT, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, _FLT) __attribute__ ((const)); - friend complex operator * (_FLT, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, _FLT) __attribute__ ((const)); - friend complex operator / (_FLT, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, _FLT) __attribute__ ((const)); - friend bool operator == (_FLT, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, _FLT) __attribute__ ((const)); - friend bool operator != (_FLT, const complex&) __attribute__ ((const)); - friend complex polar (_FLT, _FLT) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, _FLT) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (_FLT, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); + friend complex& __doapl<> (complex *, const complex&); + friend complex& __doami<> (complex *, const complex&); + friend complex& __doaml<> (complex *, const complex&); + friend complex& __doadv<> (complex *, const complex&); }; // Declare specializations. @@ -142,9 +122,6 @@ complex<_FLT>::operator *= (const complex<_FLT>& r) return __doaml (this, r); } -template <class _FLT> complex<_FLT>& - __doadv (complex<_FLT>* ths, const complex<_FLT>& r); - template <class _FLT> inline complex<_FLT>& complex<_FLT>::operator /= (const complex<_FLT>& r) diff --git a/libstdc++/std/dcomplex.h b/libstdc++/std/dcomplex.h index fde3f09..5bc329c 100644 --- a/libstdc++/std/dcomplex.h +++ b/libstdc++/std/dcomplex.h @@ -50,40 +50,10 @@ public: private: double re, im; - friend complex& __doapl (complex *, const complex&); - friend complex& __doami (complex *, const complex&); - friend complex& __doaml (complex *, const complex&); - friend complex& __doadv (complex *, const complex&); - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend double real (const complex& x) { return x.real (); } - friend double imag (const complex& x) { return x.imag (); } - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, double) __attribute__ ((const)); - friend complex operator + (double, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, double) __attribute__ ((const)); - friend complex operator - (double, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, double) __attribute__ ((const)); - friend complex operator * (double, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, double) __attribute__ ((const)); - friend complex operator / (double, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, double) __attribute__ ((const)); - friend bool operator == (double, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, double) __attribute__ ((const)); - friend bool operator != (double, const complex&) __attribute__ ((const)); - friend complex polar (double, double) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, double) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (double, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); + friend complex& __doapl<> (complex *, const complex&); + friend complex& __doami<> (complex *, const complex&); + friend complex& __doaml<> (complex *, const complex&); + friend complex& __doadv<> (complex *, const complex&); }; inline complex<float>::complex (const complex<double>& r) diff --git a/libstdc++/std/fcomplex.h b/libstdc++/std/fcomplex.h index 3a389e0..476c4b6 100644 --- a/libstdc++/std/fcomplex.h +++ b/libstdc++/std/fcomplex.h @@ -50,40 +50,10 @@ public: private: float re, im; - friend complex& __doapl (complex *, const complex&); - friend complex& __doami (complex *, const complex&); - friend complex& __doaml (complex *, const complex&); - friend complex& __doadv (complex *, const complex&); - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend float real (const complex& x) { return x.real (); } - friend float imag (const complex& x) { return x.imag (); } - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, float) __attribute__ ((const)); - friend complex operator + (float, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, float) __attribute__ ((const)); - friend complex operator - (float, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, float) __attribute__ ((const)); - friend complex operator * (float, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, float) __attribute__ ((const)); - friend complex operator / (float, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, float) __attribute__ ((const)); - friend bool operator == (float, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, float) __attribute__ ((const)); - friend bool operator != (float, const complex&) __attribute__ ((const)); - friend complex polar (float, float) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, float) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (float, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); + friend complex& __doapl<> (complex *, const complex&); + friend complex& __doami<> (complex *, const complex&); + friend complex& __doaml<> (complex *, const complex&); + friend complex& __doadv<> (complex *, const complex&); }; } // extern "C++" diff --git a/libstdc++/std/ldcomplex.h b/libstdc++/std/ldcomplex.h index 9feb303..dd5cfa3 100644 --- a/libstdc++/std/ldcomplex.h +++ b/libstdc++/std/ldcomplex.h @@ -50,40 +50,10 @@ public: private: long double re, im; - friend complex& __doapl (complex *, const complex&); - friend complex& __doami (complex *, const complex&); - friend complex& __doaml (complex *, const complex&); - friend complex& __doadv (complex *, const complex&); - - // These functions are specified as friends for purposes of name injection; - // they do not actually reference private members. - friend long double real (const complex& x) { return x.real (); } - friend long double imag (const complex& x) { return x.imag (); } - friend complex operator + (const complex&, const complex&) __attribute__ ((const)); - friend complex operator + (const complex&, long double) __attribute__ ((const)); - friend complex operator + (long double, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, const complex&) __attribute__ ((const)); - friend complex operator - (const complex&, long double) __attribute__ ((const)); - friend complex operator - (long double, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, const complex&) __attribute__ ((const)); - friend complex operator * (const complex&, long double) __attribute__ ((const)); - friend complex operator * (long double, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, const complex&) __attribute__ ((const)); - friend complex operator / (const complex&, long double) __attribute__ ((const)); - friend complex operator / (long double, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, const complex&) __attribute__ ((const)); - friend bool operator == (const complex&, long double) __attribute__ ((const)); - friend bool operator == (long double, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, const complex&) __attribute__ ((const)); - friend bool operator != (const complex&, long double) __attribute__ ((const)); - friend bool operator != (long double, const complex&) __attribute__ ((const)); - friend complex polar (long double, long double) __attribute__ ((const)); - friend complex pow (const complex&, const complex&) __attribute__ ((const)); - friend complex pow (const complex&, long double) __attribute__ ((const)); - friend complex pow (const complex&, int) __attribute__ ((const)); - friend complex pow (long double, const complex&) __attribute__ ((const)); - friend istream& operator>> (istream&, complex&); - friend ostream& operator<< (ostream&, const complex&); + friend complex& __doapl<> (complex *, const complex&); + friend complex& __doami<> (complex *, const complex&); + friend complex& __doaml<> (complex *, const complex&); + friend complex& __doadv<> (complex *, const complex&); }; inline complex<float>::complex (const complex<long double>& r) |