From 554241c33e70d0eca1ee0e7cbc7113f7a24ab6c6 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 7 Apr 1999 03:20:00 +0000 Subject: [PATCH] Bring over lost changes from Cygnus's directory. * Missing ChangeLog entries. * Whitespace fixes. * Enable multilib by default * One stl fix (#ifdef -> #if) From-SVN: r26234 --- libstdc++/ChangeLog | 14 +++++++ libstdc++/configure.in | 5 +++ libstdc++/stl/bitset | 87 +++++++++++++++++++++--------------------- 3 files changed, 62 insertions(+), 44 deletions(-) diff --git a/libstdc++/ChangeLog b/libstdc++/ChangeLog index 658f5fd44ae..12a0e53039e 100644 --- a/libstdc++/ChangeLog +++ b/libstdc++/ChangeLog @@ -33,6 +33,20 @@ Thu Feb 18 19:53:17 1999 Marc Espie * config/openbsd.ml: New file. * config/openbsd.mt: New file. +1999-02-04 Ulrich Drepper + + * 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 * string: Uncomment wstring declaration. diff --git a/libstdc++/configure.in b/libstdc++/configure.in index 9590b6b363e..0f556cac551 100644 --- a/libstdc++/configure.in +++ b/libstdc++/configure.in @@ -176,6 +176,11 @@ if [ -n "${with_cross_host}" ] ; then 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= diff --git a/libstdc++/stl/bitset b/libstdc++/stl/bitset index 64fa5959232..36edf09659e 100644 --- a/libstdc++/stl/bitset +++ b/libstdc++/stl/bitset @@ -9,7 +9,7 @@ * 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,12 +19,12 @@ // 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 +// 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 +// 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. @@ -51,14 +51,14 @@ __STL_BEGIN_NAMESPACE #endif // structure to aid in counting bits -template +template 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 +template struct _First_one { static unsigned char _S_first_one[256]; }; @@ -162,7 +162,7 @@ struct _Base_bitset { return __result; } - unsigned long _M_do_to_ulong() const; + unsigned long _M_do_to_ulong() const; // find first "on" bit size_t _M_do_find_first(size_t __not_found) const; @@ -173,7 +173,7 @@ struct _Base_bitset { // // Definitions of non-inline functions from _Base_bitset. -// +// template _Base_bitset<_Nw, _WordT>::_Base_bitset(unsigned long __val) @@ -187,7 +187,7 @@ _Base_bitset<_Nw, _WordT>::_Base_bitset(unsigned long __val) } template -void _Base_bitset<_Nw, _WordT>::_M_do_left_shift(size_t __shift) +void _Base_bitset<_Nw, _WordT>::_M_do_left_shift(size_t __shift) { if (__shift != 0) { const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT); @@ -195,7 +195,7 @@ void _Base_bitset<_Nw, _WordT>::_M_do_left_shift(size_t __shift) 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] = (_M_w[__n - __wshift] << __offset) | (_M_w[__n - __wshift - 1] >> __sub_offset); if (__n == __wshift) _M_w[__n] = _M_w[0] << __offset; @@ -205,7 +205,7 @@ void _Base_bitset<_Nw, _WordT>::_M_do_left_shift(size_t __shift) } template -void _Base_bitset<_Nw, _WordT>::_M_do_right_shift(size_t __shift) +void _Base_bitset<_Nw, _WordT>::_M_do_right_shift(size_t __shift) { if (__shift != 0) { const size_t __wshift = __shift / __BITS_PER_WORDT(_WordT); @@ -214,7 +214,7 @@ void _Base_bitset<_Nw, _WordT>::_M_do_right_shift(size_t __shift) 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] = (_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) @@ -228,12 +228,12 @@ unsigned long _Base_bitset<_Nw, _WordT>::_M_do_to_ulong() const const overflow_error __overflow("bitset"); if (sizeof(_WordT) >= sizeof(unsigned long)) { - for (size_t __i = 1; __i < _Nw; ++__i) - if (_M_w[__i]) + for (size_t __i = 1; __i < _Nw; ++__i) + if (_M_w[__i]) __STL_THROW(__overflow); const _WordT __mask = static_cast<_WordT>(static_cast(-1)); - if (_M_w[0] & ~__mask) + if (_M_w[0] & ~__mask) __STL_THROW(__overflow); return static_cast(_M_w[0] & __mask); @@ -244,18 +244,18 @@ unsigned long _Base_bitset<_Nw, _WordT>::_M_do_to_ulong() const size_t __min_nwords = __nwords; if (_Nw > __nwords) { - for (size_t __i = __nwords; __i < _Nw; ++__i) - if (_M_w[__i]) + for (size_t __i = __nwords; __i < _Nw; ++__i) + if (_M_w[__i]) __STL_THROW(__overflow); } - else + 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 && + if (__part != 0 && __nwords <= _Nw && (_M_w[__min_nwords - 1] >> ((sizeof(_WordT) - __part) * CHAR_BIT)) != 0) __STL_THROW(__overflow); @@ -269,7 +269,7 @@ unsigned long _Base_bitset<_Nw, _WordT>::_M_do_to_ulong() const } // End _M_do_to_ulong template -size_t _Base_bitset<_Nw, _WordT>::_M_do_find_first(size_t __not_found) const +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]; @@ -292,7 +292,7 @@ size_t _Base_bitset<_Nw, _WordT>::_M_do_find_first(size_t __not_found) const template size_t -_Base_bitset<_Nw, _WordT>::_M_do_find_next(size_t __prev, +_Base_bitset<_Nw, _WordT>::_M_do_find_next(size_t __prev, size_t __not_found) const { // make bound inclusive @@ -359,7 +359,7 @@ struct _Base_bitset<1, _WordT> { _Base_bitset( void ) { _M_do_reset(); } - _Base_bitset(unsigned long __val); + _Base_bitset(unsigned long __val); static size_t _S_whichword( size_t __pos ) { return __pos / __BITS_PER_WORDT(_WordT); @@ -412,7 +412,7 @@ struct _Base_bitset<1, _WordT> { return static_cast(_M_w); else { const _WordT __mask = static_cast<_WordT>(static_cast(-1)); - if (_M_w & ~__mask) + if (_M_w & ~__mask) __STL_THROW(overflow_error("bitset")); return static_cast(_M_w); } @@ -421,7 +421,7 @@ struct _Base_bitset<1, _WordT> { 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; + size_t _M_do_find_next(size_t __prev, size_t __not_found) const; }; @@ -431,7 +431,7 @@ struct _Base_bitset<1, _WordT> { // template -_Base_bitset<1, _WordT>::_Base_bitset(unsigned long __val) +_Base_bitset<1, _WordT>::_Base_bitset(unsigned long __val) { _M_do_reset(); const size_t __n = min(sizeof(unsigned long)*CHAR_BIT, @@ -462,8 +462,8 @@ size_t _Base_bitset<1, _WordT>::_M_do_find_first(size_t __not_found) const } template -size_t -_Base_bitset<1, _WordT>::_M_do_find_next(size_t __prev, +size_t +_Base_bitset<1, _WordT>::_M_do_find_next(size_t __prev, size_t __not_found ) const { // make bound inclusive @@ -499,12 +499,12 @@ _Base_bitset<1, _WordT>::_M_do_find_next(size_t __prev, // // One last specialization: _M_do_to_ulong() and the constructor from -// unsigned long are very simple if the bitset consists of a single +// unsigned long are very simple if the bitset consists of a single // word of type unsigned long. // template<> -inline unsigned long +inline unsigned long _Base_bitset<1, unsigned long>::_M_do_to_ulong() const { return _M_w; } template<> @@ -531,7 +531,7 @@ template struct _Sanitize<_WordT, 0> { // Type _WordT may be any unsigned integral type. template -class bitset : private _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> +class bitset : private _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> { private: typedef _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT> _Base; @@ -620,16 +620,16 @@ public: // 23.3.5.1 constructors: bitset() {} - bitset(unsigned long __val) : + bitset(unsigned long __val) : _Base_bitset<__BITSET_WORDS(_Nb,_WordT), _WordT>(__val) {} template 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() + size_t __n = basic_string<_CharT,_Traits,_Alloc>::npos) + : _Base() { - if (__pos > __s.size()) + if (__pos > __s.size()) __STL_THROW(out_of_range("bitset")); _M_copy_from_string(__s, __pos, __n); } @@ -742,7 +742,7 @@ public: return _Unchecked_flip(__pos); } - bitset<_Nb,_WordT> operator~() const { + bitset<_Nb,_WordT> operator~() const { return bitset<_Nb,_WordT>(*this).flip(); } @@ -753,7 +753,7 @@ public: unsigned long to_ulong() const { return _M_do_to_ulong(); } -#ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS +#if __STL_EXPLICIT_FUNCTION_TMPL_ARGS template basic_string<_CharT, _Traits, _Alloc> to_string() const { basic_string<_CharT, _Traits, _Alloc> __result; @@ -802,14 +802,14 @@ public: // 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 + 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 + size_t _Find_next( size_t __prev ) const { return _M_do_find_next(__prev, _Nb); } }; @@ -846,8 +846,8 @@ void bitset<_Nb, _WordT> ::_M_copy_to_string(basic_string<_CharT, _Traits, _Alloc>& __s) const { __s.assign(_Nb, '0'); - - for (size_t __i = 0; __i < _Nb; ++__i) + + for (size_t __i = 0; __i < _Nb; ++__i) if (_Unchecked_test(__i)) __s[_Nb - 1 - __i] = '1'; } @@ -894,7 +894,7 @@ operator>>(istream& __is, bitset<_Nb,_WordT>& __x) { // In new templatized iostreams, use istream::sentry if (__is.flags() & ios::skipws) { char __c; - do + do __is.get(__c); while (__is && isspace(__c)); if (__is) @@ -915,7 +915,7 @@ operator>>(istream& __is, bitset<_Nb,_WordT>& __x) { __tmp.push_back(__c); } - if (__tmp.empty()) + if (__tmp.empty()) __is.clear(__is.rdstate() | ios::failbit); else __x._M_copy_from_string(__tmp, static_cast(0), _Nb); @@ -1061,4 +1061,3 @@ __STL_END_NAMESPACE // Local Variables: // mode:C++ // End: -