diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-09-28 19:21:52 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-09-28 19:21:52 +0000 |
commit | 597fe38f703719d06c59863b9cab3bb3886694d2 (patch) | |
tree | 7aef137939c350e874afb60ab37aff07275f8500 /libstdc++/std | |
parent | 21e1e45b03cbacee04f7305e09cd61dafbba3cdd (diff) | |
download | gcc-597fe38f703719d06c59863b9cab3bb3886694d2.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@15776 138bc75d-0d04-0410-961f-82ee72b054a4
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 d50bf0871f6..60227f21329 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 57976f002ce..6c55037bf94 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 fde3f09ca5c..5bc329c9bc9 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 3a389e08a76..476c4b60d80 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 9feb30326bd..dd5cfa3fc39 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) |