summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@gcc.gnu.org>1998-02-08 16:13:33 -0700
committerJeff Law <law@gcc.gnu.org>1998-02-08 16:13:33 -0700
commit1cf6e81ebd3c7becc1ebca1f1cbad3b43c92821d (patch)
tree2441f7e1d96e16ede7b133ad0c518f8214150782
parent22be4064414c9b24cfd5e53cb1e7f8f8da3758af (diff)
downloadgcc-1cf6e81ebd3c7becc1ebca1f1cbad3b43c92821d.tar.gz
Bring egcs-1.0.2's libstdc++ up to libstdc++ 2.8.0.
From-SVN: r17789
-rw-r--r--libstdc++/ChangeLog41
-rw-r--r--libstdc++/Makefile.in19
-rw-r--r--libstdc++/configure.in6
-rw-r--r--libstdc++/std/bastring.cc219
-rw-r--r--libstdc++/std/bastring.h169
-rw-r--r--libstdc++/stlinst.cc9
-rw-r--r--libstdc++/testsuite/ChangeLog5
-rw-r--r--libstdc++/testsuite/lib/libstdc++.exp17
8 files changed, 287 insertions, 198 deletions
diff --git a/libstdc++/ChangeLog b/libstdc++/ChangeLog
index d0ac79481c8..cc0872b0277 100644
--- a/libstdc++/ChangeLog
+++ b/libstdc++/ChangeLog
@@ -3,10 +3,51 @@ Mon Feb 9 00:09:16 1998 Jason Merrill <jason@yorick.cygnus.com>
* Makefile.in (install): Remove the shared library symlink even if
we aren't installing it.
+1998-01-05 Brendan Kehoe <brendan@lisa.cygnus.com>
+
+ * std/bastring.cc (basic_string::Rep::operator delete): Don't claim
+ to return from deallocate, since this is a void method.
+
+Sat Jan 3 12:15:41 1998 Franz Sirl <franz.sirl-kernel@lauterbach.com>
+
+ * configure.in: Finalize support for {alpha|powerpc}*-*-linux-gnulibc1
+
+Sun Dec 7 02:34:40 1997 Jody Goldberg <jodyg@idt.net>
+
+ * libstdc++/std/bastring.h : Move closer to the draft standard
+ implementation of basic_string by adding 3 paramter 'Allocator'.
+ NOTE: this still differs from the standard in not offering per
+ instance allocators.
+ * libstdc++/std/bastring.cc : Likewise.
+ * libstdc++/stlinst.cc : Handle thread safe allocators if they are the
+ default.
+
+Sun Dec 7 02:32:20 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * iosfwd: New header.
+ * Makefile.in (HEADERS): Add it.
+
+Sun Dec 7 02:32:20 1997 Gregory L. Galloway (gregg@eoeml.gtri.gatech.edu)
+
+ * Makefile.in (HEADERS): Modified list of headers to
+ install to include all of SGI STL headers especially hash_set and
+ hash_map, and added ANSI C++ style wrappers for fstream, iomanip,
+ iostream, and strstream.
+
+ * fstream, iomanip, iostream, strstream: New forwarding headers
+ added.
+
Thu Nov 27 01:33:55 1997 Jeffrey A Law (law@cygnus.com)
* Makefile.in (install): Change gxx_includedir to gxx_include_dir.
+Tue Nov 25 23:16:44 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ London changes to string:
+ * std/bastring.cc (check_realloc): Don't be selfish anymore.
+ * std/bastring.h (non-const operator[]): Be selfish.
+ (iterator forms of insert and erase): Stay selfish.
+
Tue Nov 25 14:03:43 1997 H.J. Lu (hjl@gnu.org)
* Makefile.in (stmp-complex, bigstmp-complex): Changed to
diff --git a/libstdc++/Makefile.in b/libstdc++/Makefile.in
index 473037aeebc..0ae27056016 100644
--- a/libstdc++/Makefile.in
+++ b/libstdc++/Makefile.in
@@ -23,8 +23,9 @@ SUBLIBS = $(STAMP)-string $(STAMP)-complx
HEADERS= cassert cctype cerrno cfloat ciso646 climits clocale cmath complex \
csetjmp csignal cstdarg cstddef cstdio cstdlib cstring ctime \
cwchar cwctype string stdexcept \
- algorithm deque list map queue set stack vector utility functional \
- iterator memory numeric
+ algorithm deque functional hash_map hash_set iterator list map \
+ memory numeric pthread_alloc queue rope set slist stack utility \
+ vector fstream iomanip iostream strstream iosfwd
ARLIB = libstdc++.a
SHLIB = libstdc++.so.$(VERSION)
@@ -301,17 +302,15 @@ force:
stuff:
$(MAKE) clean
$(MAKE) -C ../libio c++clean
- $(MAKE) -C ../libg++ clean
- $(MAKE) $(MAKEFLAGS) check
- $(MAKE) -C ../libio check
- $(MAKE) -C ../libg++ check
+ -$(MAKE) $(MAKEFLAGS) check
+ -$(MAKE) -C ../libio check
+ -$(MAKE) -C ../../gcc check-g++
stuff1:
$(MAKE) clean
$(MAKE) -C ../libio c++clean
- $(MAKE) -C ../libg++ clean
stuff2:
- $(MAKE) check
- $(MAKE) -C ../libio check
- $(MAKE) -C ../libg++ check
+ -$(MAKE) check
+ -$(MAKE) -C ../libio check
+ -$(MAKE) -C ../../gcc check-g++
diff --git a/libstdc++/configure.in b/libstdc++/configure.in
index 9ec0ac10482..efc2f55cd13 100644
--- a/libstdc++/configure.in
+++ b/libstdc++/configure.in
@@ -43,8 +43,10 @@ fi
# Make sure the right flags are defined for multi-threading.
case "${target}" in
- *-*-linux-gnu) frags="${frags} linux.mt" ;;
- m68k-motorola-sysv) frags="${frags} delta.mt" ;;
+ alpha*-*-linux-gnulibc1) frags="${frags} linux.mt" ;;
+ powerpc*-*-linux-gnulibc1) frags="${frags} linux.mt" ;;
+ *-*-linux-gnu) frags="${frags} linux.mt" ;;
+ m68k-motorola-sysv) frags="${frags} delta.mt" ;;
esac
for frag in ${frags}; do
diff --git a/libstdc++/std/bastring.cc b/libstdc++/std/bastring.cc
index aa151da69d1..7556ed9c609 100644
--- a/libstdc++/std/bastring.cc
+++ b/libstdc++/std/bastring.cc
@@ -29,15 +29,24 @@
#include <std/bastring.h>
extern "C++" {
-template <class charT, class traits>
-inline void * basic_string <charT, traits>::Rep::
+template <class charT, class traits, class Allocator>
+inline void * basic_string <charT, traits, Allocator>::Rep::
operator new (size_t s, size_t extra)
{
- return ::operator new (s + extra * sizeof (charT));
+ return Allocator::allocate(s + extra * sizeof (charT));
}
-template <class charT, class traits>
-inline size_t basic_string <charT, traits>::Rep::
+template <class charT, class traits, class Allocator>
+inline void basic_string <charT, traits, Allocator>::Rep::
+operator delete (void * ptr)
+{
+ Allocator::deallocate(ptr, sizeof(Rep) +
+ reinterpret_cast<Rep *>(ptr)->res *
+ sizeof (charT));
+}
+
+template <class charT, class traits, class Allocator>
+inline size_t basic_string <charT, traits, Allocator>::Rep::
#if _G_ALLOC_CONTROL
default_frob (size_t s)
#else
@@ -49,8 +58,9 @@ frob_size (size_t s)
return i;
}
-template <class charT, class traits>
-inline basic_string <charT, traits>::Rep * basic_string <charT, traits>::Rep::
+template <class charT, class traits, class Allocator>
+inline basic_string <charT, traits, Allocator>::Rep *
+basic_string <charT, traits, Allocator>::Rep::
create (size_t extra)
{
extra = frob_size (extra + 1);
@@ -61,8 +71,8 @@ create (size_t extra)
return p;
}
-template <class charT, class traits>
-charT * basic_string <charT, traits>::Rep::
+template <class charT, class traits, class Allocator>
+charT * basic_string <charT, traits, Allocator>::Rep::
clone ()
{
Rep *p = Rep::create (len);
@@ -71,8 +81,8 @@ clone ()
return p->data ();
}
-template <class charT, class traits>
-inline bool basic_string <charT, traits>::Rep::
+template <class charT, class traits, class Allocator>
+inline bool basic_string <charT, traits, Allocator>::Rep::
#ifdef _G_ALLOC_CONTROL
default_excess (size_t s, size_t r)
#else
@@ -82,19 +92,20 @@ excess_slop (size_t s, size_t r)
return 2 * (s <= 16 ? 16 : s) < r;
}
-template <class charT, class traits>
-inline bool basic_string <charT, traits>::
-check_realloc (size_t s) const
+template <class charT, class traits, class Allocator>
+inline bool basic_string <charT, traits, Allocator>::
+check_realloc (basic_string::size_type s) const
{
s += sizeof (charT);
+ rep ()->selfish = false;
return (rep ()->ref > 1
|| s > capacity ()
|| Rep::excess_slop (s, capacity ()));
}
-template <class charT, class traits>
-void basic_string <charT, traits>::
-alloc (size_t size, bool save)
+template <class charT, class traits, class Allocator>
+void basic_string <charT, traits, Allocator>::
+alloc (basic_string::size_type size, bool save)
{
if (! check_realloc (size))
return;
@@ -112,10 +123,11 @@ alloc (size_t size, bool save)
repup (p);
}
-template <class charT, class traits>
-basic_string <charT, traits>& basic_string <charT, traits>::
-replace (size_t pos1, size_t n1,
- const basic_string& str, size_t pos2, size_t n2)
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>&
+basic_string <charT, traits, Allocator>::
+replace (size_type pos1, size_type n1,
+ const basic_string& str, size_type pos2, size_type n2)
{
const size_t len2 = str.length ();
@@ -130,27 +142,28 @@ replace (size_t pos1, size_t n1,
return replace (pos1, n1, str.data () + pos2, n2);
}
-template <class charT, class traits>
-inline void basic_string <charT, traits>::Rep::
+template <class charT, class traits, class Allocator>
+inline void basic_string <charT, traits, Allocator>::Rep::
copy (size_t pos, const charT *s, size_t n)
{
if (n)
traits::copy (data () + pos, s, n);
}
-template <class charT, class traits>
-inline void basic_string <charT, traits>::Rep::
+template <class charT, class traits, class Allocator>
+inline void basic_string <charT, traits, Allocator>::Rep::
move (size_t pos, const charT *s, size_t n)
{
if (n)
traits::move (data () + pos, s, n);
}
-template <class charT, class traits>
-basic_string <charT, traits>& basic_string <charT, traits>::
-replace (size_t pos, size_t n1, const charT* s, size_t n2)
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>&
+basic_string <charT, traits, Allocator>::
+replace (size_type pos, size_type n1, const charT* s, size_type n2)
{
- const size_t len = length ();
+ const size_type len = length ();
OUTOFRANGE (pos > len);
if (n1 > len - pos)
n1 = len - pos;
@@ -175,16 +188,16 @@ replace (size_t pos, size_t n1, const charT* s, size_t n2)
return *this;
}
-template <class charT, class traits>
-inline void basic_string <charT, traits>::Rep::
+template <class charT, class traits, class Allocator>
+inline void basic_string <charT, traits, Allocator>::Rep::
set (size_t pos, const charT c, size_t n)
{
traits::set (data () + pos, c, n);
}
-template <class charT, class traits>
-basic_string <charT, traits>& basic_string <charT, traits>::
-replace (size_t pos, size_t n1, size_t n2, charT c)
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
+replace (size_type pos, size_type n1, size_type n2, charT c)
{
const size_t len = length ();
OUTOFRANGE (pos > len);
@@ -211,9 +224,9 @@ replace (size_t pos, size_t n1, size_t n2, charT c)
return *this;
}
-template <class charT, class traits>
-void basic_string <charT, traits>::
-resize (size_t n, charT c)
+template <class charT, class traits, class Allocator>
+void basic_string <charT, traits, Allocator>::
+resize (size_type n, charT c)
{
LENGTHERROR (n > max_size ());
@@ -223,9 +236,10 @@ resize (size_t n, charT c)
erase (n);
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-copy (charT* s, size_t n, size_t pos)
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+copy (charT* s, size_type n, size_type pos)
{
OUTOFRANGE (pos > length ());
@@ -236,9 +250,10 @@ copy (charT* s, size_t n, size_t pos)
return n;
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-find (const charT* s, size_t pos, size_t n) const
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+find (const charT* s, size_type pos, size_type n) const
{
size_t xpos = pos;
for (; xpos + n <= length (); ++xpos)
@@ -248,9 +263,10 @@ find (const charT* s, size_t pos, size_t n) const
return npos;
}
-template <class charT, class traits>
-inline size_t basic_string <charT, traits>::
-_find (const charT* ptr, charT c, size_t xpos, size_t len)
+template <class charT, class traits, class Allocator>
+inline basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+_find (const charT* ptr, charT c, size_type xpos, size_type len)
{
for (; xpos < len; ++xpos)
if (traits::eq (ptr [xpos], c))
@@ -258,16 +274,18 @@ _find (const charT* ptr, charT c, size_t xpos, size_t len)
return npos;
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-find (charT c, size_t pos) const
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+find (charT c, size_type pos) const
{
return _find (data (), c, pos, length ());
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-rfind (const charT* s, size_t pos, size_t n) const
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+rfind (const charT* s, size_type pos, size_type n) const
{
if (n > length ())
return npos;
@@ -283,9 +301,10 @@ rfind (const charT* s, size_t pos, size_t n) const
return npos;
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-rfind (charT c, size_t pos) const
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+rfind (charT c, size_type pos) const
{
if (1 > length ())
return npos;
@@ -300,9 +319,10 @@ rfind (charT c, size_t pos) const
return npos;
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-find_first_of (const charT* s, size_t pos, size_t n) const
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+find_first_of (const charT* s, size_type pos, size_type n) const
{
size_t xpos = pos;
for (; xpos < length (); ++xpos)
@@ -311,9 +331,10 @@ find_first_of (const charT* s, size_t pos, size_t n) const
return npos;
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-find_last_of (const charT* s, size_t pos, size_t n) const
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+find_last_of (const charT* s, size_type pos, size_type n) const
{
size_t xpos = length () - 1;
if (xpos > pos)
@@ -324,9 +345,10 @@ find_last_of (const charT* s, size_t pos, size_t n) const
return npos;
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-find_first_not_of (const charT* s, size_t pos, size_t n) const
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+find_first_not_of (const charT* s, size_type pos, size_type n) const
{
size_t xpos = pos;
for (; xpos < length (); ++xpos)
@@ -335,9 +357,10 @@ find_first_not_of (const charT* s, size_t pos, size_t n) const
return npos;
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-find_first_not_of (charT c, size_t pos) const
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+find_first_not_of (charT c, size_type pos) const
{
size_t xpos = pos;
for (; xpos < length (); ++xpos)
@@ -346,9 +369,10 @@ find_first_not_of (charT c, size_t pos) const
return npos;
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-find_last_not_of (const charT* s, size_t pos, size_t n) const
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+find_last_not_of (const charT* s, size_type pos, size_type n) const
{
size_t xpos = length () - 1;
if (xpos > pos)
@@ -359,9 +383,10 @@ find_last_not_of (const charT* s, size_t pos, size_t n) const
return npos;
}
-template <class charT, class traits>
-size_t basic_string <charT, traits>::
-find_last_not_of (charT c, size_t pos) const
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::
+find_last_not_of (charT c, size_type pos) const
{
size_t xpos = length () - 1;
if (xpos > pos)
@@ -372,9 +397,9 @@ find_last_not_of (charT c, size_t pos) const
return npos;
}
-template <class charT, class traits>
-int basic_string <charT, traits>::
-compare (const basic_string& str, size_t pos, size_t n) const
+template <class charT, class traits, class Allocator>
+int basic_string <charT, traits, Allocator>::
+compare (const basic_string& str, size_type pos, size_type n) const
{
OUTOFRANGE (pos > length ());
@@ -391,9 +416,9 @@ compare (const basic_string& str, size_t pos, size_t n) const
return (length () - pos) - str.length ();
}
-template <class charT, class traits>
-int basic_string <charT, traits>::
-compare (const charT* s, size_t pos, size_t n) const
+template <class charT, class traits, class Allocator>
+int basic_string <charT, traits, Allocator>::
+compare (const charT* s, size_type pos, size_type n) const
{
OUTOFRANGE (pos > length ());
@@ -408,9 +433,9 @@ compare (const charT* s, size_t pos, size_t n) const
#include <iostream.h>
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
istream &
-operator>> (istream &is, basic_string <charT, traits> &s)
+operator>> (istream &is, basic_string <charT, traits, Allocator> &s)
{
int w = is.width (0);
if (is.ipfx0 ())
@@ -443,16 +468,16 @@ operator>> (istream &is, basic_string <charT, traits> &s)
return is;
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
ostream &
-operator<< (ostream &o, const basic_string <charT, traits>& s)
+operator<< (ostream &o, const basic_string <charT, traits, Allocator>& s)
{
return o.write (s.data (), s.length ());
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
istream&
-getline (istream &is, basic_string <charT, traits>& s, charT delim)
+getline (istream &is, basic_string <charT, traits, Allocator>& s, charT delim)
{
if (is.ipfx1 ())
{
@@ -493,22 +518,22 @@ getline (istream &is, basic_string <charT, traits>& s, charT delim)
return is;
}
-template <class charT, class traits>
-basic_string <charT, traits>::Rep
-basic_string<charT, traits>::nilRep = { 0, 0, 1 };
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>::Rep
+basic_string<charT, traits, Allocator>::nilRep = { 0, 0, 1 };
-template <class charT, class traits>
-const basic_string <charT, traits>::size_type
-basic_string <charT, traits>::npos;
+template <class charT, class traits, class Allocator>
+const basic_string <charT, traits, Allocator>::size_type
+basic_string <charT, traits, Allocator>::npos;
#ifdef _G_ALLOC_CONTROL
-template <class charT, class traits>
-bool (*basic_string <charT, traits>::Rep::excess_slop) (size_t, size_t)
- = basic_string <charT, traits>::Rep::default_excess;
+template <class charT, class traits, class Allocator>
+bool (*basic_string <charT, traits, Allocator>::Rep::excess_slop) (size_t, size_t)
+ = basic_string <charT, traits, Allocator>::Rep::default_excess;
-template <class charT, class traits>
-size_t (*basic_string <charT, traits>::Rep::frob_size) (size_t)
- = basic_string <charT, traits>::Rep::default_frob;
+template <class charT, class traits, class Allocator>
+size_t (*basic_string <charT, traits, Allocator>::Rep::frob_size) (size_t)
+ = basic_string <charT, traits, Allocator>::Rep::default_frob;
#endif
} // extern "C++"
diff --git a/libstdc++/std/bastring.h b/libstdc++/std/bastring.h
index 59a59958302..5b1d651e00f 100644
--- a/libstdc++/std/bastring.h
+++ b/libstdc++/std/bastring.h
@@ -35,6 +35,9 @@
#include <cstddef>
#include <std/straits.h>
+// NOTE : This does NOT conform to the draft standard and is likely to change
+#include <alloc.h>
+
extern "C++" {
class istream; class ostream;
@@ -58,7 +61,8 @@ extern void __length_error (const char *);
#endif
-template <class charT, class traits = string_char_traits<charT> >
+template <class charT, class traits = string_char_traits<charT>,
+ class Allocator = alloc >
class basic_string
{
private:
@@ -72,6 +76,7 @@ private:
void release () { if (--ref == 0) delete this; }
inline static void * operator new (size_t, size_t);
+ inline static void operator delete (void *);
inline static Rep* create (size_t);
charT* clone ();
@@ -102,8 +107,10 @@ private:
public:
// types:
- typedef traits traits_type;
- typedef charT value_type;
+ typedef traits traits_type;
+ typedef typename traits::char_type value_type;
+ typedef Allocator allocator_type;
+
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef charT& reference;
@@ -220,9 +227,9 @@ public:
basic_string& insert (size_type pos, size_type n, charT c)
{ return replace (pos, 0, n, c); }
iterator insert(iterator p, charT c)
- { insert (p - ibegin (), 1, c); return p; }
+ { insert (p - ibegin (), 1, c); selfish (); return p; }
iterator insert(iterator p, size_type n, charT c)
- { insert (p - ibegin (), n, c); return p; }
+ { insert (p - ibegin (), n, c); selfish (); return p; }
#ifdef __STL_MEMBER_TEMPLATES
template<class InputIterator>
void insert(iterator p, InputIterator first, InputIterator last)
@@ -234,9 +241,9 @@ public:
basic_string& erase (size_type pos = 0, size_type n = npos)
{ return replace (pos, n, (size_type)0, (charT)0); }
iterator erase(iterator p)
- { replace (p - ibegin (), 1, (size_type)0, (charT)0); return p; }
+ { replace (p-ibegin (), 1, (size_type)0, (charT)0); selfish (); return p; }
iterator erase(iterator f, iterator l)
- { replace (f - ibegin (), l - f, (size_type)0, (charT)0); return f; }
+ { replace (f-ibegin (), l-f, (size_type)0, (charT)0);selfish ();return f; }
basic_string& replace (size_type pos1, size_type n1, const basic_string& str,
size_type pos2 = 0, size_type n2 = npos);
@@ -278,7 +285,7 @@ public:
}
reference operator[] (size_type pos)
- { unique (); return (*rep ())[pos]; }
+ { selfish (); return (*rep ())[pos]; }
reference at (size_type pos)
{
@@ -386,12 +393,12 @@ private:
};
#ifdef __STL_MEMBER_TEMPLATES
-template <class charT, class traits> template <class InputIterator>
-basic_string <charT, traits>& basic_string <charT, traits>::
+template <class charT, class traits, class Allocator> template <class InputIterator>
+basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
replace (iterator i1, iterator i2, InputIterator j1, InputIterator j2)
#else
-template <class charT, class traits>
-basic_string <charT, traits>& basic_string <charT, traits>::
+template <class charT, class traits, class Allocator>
+basic_string <charT, traits, Allocator>& basic_string <charT, traits, Allocator>::
replace (iterator i1, iterator i2, const_iterator j1, const_iterator j2)
#endif
{
@@ -426,191 +433,191 @@ replace (iterator i1, iterator i2, const_iterator j1, const_iterator j2)
return *this;
}
-template <class charT, class traits>
-inline basic_string <charT, traits>
-operator+ (const basic_string <charT, traits>& lhs,
- const basic_string <charT, traits>& rhs)
+template <class charT, class traits, class Allocator>
+inline basic_string <charT, traits, Allocator>
+operator+ (const basic_string <charT, traits, Allocator>& lhs,
+ const basic_string <charT, traits, Allocator>& rhs)
{
- basic_string <charT, traits> str (lhs);
+ basic_string <charT, traits, Allocator> str (lhs);
str.append (rhs);
return str;
}
-template <class charT, class traits>
-inline basic_string <charT, traits>
-operator+ (const charT* lhs, const basic_string <charT, traits>& rhs)
+template <class charT, class traits, class Allocator>
+inline basic_string <charT, traits, Allocator>
+operator+ (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
- basic_string <charT, traits> str (lhs);
+ basic_string <charT, traits, Allocator> str (lhs);
str.append (rhs);
return str;
}
-template <class charT, class traits>
-inline basic_string <charT, traits>
-operator+ (charT lhs, const basic_string <charT, traits>& rhs)
+template <class charT, class traits, class Allocator>
+inline basic_string <charT, traits, Allocator>
+operator+ (charT lhs, const basic_string <charT, traits, Allocator>& rhs)
{
- basic_string <charT, traits> str (1, lhs);
+ basic_string <charT, traits, Allocator> str (1, lhs);
str.append (rhs);
return str;
}
-template <class charT, class traits>
-inline basic_string <charT, traits>
-operator+ (const basic_string <charT, traits>& lhs, const charT* rhs)
+template <class charT, class traits, class Allocator>
+inline basic_string <charT, traits, Allocator>
+operator+ (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
- basic_string <charT, traits> str (lhs);
+ basic_string <charT, traits, Allocator> str (lhs);
str.append (rhs);
return str;
}
-template <class charT, class traits>
-inline basic_string <charT, traits>
-operator+ (const basic_string <charT, traits>& lhs, charT rhs)
+template <class charT, class traits, class Allocator>
+inline basic_string <charT, traits, Allocator>
+operator+ (const basic_string <charT, traits, Allocator>& lhs, charT rhs)
{
- basic_string <charT, traits> str (lhs);
+ basic_string <charT, traits, Allocator> str (lhs);
str.append (1, rhs);
return str;
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator== (const basic_string <charT, traits>& lhs,
- const basic_string <charT, traits>& rhs)
+operator== (const basic_string <charT, traits, Allocator>& lhs,
+ const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) == 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator== (const charT* lhs, const basic_string <charT, traits>& rhs)
+operator== (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) == 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator== (const basic_string <charT, traits>& lhs, const charT* rhs)
+operator== (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) == 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator!= (const charT* lhs, const basic_string <charT, traits>& rhs)
+operator!= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) != 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator!= (const basic_string <charT, traits>& lhs, const charT* rhs)
+operator!= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) != 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator< (const basic_string <charT, traits>& lhs,
- const basic_string <charT, traits>& rhs)
+operator< (const basic_string <charT, traits, Allocator>& lhs,
+ const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) < 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator< (const charT* lhs, const basic_string <charT, traits>& rhs)
+operator< (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) > 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator< (const basic_string <charT, traits>& lhs, const charT* rhs)
+operator< (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) < 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator> (const charT* lhs, const basic_string <charT, traits>& rhs)
+operator> (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) < 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator> (const basic_string <charT, traits>& lhs, const charT* rhs)
+operator> (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) > 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator<= (const charT* lhs, const basic_string <charT, traits>& rhs)
+operator<= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) >= 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator<= (const basic_string <charT, traits>& lhs, const charT* rhs)
+operator<= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) <= 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator>= (const charT* lhs, const basic_string <charT, traits>& rhs)
+operator>= (const charT* lhs, const basic_string <charT, traits, Allocator>& rhs)
{
return (rhs.compare (lhs) <= 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator>= (const basic_string <charT, traits>& lhs, const charT* rhs)
+operator>= (const basic_string <charT, traits, Allocator>& lhs, const charT* rhs)
{
return (lhs.compare (rhs) >= 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator!= (const basic_string <charT, traits>& lhs,
- const basic_string <charT, traits>& rhs)
+operator!= (const basic_string <charT, traits, Allocator>& lhs,
+ const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) != 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator> (const basic_string <charT, traits>& lhs,
- const basic_string <charT, traits>& rhs)
+operator> (const basic_string <charT, traits, Allocator>& lhs,
+ const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) > 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator<= (const basic_string <charT, traits>& lhs,
- const basic_string <charT, traits>& rhs)
+operator<= (const basic_string <charT, traits, Allocator>& lhs,
+ const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) <= 0);
}
-template <class charT, class traits>
+template <class charT, class traits, class Allocator>
inline bool
-operator>= (const basic_string <charT, traits>& lhs,
- const basic_string <charT, traits>& rhs)
+operator>= (const basic_string <charT, traits, Allocator>& lhs,
+ const basic_string <charT, traits, Allocator>& rhs)
{
return (lhs.compare (rhs) >= 0);
}
class istream; class ostream;
-template <class charT, class traits> istream&
-operator>> (istream&, basic_string <charT, traits>&);
-template <class charT, class traits> ostream&
-operator<< (ostream&, const basic_string <charT, traits>&);
-template <class charT, class traits> istream&
-getline (istream&, basic_string <charT, traits>&, charT delim = '\n');
+template <class charT, class traits, class Allocator> istream&
+operator>> (istream&, basic_string <charT, traits, Allocator>&);
+template <class charT, class traits, class Allocator> ostream&
+operator<< (ostream&, const basic_string <charT, traits, Allocator>&);
+template <class charT, class traits, class Allocator> istream&
+getline (istream&, basic_string <charT, traits, Allocator>&, charT delim = '\n');
} // extern "C++"
diff --git a/libstdc++/stlinst.cc b/libstdc++/stlinst.cc
index dc55ce32274..03242fabb7d 100644
--- a/libstdc++/stlinst.cc
+++ b/libstdc++/stlinst.cc
@@ -1,8 +1 @@
-// Instantiation file for the -*- C++ -*- Standard Library allocator templates
-// This file is part of the GNU ANSI C++ Library.
-
-#include <alloc.h>
-
-template class __default_alloc_template<false, 0>;
-
-template class __malloc_alloc_template<0>;
+template class __default_alloc_template<__NODE_ALLOCATOR_THREADS, 0>;
diff --git a/libstdc++/testsuite/ChangeLog b/libstdc++/testsuite/ChangeLog
index 886f8b0a685..84d8290c719 100644
--- a/libstdc++/testsuite/ChangeLog
+++ b/libstdc++/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+Thu Dec 25 00:34:03 1997 Jeffrey A Law (law@cygnus.com)
+
+ * lib/libstdc++.exp (test_libstdc++): Set LD_LIBRARY_PATH
+ and SHLIB_PATH appropriately.
+
Wed Sep 3 09:39:36 1997 Jeffrey A Law (law@cygnus.com)
* lib/libstdc++.exp: Remove libg++_link_flags.
diff --git a/libstdc++/testsuite/lib/libstdc++.exp b/libstdc++/testsuite/lib/libstdc++.exp
index 91cd83025b9..f9bcdf43602 100644
--- a/libstdc++/testsuite/lib/libstdc++.exp
+++ b/libstdc++/testsuite/lib/libstdc++.exp
@@ -73,6 +73,23 @@ proc test_libstdc++ { options srcfile compile_args inpfile resultfile exec_args
verbose "using LIBSTDCPP = $libstdcpp" 2
set args ""
+
+ # Basically we want to build up a colon separated path list from
+ # the value of $libstdcpp.
+
+ # First strip away any -L arguments.
+ regsub -all -- "-L" $libstdcpp "" ld_library_path
+
+ # Then remove any -lstdc++ argument.
+ regsub -all -- " -lstdc.*" $ld_library_path "" ld_library_path
+
+ # That's enough to make things work for the normal case.
+ # If we wanted to handle an arbitrary value of libstdcpp,
+ # then we'd have to do a lot more work.
+
+ # Set variables the dynamic linker looks at.
+ setenv LD_LIBRARY_PATH $ld_library_path
+ setenv SHLIB_PATH $ld_library_path
if { $compile_args != "" } {
lappend args "additional_flags=$compile_args"
}