From: Jeff Law Date: Sun, 8 Feb 1998 23:13:33 +0000 (-0700) Subject: Bring egcs-1.0.2's libstdc++ up to libstdc++ 2.8.0. X-Git-Tag: prereleases/egcs-1.0.2-prerelease~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1cf6e81ebd3c7becc1ebca1f1cbad3b43c92821d;p=thirdparty%2Fgcc.git Bring egcs-1.0.2's libstdc++ up to libstdc++ 2.8.0. From-SVN: r17789 --- diff --git a/libstdc++/ChangeLog b/libstdc++/ChangeLog index d0ac79481c85..cc0872b02774 100644 --- a/libstdc++/ChangeLog +++ b/libstdc++/ChangeLog @@ -3,10 +3,51 @@ Mon Feb 9 00:09:16 1998 Jason Merrill * Makefile.in (install): Remove the shared library symlink even if we aren't installing it. +1998-01-05 Brendan Kehoe + + * 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 + + * configure.in: Finalize support for {alpha|powerpc}*-*-linux-gnulibc1 + +Sun Dec 7 02:34:40 1997 Jody Goldberg + + * 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 + + * 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 + + 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 473037aeebc5..0ae270560161 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 9ec0ac10482d..efc2f55cd13f 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 aa151da69d1b..7556ed9c6093 100644 --- a/libstdc++/std/bastring.cc +++ b/libstdc++/std/bastring.cc @@ -29,15 +29,24 @@ #include extern "C++" { -template -inline void * basic_string ::Rep:: +template +inline void * basic_string ::Rep:: operator new (size_t s, size_t extra) { - return ::operator new (s + extra * sizeof (charT)); + return Allocator::allocate(s + extra * sizeof (charT)); } -template -inline size_t basic_string ::Rep:: +template +inline void basic_string ::Rep:: +operator delete (void * ptr) +{ + Allocator::deallocate(ptr, sizeof(Rep) + + reinterpret_cast(ptr)->res * + sizeof (charT)); +} + +template +inline size_t basic_string ::Rep:: #if _G_ALLOC_CONTROL default_frob (size_t s) #else @@ -49,8 +58,9 @@ frob_size (size_t s) return i; } -template -inline basic_string ::Rep * basic_string ::Rep:: +template +inline basic_string ::Rep * +basic_string ::Rep:: create (size_t extra) { extra = frob_size (extra + 1); @@ -61,8 +71,8 @@ create (size_t extra) return p; } -template -charT * basic_string ::Rep:: +template +charT * basic_string ::Rep:: clone () { Rep *p = Rep::create (len); @@ -71,8 +81,8 @@ clone () return p->data (); } -template -inline bool basic_string ::Rep:: +template +inline bool basic_string ::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 -inline bool basic_string :: -check_realloc (size_t s) const +template +inline bool basic_string :: +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 -void basic_string :: -alloc (size_t size, bool save) +template +void basic_string :: +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 -basic_string & basic_string :: -replace (size_t pos1, size_t n1, - const basic_string& str, size_t pos2, size_t n2) +template +basic_string & +basic_string :: +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 -inline void basic_string ::Rep:: +template +inline void basic_string ::Rep:: copy (size_t pos, const charT *s, size_t n) { if (n) traits::copy (data () + pos, s, n); } -template -inline void basic_string ::Rep:: +template +inline void basic_string ::Rep:: move (size_t pos, const charT *s, size_t n) { if (n) traits::move (data () + pos, s, n); } -template -basic_string & basic_string :: -replace (size_t pos, size_t n1, const charT* s, size_t n2) +template +basic_string & +basic_string :: +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 -inline void basic_string ::Rep:: +template +inline void basic_string ::Rep:: set (size_t pos, const charT c, size_t n) { traits::set (data () + pos, c, n); } -template -basic_string & basic_string :: -replace (size_t pos, size_t n1, size_t n2, charT c) +template +basic_string & basic_string :: +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 -void basic_string :: -resize (size_t n, charT c) +template +void basic_string :: +resize (size_type n, charT c) { LENGTHERROR (n > max_size ()); @@ -223,9 +236,10 @@ resize (size_t n, charT c) erase (n); } -template -size_t basic_string :: -copy (charT* s, size_t n, size_t pos) +template +basic_string ::size_type +basic_string :: +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 -size_t basic_string :: -find (const charT* s, size_t pos, size_t n) const +template +basic_string ::size_type +basic_string :: +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 -inline size_t basic_string :: -_find (const charT* ptr, charT c, size_t xpos, size_t len) +template +inline basic_string ::size_type +basic_string :: +_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 -size_t basic_string :: -find (charT c, size_t pos) const +template +basic_string ::size_type +basic_string :: +find (charT c, size_type pos) const { return _find (data (), c, pos, length ()); } -template -size_t basic_string :: -rfind (const charT* s, size_t pos, size_t n) const +template +basic_string ::size_type +basic_string :: +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 -size_t basic_string :: -rfind (charT c, size_t pos) const +template +basic_string ::size_type +basic_string :: +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 -size_t basic_string :: -find_first_of (const charT* s, size_t pos, size_t n) const +template +basic_string ::size_type +basic_string :: +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 -size_t basic_string :: -find_last_of (const charT* s, size_t pos, size_t n) const +template +basic_string ::size_type +basic_string :: +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 -size_t basic_string :: -find_first_not_of (const charT* s, size_t pos, size_t n) const +template +basic_string ::size_type +basic_string :: +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 -size_t basic_string :: -find_first_not_of (charT c, size_t pos) const +template +basic_string ::size_type +basic_string :: +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 -size_t basic_string :: -find_last_not_of (const charT* s, size_t pos, size_t n) const +template +basic_string ::size_type +basic_string :: +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 -size_t basic_string :: -find_last_not_of (charT c, size_t pos) const +template +basic_string ::size_type +basic_string :: +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 -int basic_string :: -compare (const basic_string& str, size_t pos, size_t n) const +template +int basic_string :: +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 -int basic_string :: -compare (const charT* s, size_t pos, size_t n) const +template +int basic_string :: +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 -template +template istream & -operator>> (istream &is, basic_string &s) +operator>> (istream &is, basic_string &s) { int w = is.width (0); if (is.ipfx0 ()) @@ -443,16 +468,16 @@ operator>> (istream &is, basic_string &s) return is; } -template +template ostream & -operator<< (ostream &o, const basic_string & s) +operator<< (ostream &o, const basic_string & s) { return o.write (s.data (), s.length ()); } -template +template istream& -getline (istream &is, basic_string & s, charT delim) +getline (istream &is, basic_string & s, charT delim) { if (is.ipfx1 ()) { @@ -493,22 +518,22 @@ getline (istream &is, basic_string & s, charT delim) return is; } -template -basic_string ::Rep -basic_string::nilRep = { 0, 0, 1 }; +template +basic_string ::Rep +basic_string::nilRep = { 0, 0, 1 }; -template -const basic_string ::size_type -basic_string ::npos; +template +const basic_string ::size_type +basic_string ::npos; #ifdef _G_ALLOC_CONTROL -template -bool (*basic_string ::Rep::excess_slop) (size_t, size_t) - = basic_string ::Rep::default_excess; +template +bool (*basic_string ::Rep::excess_slop) (size_t, size_t) + = basic_string ::Rep::default_excess; -template -size_t (*basic_string ::Rep::frob_size) (size_t) - = basic_string ::Rep::default_frob; +template +size_t (*basic_string ::Rep::frob_size) (size_t) + = basic_string ::Rep::default_frob; #endif } // extern "C++" diff --git a/libstdc++/std/bastring.h b/libstdc++/std/bastring.h index 59a599583028..5b1d651e00f0 100644 --- a/libstdc++/std/bastring.h +++ b/libstdc++/std/bastring.h @@ -35,6 +35,9 @@ #include #include +// NOTE : This does NOT conform to the draft standard and is likely to change +#include + extern "C++" { class istream; class ostream; @@ -58,7 +61,8 @@ extern void __length_error (const char *); #endif -template > +template , + 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 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 template -basic_string & basic_string :: +template template +basic_string & basic_string :: replace (iterator i1, iterator i2, InputIterator j1, InputIterator j2) #else -template -basic_string & basic_string :: +template +basic_string & basic_string :: 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 -inline basic_string -operator+ (const basic_string & lhs, - const basic_string & rhs) +template +inline basic_string +operator+ (const basic_string & lhs, + const basic_string & rhs) { - basic_string str (lhs); + basic_string str (lhs); str.append (rhs); return str; } -template -inline basic_string -operator+ (const charT* lhs, const basic_string & rhs) +template +inline basic_string +operator+ (const charT* lhs, const basic_string & rhs) { - basic_string str (lhs); + basic_string str (lhs); str.append (rhs); return str; } -template -inline basic_string -operator+ (charT lhs, const basic_string & rhs) +template +inline basic_string +operator+ (charT lhs, const basic_string & rhs) { - basic_string str (1, lhs); + basic_string str (1, lhs); str.append (rhs); return str; } -template -inline basic_string -operator+ (const basic_string & lhs, const charT* rhs) +template +inline basic_string +operator+ (const basic_string & lhs, const charT* rhs) { - basic_string str (lhs); + basic_string str (lhs); str.append (rhs); return str; } -template -inline basic_string -operator+ (const basic_string & lhs, charT rhs) +template +inline basic_string +operator+ (const basic_string & lhs, charT rhs) { - basic_string str (lhs); + basic_string str (lhs); str.append (1, rhs); return str; } -template +template inline bool -operator== (const basic_string & lhs, - const basic_string & rhs) +operator== (const basic_string & lhs, + const basic_string & rhs) { return (lhs.compare (rhs) == 0); } -template +template inline bool -operator== (const charT* lhs, const basic_string & rhs) +operator== (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) == 0); } -template +template inline bool -operator== (const basic_string & lhs, const charT* rhs) +operator== (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) == 0); } -template +template inline bool -operator!= (const charT* lhs, const basic_string & rhs) +operator!= (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) != 0); } -template +template inline bool -operator!= (const basic_string & lhs, const charT* rhs) +operator!= (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) != 0); } -template +template inline bool -operator< (const basic_string & lhs, - const basic_string & rhs) +operator< (const basic_string & lhs, + const basic_string & rhs) { return (lhs.compare (rhs) < 0); } -template +template inline bool -operator< (const charT* lhs, const basic_string & rhs) +operator< (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) > 0); } -template +template inline bool -operator< (const basic_string & lhs, const charT* rhs) +operator< (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) < 0); } -template +template inline bool -operator> (const charT* lhs, const basic_string & rhs) +operator> (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) < 0); } -template +template inline bool -operator> (const basic_string & lhs, const charT* rhs) +operator> (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) > 0); } -template +template inline bool -operator<= (const charT* lhs, const basic_string & rhs) +operator<= (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) >= 0); } -template +template inline bool -operator<= (const basic_string & lhs, const charT* rhs) +operator<= (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) <= 0); } -template +template inline bool -operator>= (const charT* lhs, const basic_string & rhs) +operator>= (const charT* lhs, const basic_string & rhs) { return (rhs.compare (lhs) <= 0); } -template +template inline bool -operator>= (const basic_string & lhs, const charT* rhs) +operator>= (const basic_string & lhs, const charT* rhs) { return (lhs.compare (rhs) >= 0); } -template +template inline bool -operator!= (const basic_string & lhs, - const basic_string & rhs) +operator!= (const basic_string & lhs, + const basic_string & rhs) { return (lhs.compare (rhs) != 0); } -template +template inline bool -operator> (const basic_string & lhs, - const basic_string & rhs) +operator> (const basic_string & lhs, + const basic_string & rhs) { return (lhs.compare (rhs) > 0); } -template +template inline bool -operator<= (const basic_string & lhs, - const basic_string & rhs) +operator<= (const basic_string & lhs, + const basic_string & rhs) { return (lhs.compare (rhs) <= 0); } -template +template inline bool -operator>= (const basic_string & lhs, - const basic_string & rhs) +operator>= (const basic_string & lhs, + const basic_string & rhs) { return (lhs.compare (rhs) >= 0); } class istream; class ostream; -template istream& -operator>> (istream&, basic_string &); -template ostream& -operator<< (ostream&, const basic_string &); -template istream& -getline (istream&, basic_string &, charT delim = '\n'); +template istream& +operator>> (istream&, basic_string &); +template ostream& +operator<< (ostream&, const basic_string &); +template istream& +getline (istream&, basic_string &, charT delim = '\n'); } // extern "C++" diff --git a/libstdc++/stlinst.cc b/libstdc++/stlinst.cc index dc55ce322747..03242fabb7d4 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 - -template class __default_alloc_template; - -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 886f8b0a6851..84d8290c7194 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 91cd83025b9a..f9bcdf43602c 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" }