aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1997-09-28 19:21:52 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1997-09-28 19:21:52 +0000
commit597fe38f703719d06c59863b9cab3bb3886694d2 (patch)
tree7aef137939c350e874afb60ab37aff07275f8500
parent21e1e45b03cbacee04f7305e09cd61dafbba3cdd (diff)
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
-rw-r--r--libstdc++/ChangeLog16
-rw-r--r--libstdc++/std/complext.cc2
-rw-r--r--libstdc++/std/complext.h51
-rw-r--r--libstdc++/std/dcomplex.h38
-rw-r--r--libstdc++/std/fcomplex.h38
-rw-r--r--libstdc++/std/ldcomplex.h38
-rw-r--r--libstdc++/tests/tstring.exp2
7 files changed, 45 insertions, 140 deletions
diff --git a/libstdc++/ChangeLog b/libstdc++/ChangeLog
index b4bb2bb36bb..94a3460f806 100644
--- a/libstdc++/ChangeLog
+++ b/libstdc++/ChangeLog
@@ -1,3 +1,19 @@
+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.
+
Thu Sep 25 19:55:56 1997 Jason Merrill <jason@yorick.cygnus.com>
* std/bastring.h: Enable exceptions.
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)
diff --git a/libstdc++/tests/tstring.exp b/libstdc++/tests/tstring.exp
index 3333ab1231d..4526279b888 100644
--- a/libstdc++/tests/tstring.exp
+++ b/libstdc++/tests/tstring.exp
@@ -5,6 +5,7 @@ A string initialized to (previous string, 1, 2):el
A string initialized to @:@
A string initialized to 20:20
n = 20 atoi(n) = 20 atof(n) = 20
+is = Hello
z = x + y = Helloworld
x += y; x = Helloworld
y.insert (0, x); y = Helloworld
@@ -15,6 +16,7 @@ ch = x[0] = H
z = x.substr (2, 3) = llo
x.replace (2, 2, r); x = Hero
x.replace (0, 1, 'j'); x = jello
+x = jeHelloo
enter a word:word =abcdefghijklmnopqrstuvwxyz length = 26
End of test