This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libstdc++ changes



Cygnus libstdc++ and egcs's libstdc++ got a little out of sync.  This
patch brings them back together.

It's mostly just whitespace fixes, re-adding missing ChangeLog entries.  But
there are two changes of note.

	* multilibbing is enabled by default.
	* One stl bugfix (incorrectly test using #ifdef changed of #if).

Index: ChangeLog
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/ChangeLog,v
retrieving revision 1.65
diff -c -3 -p -r1.65 ChangeLog
*** ChangeLog	1999/04/02 14:17:47	1.65
--- ChangeLog	1999/04/07 10:18:51
*************** Thu Feb 18 19:53:17 1999  Marc Espie <es
*** 33,38 ****
--- 33,52 ----
  	* config/openbsd.ml: New file.
  	* config/openbsd.mt: New file.
  
+ 1999-02-04  Ulrich Drepper  <drepper@cygnus.com>
+ 
+ 	* configure.in: Recognize --enable-threads=posix for all
+ 	platforms.
+ 	* config/posix.mt: New file.
+ 
+ 	* configure.in: Add fragments for Solaris defining macro specifying
+ 	thread library to be used.
+ 	* config/sol2pth.mt: New file
+ 	* config/sol2solth.mt: New file.
+ 	* stl/stl_alloc.h: Add support for Solaris thread library.
+ 	* stl/stl_config.h: Recognize _SOLTHREADS and define internal macros
+ 	appropriately.
+ 
  1999-01-28  Baron Roberts  <baron@sgi.com>
  
  	* string: Uncomment wstring declaration.
Index: configure.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/configure.in,v
retrieving revision 1.23
diff -c -3 -p -r1.23 configure.in
*** configure.in	1999/04/02 14:17:49	1.23
--- configure.in	1999/04/07 10:18:52
*************** if [ -n "${with_cross_host}" ] ; then
*** 176,181 ****
--- 176,186 ----
      mv -f Makefile.tem Makefile
  fi
  
+ # enable multilib-ing by default.
+ if [ -z "${enable_multilib}" ]; then
+     enable_multilib=yes
+ fi
+ 
  . ${topsrcdir}/config-ml.in
  
  gxx_include_dir=
Index: stl/bitset
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/stl/bitset,v
retrieving revision 1.2
diff -c -3 -p -r1.2 bitset
*** bitset	1998/11/27 12:10:39	1.2
--- bitset	1999/04/07 10:18:53
***************
*** 9,15 ****
   * in supporting documentation.  Silicon Graphics makes no
   * representations about the suitability of this software for any
   * purpose.  It is provided "as is" without express or implied warranty.
!  */ 
  
  #ifndef __SGI_STL_BITSET
  #define __SGI_STL_BITSET
--- 9,15 ----
   * in supporting documentation.  Silicon Graphics makes no
   * representations about the suitability of this software for any
   * purpose.  It is provided "as is" without express or implied warranty.
!  */
  
  #ifndef __SGI_STL_BITSET
  #define __SGI_STL_BITSET
***************
*** 19,30 ****
  // THIS FEATURE*.  It is experimental, and it may be removed in
  // future releases.
  
! // A bitset of size N, using words of type _WordT, will have 
  // N % (sizeof(_WordT) * CHAR_BIT) unused bits.  (They are the high-
  // order bits in the highest word.)  It is a class invariant
  // of class bitset<> that those unused bits are always zero.
  
! // Most of the actual code isn't contained in bitset<> itself, but in the 
  // base class _Base_bitset.  The base class works with whole words, not with
  // individual bits.  This allows us to specialize _Base_bitset for the
  // important special case where the bitset is only a single word.
--- 19,30 ----
  // THIS FEATURE*.  It is experimental, and it may be removed in
  // future releases.
  
! // A bitset of size N, using words of type _WordT, will have
  // N % (sizeof(_WordT) * CHAR_BIT) unused bits.  (They are the high-
  // order bits in the highest word.)  It is a class invariant
  // of class bitset<> that those unused bits are always zero.
  
! // Most of the actual code isn't contained in bitset<> itself, but in the
  // base class _Base_bitset.  The base class works with whole words, not with
  // individual bits.  This allows us to specialize _Base_bitset for the
  // important special case where the bitset is only a single word.
*************** __STL_BEGIN_NAMESPACE
*** 51,64 ****
  #endif
  
  // structure to aid in counting bits
! template<bool __dummy> 
  struct _Bit_count {
    static unsigned char _S_bit_count[256];
  };
  
  // Mapping from 8 bit unsigned integers to the index of the first one
  // bit:
! template<bool __dummy> 
  struct _First_one {
    static unsigned char _S_first_one[256];
  };
--- 51,64 ----
  #endif
  
  // structure to aid in counting bits
! template<bool __dummy>
  struct _Bit_count {
    static unsigned char _S_bit_count[256];
  };
  
  // Mapping from 8 bit unsigned integers to the index of the first one
  // bit:
! template<bool __dummy>
  struct _First_one {
    static unsigned char _S_first_one[256];
  };
*************** struct _Base_bitset {
*** 162,168 ****
      return __result;
    }
  
!   unsigned long _M_do_to_ulong() const; 
  
    // find first "on" bit
    size_t _M_do_find_first(size_t __not_found) const;
--- 162,168 ----
      return __result;
    }
  
!   unsigned long _M_do_to_ulong() const;
  
    // find first "on" bit
    size_t _M_do_find_first(size_t __not_found) const;
*************** struct _Base_bitset {
*** 173,179 ****
  
  //
  // Definitions of non-inline functions from _Base_bitset.
! // 
  
  template<size_t _Nw, class _WordT>
  _Base_bitset<_Nw, _WordT>::_Base_bitset(unsigned long __val)
--- 173,179 ----
  
  //
  // Definitions of non-inline functions from _Base_bitset.
! //
  
  template<size_t _Nw, class _WordT>
  _Base_bitset<_Nw, _WordT>::_Base_bitset(unsigned long __val)
*************** _Base_bitset<_Nw, _WordT>::_Base_bitset(
*** 187,193 ****
  }
  
  template<size_t _Nw, class _WordT>
! void _Base_bitset<_Nw, _WordT>::_M_do_left_shift(size_t __shift) 
  {
    if (__shift != 0) {
      const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT);
--- 187,193 ----
  }
  
  template<size_t _Nw, class _WordT>
! void _Base_bitset<_Nw, _WordT>::_M_do_left_shift(size_t __shift)
  {
    if (__shift != 0) {
      const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT);
*************** void _Base_bitset<_Nw, _WordT>::_M_do_le
*** 195,201 ****
      const size_t __sub_offset = __BITS_PER_WORDT(_WordT) - __offset;
      size_t __n = _Nw - 1;
      for ( ; __n > __wshift; --__n)
!       _M_w[__n] = (_M_w[__n - __wshift] << __offset) | 
                  (_M_w[__n - __wshift - 1] >> __sub_offset);
      if (__n == __wshift)
        _M_w[__n] = _M_w[0] << __offset;
--- 195,201 ----
      const size_t __sub_offset = __BITS_PER_WORDT(_WordT) - __offset;
      size_t __n = _Nw - 1;
      for ( ; __n > __wshift; --__n)
!       _M_w[__n] = (_M_w[__n - __wshift] << __offset) |
                  (_M_w[__n - __wshift - 1] >> __sub_offset);
      if (__n == __wshift)
        _M_w[__n] = _M_w[0] << __offset;
*************** void _Base_bitset<_Nw, _WordT>::_M_do_le
*** 205,211 ****
  }
  
  template<size_t _Nw, class _WordT>
! void _Base_bitset<_Nw, _WordT>::_M_do_right_shift(size_t __shift) 
  {
    if (__shift != 0) {
      const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT);
--- 205,211 ----
  }
  
  template<size_t _Nw, class _WordT>
! void _Base_bitset<_Nw, _WordT>::_M_do_right_shift(size_t __shift)
  {
    if (__shift != 0) {
      const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT);
*************** void _Base_bitset<_Nw, _WordT>::_M_do_ri
*** 214,220 ****
      const size_t __limit = _Nw - __wshift - 1;
      size_t __n = 0;
      for ( ; __n < __limit; ++__n)
!       _M_w[__n] = (_M_w[__n + __wshift] >> __offset) | 
                    (_M_w[__n + __wshift + 1] << __sub_offset);
      _M_w[__limit] = _M_w[_Nw-1] >> __offset;
      for (size_t __n1 = __limit + 1; __n1 < _Nw; ++__n1)
--- 214,220 ----
      const size_t __limit = _Nw - __wshift - 1;
      size_t __n = 0;
      for ( ; __n < __limit; ++__n)
!       _M_w[__n] = (_M_w[__n + __wshift] >> __offset) |
                    (_M_w[__n + __wshift + 1] << __sub_offset);
      _M_w[__limit] = _M_w[_Nw-1] >> __offset;
      for (size_t __n1 = __limit + 1; __n1 < _Nw; ++__n1)
*************** unsigned long _Base_bitset<_Nw, _WordT>:
*** 228,239 ****
    const overflow_error __overflow("bitset");
  
    if (sizeof(_WordT) >= sizeof(unsigned long)) {
!     for (size_t __i = 1; __i < _Nw; ++__i) 
!       if (_M_w[__i]) 
          __STL_THROW(__overflow);
  
      const _WordT __mask = static_cast<_WordT>(static_cast<unsigned long>(-1));
!     if (_M_w[0] & ~__mask) 
        __STL_THROW(__overflow);
  
      return static_cast<unsigned long>(_M_w[0] & __mask);
--- 228,239 ----
    const overflow_error __overflow("bitset");
  
    if (sizeof(_WordT) >= sizeof(unsigned long)) {
!     for (size_t __i = 1; __i < _Nw; ++__i)
!       if (_M_w[__i])
          __STL_THROW(__overflow);
  
      const _WordT __mask = static_cast<_WordT>(static_cast<unsigned long>(-1));
!     if (_M_w[0] & ~__mask)
        __STL_THROW(__overflow);
  
      return static_cast<unsigned long>(_M_w[0] & __mask);
*************** unsigned long _Base_bitset<_Nw, _WordT>:
*** 244,261 ****
  
      size_t __min_nwords = __nwords;
      if (_Nw > __nwords) {
!       for (size_t __i = __nwords; __i < _Nw; ++__i) 
!         if (_M_w[__i]) 
            __STL_THROW(__overflow);
      }
!     else 
        __min_nwords = _Nw;
!       
      // If unsigned long is 8 bytes and _WordT is 6 bytes, then an unsigned
      // long consists of all of one word plus 2 bytes from another word.
      const size_t __part = sizeof(unsigned long) % sizeof(_WordT);
  
!     if (__part != 0 && __nwords <= _Nw && 
          (_M_w[__min_nwords - 1] >> ((sizeof(_WordT) - __part) * CHAR_BIT)) != 0)
        __STL_THROW(__overflow);
  
--- 244,261 ----
  
      size_t __min_nwords = __nwords;
      if (_Nw > __nwords) {
!       for (size_t __i = __nwords; __i < _Nw; ++__i)
!         if (_M_w[__i])
            __STL_THROW(__overflow);
      }
!     else
        __min_nwords = _Nw;
! 
      // If unsigned long is 8 bytes and _WordT is 6 bytes, then an unsigned
      // long consists of all of one word plus 2 bytes from another word.
      const size_t __part = sizeof(unsigned long) % sizeof(_WordT);
  
!     if (__part != 0 && __nwords <= _Nw &&
          (_M_w[__min_nwords - 1] >> ((sizeof(_WordT) - __part) * CHAR_BIT)) != 0)
        __STL_THROW(__overflow);
  
*************** unsigned long _Base_bitset<_Nw, _WordT>:
*** 269,275 ****
  } // End _M_do_to_ulong
  
  template<size_t _Nw, class _WordT>
! size_t _Base_bitset<_Nw, _WordT>::_M_do_find_first(size_t __not_found) const 
  {
    for ( size_t __i = 0; __i < _Nw; __i++ ) {
      _WordT __thisword = _M_w[__i];
--- 269,275 ----
  } // End _M_do_to_ulong
  
  template<size_t _Nw, class _WordT>
! size_t _Base_bitset<_Nw, _WordT>::_M_do_find_first(size_t __not_found) const
  {
    for ( size_t __i = 0; __i < _Nw; __i++ ) {
      _WordT __thisword = _M_w[__i];
*************** size_t _Base_bitset<_Nw, _WordT>::_M_do_
*** 292,298 ****
  
  template<size_t _Nw, class _WordT>
  size_t
! _Base_bitset<_Nw, _WordT>::_M_do_find_next(size_t __prev, 
                                             size_t __not_found) const
  {
    // make bound inclusive
--- 292,298 ----
  
  template<size_t _Nw, class _WordT>
  size_t
! _Base_bitset<_Nw, _WordT>::_M_do_find_next(size_t __prev,
                                             size_t __not_found) const
  {
    // make bound inclusive
*************** struct _Base_bitset<1, _WordT> {
*** 359,365 ****
  
    _Base_bitset( void ) { _M_do_reset(); }
  
!   _Base_bitset(unsigned long __val); 
  
    static size_t _S_whichword( size_t __pos ) {
      return __pos / __BITS_PER_WORDT(_WordT);
--- 359,365 ----
  
    _Base_bitset( void ) { _M_do_reset(); }
  
!   _Base_bitset(unsigned long __val);
  
    static size_t _S_whichword( size_t __pos ) {
      return __pos / __BITS_PER_WORDT(_WordT);
*************** struct _Base_bitset<1, _WordT> {
*** 412,418 ****
          return static_cast<unsigned long>(_M_w);
      else {
        const _WordT __mask = static_cast<_WordT>(static_cast<unsigned long>(-1));
!       if (_M_w & ~__mask) 
          __STL_THROW(overflow_error("bitset"));
        return static_cast<unsigned long>(_M_w);
      }
--- 412,418 ----
          return static_cast<unsigned long>(_M_w);
      else {
        const _WordT __mask = static_cast<_WordT>(static_cast<unsigned long>(-1));
!       if (_M_w & ~__mask)
          __STL_THROW(overflow_error("bitset"));
        return static_cast<unsigned long>(_M_w);
      }
*************** struct _Base_bitset<1, _WordT> {
*** 421,427 ****
    size_t _M_do_find_first(size_t __not_found) const;
  
    // find the next "on" bit that follows "prev"
!   size_t _M_do_find_next(size_t __prev, size_t __not_found) const; 
  
  };
  
--- 421,427 ----
    size_t _M_do_find_first(size_t __not_found) const;
  
    // find the next "on" bit that follows "prev"
!   size_t _M_do_find_next(size_t __prev, size_t __not_found) const;
  
  };
  
*************** struct _Base_bitset<1, _WordT> {
*** 431,437 ****
  //
  
  template <class _WordT>
! _Base_bitset<1, _WordT>::_Base_bitset(unsigned long __val) 
  {
    _M_do_reset();
    const size_t __n = min(sizeof(unsigned long)*CHAR_BIT,
--- 431,437 ----
  //
  
  template <class _WordT>
! _Base_bitset<1, _WordT>::_Base_bitset(unsigned long __val)
  {
    _M_do_reset();
    const size_t __n = min(sizeof(unsigned long)*CHAR_BIT,
*************** size_t _Base_bitset<1, _WordT>::_M_do_fi
*** 462,469 ****
  }
  
  template <class _WordT>
! size_t 
! _Base_bitset<1, _WordT>::_M_do_find_next(size_t __prev, 
                                           size_t __not_found ) const
  {
    // make bound inclusive
--- 462,469 ----
  }
  
  template <class _WordT>
! size_t
! _Base_bitset<1, _WordT>::_M_do_find_next(size_t __prev,
                                           size_t __not_found ) const
  {
    // make bound inclusive
*************** _Base_bitset<1, _WordT>::_M_do_find_next
*** 499,510 ****
  
  //
  // One last specialization: _M_do_to_ulong() and the constructor from
! // unsigned long are very simple if the bitset consists of a single 
  // word of type unsigned long.
  //
  
  template<>
! inline unsigned long 
  _Base_bitset<1, unsigned long>::_M_do_to_ulong() const { return _M_w; }
  
  template<>
--- 499,510 ----
  
  //
  // One last specialization: _M_do_to_ulong() and the constructor from
! // unsigned long are very simple if the bitset consists of a single
  // word of type unsigned long.
  //
  
  template<>
! inline unsigned long
  _Base_bitset<1, unsigned long>::_M_do_to_ulong() const { return _M_w; }
  
  template<>
*************** template <class _WordT> struct _Sanitize
*** 531,537 ****
  //   Type _WordT may be any unsigned integral type.
  
  template<size_t _Nb, class _WordT = unsigned long>
! class bitset : private _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> 
  {
  private:
    typedef _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> _Base;
--- 531,537 ----
  //   Type _WordT may be any unsigned integral type.
  
  template<size_t _Nb, class _WordT = unsigned long>
! class bitset : private _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT>
  {
  private:
    typedef _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> _Base;
*************** public:
*** 620,635 ****
  
    // 23.3.5.1 constructors:
    bitset() {}
!   bitset(unsigned long __val) : 
      _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT>(__val) {}
  
    template<class _CharT, class _Traits, class _Alloc>
    explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s,
                    size_t __pos = 0,
!                   size_t __n = size_t(basic_string<_CharT,_Traits,_Alloc>::npos))
!     : _Base() 
    {
!     if (__pos > __s.size()) 
        __STL_THROW(out_of_range("bitset"));
      _M_copy_from_string(__s, __pos, __n);
    }
--- 620,635 ----
  
    // 23.3.5.1 constructors:
    bitset() {}
!   bitset(unsigned long __val) :
      _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT>(__val) {}
  
    template<class _CharT, class _Traits, class _Alloc>
    explicit bitset(const basic_string<_CharT,_Traits,_Alloc>& __s,
                    size_t __pos = 0,
!                   size_t __n = basic_string<_CharT,_Traits,_Alloc>::npos)
!     : _Base()
    {
!     if (__pos > __s.size())
        __STL_THROW(out_of_range("bitset"));
      _M_copy_from_string(__s, __pos, __n);
    }
*************** public:
*** 742,748 ****
      return _Unchecked_flip(__pos);
    }
  
!   bitset<_Nb,_WordT> operator~() const { 
      return bitset<_Nb,_WordT>(*this).flip();
    }
  
--- 742,748 ----
      return _Unchecked_flip(__pos);
    }
  
!   bitset<_Nb,_WordT> operator~() const {
      return bitset<_Nb,_WordT>(*this).flip();
    }
  
*************** public:
*** 753,759 ****
  
    unsigned long to_ulong() const { return _M_do_to_ulong(); }
  
! #ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS
    template <class _CharT, class _Traits, class _Alloc>
    basic_string<_CharT, _Traits, _Alloc> to_string() const {
      basic_string<_CharT, _Traits, _Alloc> __result;
--- 753,759 ----
  
    unsigned long to_ulong() const { return _M_do_to_ulong(); }
  
! #if __STL_EXPLICIT_FUNCTION_TMPL_ARGS
    template <class _CharT, class _Traits, class _Alloc>
    basic_string<_CharT, _Traits, _Alloc> to_string() const {
      basic_string<_CharT, _Traits, _Alloc> __result;
*************** public:
*** 802,815 ****
    // EXTENSIONS: bit-find operations.  These operations are
    // experimental, and are subject to change or removal in future
    // versions.
!   // 
  
    // find the index of the first "on" bit
!   size_t _Find_first() const 
      { return _M_do_find_first(_Nb); }
  
    // find the index of the next "on" bit after prev
!   size_t _Find_next( size_t __prev ) const 
      { return _M_do_find_next(__prev, _Nb); }
  
  };
--- 802,815 ----
    // EXTENSIONS: bit-find operations.  These operations are
    // experimental, and are subject to change or removal in future
    // versions.
!   //
  
    // find the index of the first "on" bit
!   size_t _Find_first() const
      { return _M_do_find_first(_Nb); }
  
    // find the index of the next "on" bit after prev
!   size_t _Find_next( size_t __prev ) const
      { return _M_do_find_next(__prev, _Nb); }
  
  };
*************** void bitset<_Nb, _WordT>
*** 846,853 ****
    ::_M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const
  {
    __s.assign(_Nb, '0');
!   
!   for (size_t __i = 0; __i < _Nb; ++__i) 
      if (_Unchecked_test(__i))
        __s[_Nb - 1 - __i] = '1';
  }
--- 846,853 ----
    ::_M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const
  {
    __s.assign(_Nb, '0');
! 
!   for (size_t __i = 0; __i < _Nb; ++__i)
      if (_Unchecked_test(__i))
        __s[_Nb - 1 - __i] = '1';
  }
*************** operator>>(istream& __is, bitset<_Nb,_Wo
*** 894,900 ****
    // In new templatized iostreams, use istream::sentry
    if (__is.flags() & ios::skipws) {
      char __c;
!     do 
        __is.get(__c);
      while (__is && isspace(__c));
      if (__is)
--- 894,900 ----
    // In new templatized iostreams, use istream::sentry
    if (__is.flags() & ios::skipws) {
      char __c;
!     do
        __is.get(__c);
      while (__is && isspace(__c));
      if (__is)
*************** operator>>(istream& __is, bitset<_Nb,_Wo
*** 915,921 ****
        __tmp.push_back(__c);
    }
  
!   if (__tmp.empty()) 
      __is.clear(__is.rdstate() | ios::failbit);
    else
      __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb);
--- 915,921 ----
        __tmp.push_back(__c);
    }
  
!   if (__tmp.empty())
      __is.clear(__is.rdstate() | ios::failbit);
    else
      __x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb);
*************** __STL_END_NAMESPACE
*** 1061,1064 ****
  // Local Variables:
  // mode:C++
  // End:
- 
--- 1061,1063 ----



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]