From: bkoz Date: Tue, 17 Oct 2006 11:56:21 +0000 (+0000) Subject: 2006-10-17 Benjamin Kosnik X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=1f28bef86dc39e2b42ad16e8a8d18daa39c76ea4;p=pf3gnuchains%2Fgcc-fork.git 2006-10-17 Benjamin Kosnik PR libstdc++/28514 * include/bits/cpp_type_traits.h (__detail): Uglify namespace. * include/ext/rope: Remove global-scope anonymous namespace, use nested __detail. Fixup resulting formatting issues. * include/ext/ropeimpl.h: Same. * include/tr1/hashtable_policy.h: Remove anonymous namespace nesting for __detail. * include/tr1/random: Revert anonymous namespace to nested __detail namespace. * include/tr1/random.tcc: Same. * src/ext-inst.cc: Fixups for above. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117824 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0bac304ba15..fb2e68d1348 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,17 @@ +2006-10-17 Benjamin Kosnik + + PR libstdc++/28514 + * include/bits/cpp_type_traits.h (__detail): Uglify namespace. + * include/ext/rope: Remove global-scope anonymous namespace, use + nested __detail. Fixup resulting formatting issues. + * include/ext/ropeimpl.h: Same. + * include/tr1/hashtable_policy.h: Remove anonymous namespace + nesting for __detail. + * include/tr1/random: Revert anonymous namespace to nested + __detail namespace. + * include/tr1/random.tcc: Same. + * src/ext-inst.cc: Fixups for above. + 2006-10-16 Douglas Gregor * include/Makefile.am (tr1_headers): Add new tuple_defs.h. diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h index e600fcdd6c1..3132334578e 100644 --- a/libstdc++-v3/include/bits/cpp_type_traits.h +++ b/libstdc++-v3/include/bits/cpp_type_traits.h @@ -83,7 +83,7 @@ struct __false_type { }; _GLIBCXX_BEGIN_NAMESPACE(std) -namespace detail +namespace __detail { // NB: g++ can not compile these if declared within the class // __is_pod itself. @@ -94,7 +94,7 @@ namespace detail __one __test_type(int _Tp::*); template __two& __test_type(...); -} // namespace detail +} // namespace __detail template struct __truth_type @@ -346,8 +346,8 @@ namespace detail { enum { - __value = (sizeof(detail::__test_type<_Tp>(0)) - != sizeof(detail::__one)) + __value = (sizeof(__detail::__test_type<_Tp>(0)) + != sizeof(__detail::__one)) }; }; diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope index d24366c95c5..0cfd21e4462 100644 --- a/libstdc++-v3/include/ext/rope +++ b/libstdc++-v3/include/ext/rope @@ -67,14 +67,14 @@ #include // For uninitialized_copy_n -namespace -{ - enum { _S_max_rope_depth = 45 }; - enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function}; -} // anonymous namespace - _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + namespace __detail + { + enum { _S_max_rope_depth = 45 }; + enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function}; + } // namespace __detail + using std::size_t; using std::ptrdiff_t; using std::allocator; @@ -138,7 +138,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) class char_producer { public: - virtual ~char_producer() {}; + virtual ~char_producer() { }; virtual void operator()(size_t __start_pos, size_t __len, @@ -302,7 +302,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) // compile-time would do. Hence this should all be private // for now. // The symmetry with char_producer is accidental and temporary. - virtual ~_Rope_char_consumer() {}; + virtual ~_Rope_char_consumer() { }; virtual bool operator()(const _CharT* __buffer, size_t __len) = 0; @@ -535,7 +535,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) { return *static_cast(this); } _Rope_rep_base(size_t __size, const allocator_type&) - : _M_size(__size) {} + : _M_size(__size) { } size_t _M_size; @@ -558,7 +558,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) # endif { public: - _Tag _M_tag:8; + __detail::_Tag _M_tag:8; bool _M_is_balanced:8; unsigned char _M_depth; __GC_CONST _CharT* _M_c_string; @@ -574,7 +574,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) using _Rope_rep_base<_CharT, _Alloc>::get_allocator; - _Rope_RopeRep(_Tag __t, int __d, bool __b, size_t __size, + _Rope_RopeRep(__detail::_Tag __t, int __d, bool __b, size_t __size, allocator_type __a) : _Rope_rep_base<_CharT, _Alloc>(__size, __a), #ifndef __GC @@ -592,7 +592,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) #endif #ifdef __GC void - _M_incr () {} + _M_incr () { } #endif static void _S_free_string(__GC_CONST _CharT*, size_t __len, @@ -640,11 +640,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) __t->_M_free_tree(); } # else /* __GC */ - void _M_unref_nonnil() {} - void _M_ref_nonnil() {} - static void _S_unref(_Rope_RopeRep*) {} - static void _S_ref(_Rope_RopeRep*) {} - static void _S_free_if_unref(_Rope_RopeRep*) {} + void _M_unref_nonnil() { } + void _M_ref_nonnil() { } + static void _S_unref(_Rope_RopeRep*) { } + static void _S_ref(_Rope_RopeRep*) { } + static void _S_free_if_unref(_Rope_RopeRep*) { } # endif protected: _Rope_RopeRep& @@ -691,7 +691,7 @@ protected: _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size, allocator_type __a) - : _Rope_RopeRep<_CharT, _Alloc>(_S_leaf, 0, true, + : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_leaf, 0, true, __size, __a), _M_data(__d) { if (_S_is_basic_char_type((_CharT *)0)) @@ -733,7 +733,7 @@ protected: _Rope_RopeConcatenation(_Rope_RopeRep<_CharT, _Alloc>* __l, _Rope_RopeRep<_CharT, _Alloc>* __r, allocator_type __a) - : _Rope_RopeRep<_CharT, _Alloc>(::_S_concat, + : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_concat, std::max(__l->_M_depth, __r->_M_depth) + 1, false, @@ -781,7 +781,7 @@ protected: _Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size, bool __d, allocator_type __a) - : _Rope_RopeRep<_CharT, _Alloc>(::_S_function, 0, true, __size, __a) + : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_function, 0, true, __size, __a) , _M_fn(__f) #ifndef __GC , _M_delete_when_done(__d) @@ -832,15 +832,15 @@ protected: { switch(_M_base->_M_tag) { - case ::_S_function: - case ::_S_substringfn: + case __detail::_S_function: + case __detail::_S_substringfn: { char_producer<_CharT>* __fn = ((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn; (*__fn)(__start_pos + _M_start, __req_len, __buffer); } break; - case ::_S_leaf: + case __detail::_S_leaf: { __GC_CONST _CharT* __s = ((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data; @@ -864,7 +864,7 @@ protected: #ifndef __GC _M_base->_M_ref_nonnil(); #endif - this->_M_tag = ::_S_substringfn; + this->_M_tag = __detail::_S_substringfn; } virtual ~_Rope_RopeSubstring() throw() { @@ -893,12 +893,12 @@ protected: ~_Rope_self_destruct_ptr() { _Rope_RopeRep<_CharT, _Alloc>::_S_unref(_M_ptr); } #ifdef __EXCEPTIONS - _Rope_self_destruct_ptr() : _M_ptr(0) {}; + _Rope_self_destruct_ptr() : _M_ptr(0) { }; #else - _Rope_self_destruct_ptr() {}; + _Rope_self_destruct_ptr() { }; #endif _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT, _Alloc>* __p) - : _M_ptr(__p) {} + : _M_ptr(__p) { } _Rope_RopeRep<_CharT, _Alloc>& operator*() @@ -941,18 +941,18 @@ protected: _My_rope* _M_root; // The whole rope. public: _Rope_char_ref_proxy(_My_rope* __r, size_t __p) - : _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) {} + : _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) { } _Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x) - : _M_pos(__x._M_pos), _M_current(__x._M_current), _M_current_valid(false), - _M_root(__x._M_root) {} + : _M_pos(__x._M_pos), _M_current(__x._M_current), + _M_current_valid(false), _M_root(__x._M_root) { } // Don't preserve cache if the reference can outlive the // expression. We claim that's not possible without calling // a copy constructor or generating reference to a proxy // reference. We declare the latter to have undefined semantics. _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c) - : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {} + : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) { } inline operator _CharT () const; @@ -985,12 +985,12 @@ protected: rope<_CharT,_Alloc>* _M_root; // The whole rope. public: _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x) - : _M_pos(__x._M_pos), _M_root(__x._M_root) {} + : _M_pos(__x._M_pos), _M_root(__x._M_root) { } _Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x) - : _M_pos(__x._M_pos), _M_root(__x._M_root) {} + : _M_pos(__x._M_pos), _M_root(__x._M_root) { } - _Rope_char_ptr_proxy() {} + _Rope_char_ptr_proxy() { } _Rope_char_ptr_proxy(_CharT* __x) : _M_root(0), _M_pos(0) { } @@ -1074,10 +1074,10 @@ protected: static void _S_setcache_for_incr(_Rope_iterator_base& __x); // As above, but assumes path // cache is valid for previous posn. - _Rope_iterator_base() {} + _Rope_iterator_base() { } _Rope_iterator_base(_RopeRep* __root, size_t __pos) - : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) {} + : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) { } void _M_incr(size_t __n); void _M_decr(size_t __n); @@ -1114,7 +1114,7 @@ protected: : _Rope_iterator_base<_CharT, _Alloc>(const_cast<_RopeRep*>(__root), __pos) // Only nonconst iterators modify root ref count - {} + { } public: typedef _CharT reference; // Really a value. Returning a reference // Would be a mess, since it would have @@ -1122,7 +1122,7 @@ protected: typedef const _CharT* pointer; public: - _Rope_const_iterator() {}; + _Rope_const_iterator() { }; _Rope_const_iterator(const _Rope_const_iterator& __x) : _Rope_iterator_base<_CharT,_Alloc>(__x) { } @@ -1267,13 +1267,13 @@ protected: protected: typedef typename _Rope_iterator_base<_CharT, _Alloc>::_RopeRep _RopeRep; rope<_CharT, _Alloc>* _M_root_rope; - // root is treated as a cached version of this, - // and is used to detect changes to the underlying - // rope. - // Root is included in the reference count. - // This is necessary so that we can detect changes reliably. - // Unfortunately, it requires careful bookkeeping for the - // nonGC case. + + // root is treated as a cached version of this, and is used to + // detect changes to the underlying rope. + + // Root is included in the reference count. This is necessary + // so that we can detect changes reliably. Unfortunately, it + // requires careful bookkeeping for the nonGC case. _Rope_iterator(rope<_CharT, _Alloc>* __r, size_t __pos) : _Rope_iterator_base<_CharT, _Alloc>(__r->_M_tree_ptr, __pos), _M_root_rope(__r) @@ -1287,7 +1287,6 @@ protected: typedef _Rope_char_ref_proxy<_CharT, _Alloc> reference; typedef _Rope_char_ref_proxy<_CharT, _Alloc>* pointer; - public: rope<_CharT, _Alloc>& container() { return *_M_root_rope; } @@ -1450,9 +1449,9 @@ protected: // The one in _Base may not be visible due to template rules. _Rope_base(_RopeRep* __t, const allocator_type&) - : _M_tree_ptr(__t) {} + : _M_tree_ptr(__t) { } - _Rope_base(const allocator_type&) {} + _Rope_base(const allocator_type&) { } // The only data member of a rope: _RopeRep *_M_tree_ptr; @@ -1554,8 +1553,8 @@ protected: { _RopeRep::_S_ref(__t); } #else /* __GC */ - static void _S_unref(_RopeRep*) {} - static void _S_ref(_RopeRep*) {} + static void _S_unref(_RopeRep*) { } + static void _S_ref(_RopeRep*) { } #endif #ifdef __GC @@ -1711,7 +1710,7 @@ protected: _CharT* __buffer); static const unsigned long - _S_min_len[::_S_max_rope_depth + 1]; + _S_min_len[__detail::_S_max_rope_depth + 1]; static bool _S_is_balanced(_RopeRep* __r) @@ -1818,9 +1817,9 @@ protected: const allocator_type& __a = allocator_type()); rope(const allocator_type& __a = allocator_type()) - : _Base(0, __a) {} + : _Base(0, __a) { } - // Construct a rope from a function that can compute its members + // Construct a rope from a function that can compute its members rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn, const allocator_type& __a = allocator_type()) : _Base(__a) @@ -1866,9 +1865,8 @@ protected: pop_back() { _RopeRep* __old = this->_M_tree_ptr; - this->_M_tree_ptr = - _S_substring(this->_M_tree_ptr, - 0, this->_M_tree_ptr->_M_size - 1); + this->_M_tree_ptr = _S_substring(this->_M_tree_ptr, + 0, this->_M_tree_ptr->_M_size - 1); _S_unref(__old); } @@ -1961,7 +1959,7 @@ protected: { if (0 == this->_M_tree_ptr) return; - if (::_S_leaf == this->_M_tree_ptr->_M_tag && + if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag && ((_RopeLeaf*)this->_M_tree_ptr)->_M_data == this->_M_tree_ptr->_M_c_string) { @@ -2013,7 +2011,7 @@ protected: size_type max_size() const { - return _S_min_len[int(::_S_max_rope_depth) - 1] - 1; + return _S_min_len[int(__detail::_S_max_rope_depth) - 1] - 1; // Guarantees that the result can be sufficirntly // balanced. Longer ropes will probably still work, // but it's harder to make guarantees. @@ -2049,12 +2047,13 @@ protected: template friend rope<_CharT2, _Alloc2> operator+(const rope<_CharT2, _Alloc2>& __left, _CharT2 __right); - // The symmetric cases are intentionally omitted, since they're presumed - // to be less common, and we don't handle them as well. - // The following should really be templatized. - // The first argument should be an input iterator or - // forward iterator with value_type _CharT. + // The symmetric cases are intentionally omitted, since they're + // presumed to be less common, and we don't handle them as well. + + // The following should really be templatized. The first + // argument should be an input iterator or forward iterator with + // value_type _CharT. rope& append(const _CharT* __iter, size_t __n) { @@ -2576,9 +2575,9 @@ protected: return (*this)[__pos]; } - void resize(size_type __n, _CharT __c) {} - void resize(size_type __n) {} - void reserve(size_type __res_arg = 0) {} + void resize(size_type __n, _CharT __c) { } + void resize(size_type __n) { } + void reserve(size_type __res_arg = 0) { } size_type capacity() const @@ -2747,21 +2746,21 @@ protected: __x._M_current_pos + __n); } template - inline _Rope_iterator<_CharT,_Alloc> + inline _Rope_iterator<_CharT, _Alloc> operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x) { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope, __x._M_current_pos + __n); } template - inline rope<_CharT,_Alloc> + inline rope<_CharT, _Alloc> operator+(const rope<_CharT, _Alloc>& __left, const rope<_CharT, _Alloc>& __right) { - return rope<_CharT, _Alloc>(rope<_CharT, _Alloc>:: - _S_concat(__left._M_tree_ptr, - __right._M_tree_ptr)); // Inlining this should make it possible to keep __left and // __right in registers. + typedef rope<_CharT, _Alloc> rope_type; + return rope_type(rope_type::_S_concat(__left._M_tree_ptr, + __right._M_tree_ptr)); } template @@ -2778,9 +2777,9 @@ protected: operator+(const rope<_CharT, _Alloc>& __left, const _CharT* __right) { - size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right); - return rope<_CharT, _Alloc>(rope<_CharT, _Alloc>:: - _S_concat_char_iter(__left._M_tree_ptr, + typedef rope<_CharT, _Alloc> rope_type; + size_t __rlen = rope_type::_S_char_ptr_len(__right); + return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr, __right, __rlen)); } @@ -2797,8 +2796,8 @@ protected: inline rope<_CharT, _Alloc> operator+(const rope<_CharT, _Alloc>& __left, _CharT __right) { - return rope<_CharT, _Alloc>(rope<_CharT, _Alloc>:: - _S_concat_char_iter(__left._M_tree_ptr, + typedef rope<_CharT, _Alloc> rope_type; + return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr, &__right, 1)); } @@ -2887,7 +2886,6 @@ protected: operator()(const crope& __str) const { size_t __size = __str.size(); - if (0 == __size) return 0; return 13 * __str[0] + 5 * __str[__size - 1] + __size; @@ -2902,7 +2900,6 @@ protected: operator()(const wrope& __str) const { size_t __size = __str.size(); - if (0 == __size) return 0; return 13 * __str[0] + 5 * __str[__size - 1] + __size; diff --git a/libstdc++-v3/include/ext/ropeimpl.h b/libstdc++-v3/include/ext/ropeimpl.h index c7827e33515..bbe6b9970bf 100644 --- a/libstdc++-v3/include/ext/ropeimpl.h +++ b/libstdc++-v3/include/ext/ropeimpl.h @@ -78,13 +78,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) switch(__leaf->_M_tag) { - case ::_S_leaf: + case __detail::_S_leaf: __x._M_buf_start = ((_Rope_RopeLeaf<_CharT, _Alloc>*)__leaf)->_M_data; __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos); __x._M_buf_end = __x._M_buf_start + __leaf->_M_size; break; - case ::_S_function: - case ::_S_substringfn: + case __detail::_S_function: + case __detail::_S_substringfn: { size_t __len = _S_iterator_buf_len; size_t __buf_start_pos = __leaf_pos; @@ -117,7 +117,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) _Rope_iterator_base<_CharT, _Alloc>:: _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x) { - const _RopeRep* __path[int(::_S_max_rope_depth) + 1]; + const _RopeRep* __path[int(__detail::_S_max_rope_depth) + 1]; const _RopeRep* __curr_rope; int __curr_depth = -1; /* index into path */ size_t __curr_start_pos = 0; @@ -147,12 +147,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) __path[__curr_depth] = __curr_rope; switch(__curr_rope->_M_tag) { - case ::_S_leaf: - case ::_S_function: - case ::_S_substringfn: + case __detail::_S_leaf: + case __detail::_S_function: + case __detail::_S_substringfn: __x._M_leaf_pos = __curr_start_pos; goto done; - case ::_S_concat: + case __detail::_S_concat: { _Rope_RopeConcatenation<_CharT, _Alloc>* __c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__curr_rope; @@ -234,7 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) __current_node = __c->_M_right; __x._M_path_end[++__current_index] = __current_node; __dirns |= 1; - while (::_S_concat == __current_node->_M_tag) + while (__detail::_S_concat == __current_node->_M_tag) { ++__current_index; if (int(_S_path_cache_len) == __current_index) @@ -378,7 +378,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) { switch(_M_tag) { - case ::_S_leaf: + case __detail::_S_leaf: { _Rope_RopeLeaf<_CharT, _Alloc>* __l = (_Rope_RopeLeaf<_CharT, _Alloc>*)this; @@ -386,7 +386,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) _L_deallocate(__l, 1); break; } - case ::_S_concat: + case __detail::_S_concat: { _Rope_RopeConcatenation<_CharT,_Alloc>* __c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)this; @@ -395,7 +395,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) _C_deallocate(__c, 1); break; } - case ::_S_function: + case __detail::_S_function: { _Rope_RopeFunction<_CharT, _Alloc>* __f = (_Rope_RopeFunction<_CharT, _Alloc>*)this; @@ -403,7 +403,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) _F_deallocate(__f, 1); break; } - case ::_S_substringfn: + case __detail::_S_substringfn: { _Rope_RopeSubstring<_CharT, _Alloc>* __ss = (_Rope_RopeSubstring<_CharT, _Alloc>*)this; @@ -503,7 +503,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) if (__depth > 20 && (__result->_M_size < 1000 - || __depth > size_t(::_S_max_rope_depth))) + || __depth > size_t(__detail::_S_max_rope_depth))) { _RopeRep* __balanced; @@ -541,14 +541,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) if (0 == __r) return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator()); - if (__r->_M_tag == ::_S_leaf + if (__r->_M_tag == __detail::_S_leaf && __r->_M_size + __slen <= size_t(_S_copy_max)) { __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); return __result; } - if (::_S_concat == __r->_M_tag - && ::_S_leaf == ((_RopeConcatenation*) __r)->_M_right->_M_tag) + if (__detail::_S_concat == __r->_M_tag + && __detail::_S_leaf == ((_RopeConcatenation*) __r)->_M_right->_M_tag) { _RopeLeaf* __right = (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right); @@ -605,17 +605,17 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) return __r; } if (__orig_size + __slen <= size_t(_S_copy_max) - && ::_S_leaf == __r->_M_tag) + && __detail::_S_leaf == __r->_M_tag) { __result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); return __result; } - if (::_S_concat == __r->_M_tag) + if (__detail::_S_concat == __r->_M_tag) { _RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*) __r)->_M_right); - if (::_S_leaf == __right->_M_tag + if (__detail::_S_leaf == __right->_M_tag && __right->_M_size + __slen <= size_t(_S_copy_max)) { _RopeRep* __new_right = @@ -665,17 +665,17 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) __left->_M_ref_nonnil(); return __left; } - if (::_S_leaf == __right->_M_tag) + if (__detail::_S_leaf == __right->_M_tag) { - if (::_S_leaf == __left->_M_tag) + if (__detail::_S_leaf == __left->_M_tag) { if (__right->_M_size + __left->_M_size <= size_t(_S_copy_max)) return _S_leaf_concat_char_iter((_RopeLeaf*)__left, ((_RopeLeaf*)__right)->_M_data, __right->_M_size); } - else if (::_S_concat == __left->_M_tag - && ::_S_leaf == ((_RopeConcatenation*) + else if (__detail::_S_concat == __left->_M_tag + && __detail::_S_leaf == ((_RopeConcatenation*) __left)->_M_right->_M_tag) { _RopeLeaf* __leftright = @@ -740,7 +740,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) switch(__base->_M_tag) { - case ::_S_concat: + case __detail::_S_concat: { _RopeConcatenation* __c = (_RopeConcatenation*)__base; _RopeRep* __left = __c->_M_left; @@ -762,7 +762,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) __result = _S_concat(__left_result, __right_result); return __result; } - case ::_S_leaf: + case __detail::_S_leaf: { _RopeLeaf* __l = (_RopeLeaf*)__base; _RopeLeaf* __result; @@ -786,7 +786,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) #endif return __result; } - case ::_S_substringfn: + case __detail::_S_substringfn: // Avoid introducing multiple layers of substring nodes. { _RopeSubstring* __old = (_RopeSubstring*)__base; @@ -805,7 +805,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) } // *** else fall through: *** } - case ::_S_function: + case __detail::_S_function: { _RopeFunction* __f = (_RopeFunction*)__base; _CharT* __section; @@ -930,7 +930,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) return true; switch(__r->_M_tag) { - case ::_S_concat: + case __detail::_S_concat: { _RopeConcatenation* __conc = (_RopeConcatenation*)__r; _RopeRep* __left = __conc->_M_left; @@ -952,13 +952,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) } } return true; - case ::_S_leaf: + case __detail::_S_leaf: { _RopeLeaf* __l = (_RopeLeaf*)__r; return __c(__l->_M_data + __begin, __end - __begin); } - case ::_S_function: - case ::_S_substringfn: + case __detail::_S_function: + case __detail::_S_substringfn: { _RopeFunction* __f = (_RopeFunction*)__r; size_t __len = __end - __begin; @@ -1081,7 +1081,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) return __buffer; switch(__r->_M_tag) { - case ::_S_concat: + case __detail::_S_concat: { _RopeConcatenation* __c = (_RopeConcatenation*)__r; _RopeRep* __left = __c->_M_left; @@ -1089,13 +1089,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) _CharT* __rest = _S_flatten(__left, __buffer); return _S_flatten(__right, __rest); } - case ::_S_leaf: + case __detail::_S_leaf: { _RopeLeaf* __l = (_RopeLeaf*)__r; return copy_n(__l->_M_data, __l->_M_size, __buffer).second; } - case ::_S_function: - case ::_S_substringfn: + case __detail::_S_function: + case __detail::_S_substringfn: // We don't yet do anything with substring nodes. // This needs to be fixed before ropefiles will work well. { @@ -1147,13 +1147,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) switch (__r->_M_tag) { - case ::_S_leaf: + case __detail::_S_leaf: __kind = "Leaf"; break; - case ::_S_function: + case __detail::_S_function: __kind = "Function"; break; - case ::_S_substringfn: + case __detail::_S_substringfn: __kind = "Function representing substring"; break; default: @@ -1186,7 +1186,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) template const unsigned long rope<_CharT, _Alloc>:: - _S_min_len[int(::_S_max_rope_depth) + 1] = { + _S_min_len[int(__detail::_S_max_rope_depth) + 1] = { /* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21, /* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377, /* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181, @@ -1205,7 +1205,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) rope<_CharT, _Alloc>:: _S_balance(_RopeRep* __r) { - _RopeRep* __forest[int(::_S_max_rope_depth) + 1]; + _RopeRep* __forest[int(__detail::_S_max_rope_depth) + 1]; _RopeRep* __result = 0; int __i; // Invariant: @@ -1214,12 +1214,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) // __forest[__i]._M_depth = __i // References from forest are included in refcount. - for (__i = 0; __i <= int(::_S_max_rope_depth); ++__i) + for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i) __forest[__i] = 0; try { _S_add_to_forest(__r, __forest); - for (__i = 0; __i <= int(::_S_max_rope_depth); ++__i) + for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i) if (0 != __forest[__i]) { #ifndef __GC @@ -1234,12 +1234,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) } catch(...) { - for(__i = 0; __i <= int(::_S_max_rope_depth); __i++) + for(__i = 0; __i <= int(__detail::_S_max_rope_depth); __i++) _S_unref(__forest[__i]); __throw_exception_again; } - if (__result->_M_depth > int(::_S_max_rope_depth)) + if (__result->_M_depth > int(__detail::_S_max_rope_depth)) __throw_length_error(__N("rope::_S_balance")); return(__result); } @@ -1307,7 +1307,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) __forest[__i]->_M_unref_nonnil(); __forest[__i] = 0; } - if (__i == int(::_S_max_rope_depth) + if (__i == int(__detail::_S_max_rope_depth) || __insertee->_M_size < _S_min_len[__i+1]) { __forest[__i] = __insertee; @@ -1330,7 +1330,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) { switch(__r->_M_tag) { - case ::_S_concat: + case __detail::_S_concat: { _RopeConcatenation* __c = (_RopeConcatenation*)__r; _RopeRep* __left = __c->_M_left; @@ -1345,13 +1345,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) __r = __left; } break; - case ::_S_leaf: + case __detail::_S_leaf: { _RopeLeaf* __l = (_RopeLeaf*)__r; return __l->_M_data[__i]; } - case ::_S_function: - case ::_S_substringfn: + case __detail::_S_function: + case __detail::_S_substringfn: { _RopeFunction* __f = (_RopeFunction*)__r; _CharT __result; @@ -1371,7 +1371,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) rope<_CharT, _Alloc>:: _S_fetch_ptr(_RopeRep* __r, size_type __i) { - _RopeRep* __clrstack[::_S_max_rope_depth]; + _RopeRep* __clrstack[__detail::_S_max_rope_depth]; size_t __csptr = 0; for(;;) @@ -1380,7 +1380,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) return 0; switch(__r->_M_tag) { - case ::_S_concat: + case __detail::_S_concat: { _RopeConcatenation* __c = (_RopeConcatenation*)__r; _RopeRep* __left = __c->_M_left; @@ -1397,7 +1397,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) __r = __left; } break; - case ::_S_leaf: + case __detail::_S_leaf: { _RopeLeaf* __l = (_RopeLeaf*)__r; if (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0) @@ -1411,8 +1411,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) } return __l->_M_data + __i; } - case ::_S_function: - case ::_S_substringfn: + case __detail::_S_function: + case __detail::_S_substringfn: return 0; } } @@ -1437,10 +1437,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) return -1; __left_len = __left->_M_size; __right_len = __right->_M_size; - if (::_S_leaf == __left->_M_tag) + if (__detail::_S_leaf == __left->_M_tag) { _RopeLeaf* __l = (_RopeLeaf*) __left; - if (::_S_leaf == __right->_M_tag) + if (__detail::_S_leaf == __right->_M_tag) { _RopeLeaf* __r = (_RopeLeaf*) __right; return lexicographical_compare_3way(__l->_M_data, @@ -1461,7 +1461,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) { const_iterator __lstart(__left, 0); const_iterator __lend(__left, __left_len); - if (::_S_leaf == __right->_M_tag) + if (__detail::_S_leaf == __right->_M_tag) { _RopeLeaf* __r = (_RopeLeaf*) __right; return lexicographical_compare_3way(__lstart, __lend, @@ -1637,7 +1637,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) return _S_empty_c_str; } __GC_CONST _CharT* __old_c_string = this->_M_tree_ptr->_M_c_string; - if (::_S_leaf == this->_M_tree_ptr->_M_tag + if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag && 0 != __old_c_string) return(__old_c_string); size_t __s = size(); diff --git a/libstdc++-v3/include/tr1/hashtable_policy.h b/libstdc++-v3/include/tr1/hashtable_policy.h index d9fda09f5be..3f9317f565b 100644 --- a/libstdc++-v3/include/tr1/hashtable_policy.h +++ b/libstdc++-v3/include/tr1/hashtable_policy.h @@ -43,8 +43,6 @@ namespace std _GLIBCXX_BEGIN_NAMESPACE(tr1) namespace __detail { -namespace -{ // Helper function: return distance(first, last) for forward // iterators, or 0 for input iterators. template @@ -168,7 +166,6 @@ namespace (unsigned long)18446744073709551557ull, (unsigned long)18446744073709551557ull }; -} // anonymous namespace // Auxiliary types used for all instantiations of _Hashtable: nodes // and iterators. diff --git a/libstdc++-v3/include/tr1/random b/libstdc++-v3/include/tr1/random index 543378ea9e9..9d1aa840e01 100644 --- a/libstdc++-v3/include/tr1/random +++ b/libstdc++-v3/include/tr1/random @@ -62,7 +62,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) /* * Implementation-space details. */ - namespace + namespace __detail { template::digits> @@ -85,7 +85,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) typedef __gnu_cxx::__conditional_type<(sizeof(unsigned) == 4), unsigned, unsigned long>::__type _UInt32Type; - } // anonymous namespace /* * An adaptor class for converting the output of any Generator into @@ -158,7 +157,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) / result_type(_M_g.max() - _M_g.min()); return __return_value; } - + } // namespace __detail /** * Produces random numbers on a given disribution function using a un uniform @@ -176,7 +175,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) public: typedef _Engine engine_type; - typedef _Adaptor<_Engine, _Dist> engine_value_type; + typedef __detail::_Adaptor<_Engine, _Dist> engine_value_type; typedef _Dist distribution_type; typedef typename _Dist::result_type result_type; @@ -184,7 +183,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) typedef typename __gnu_cxx::__enable_if< is_arithmetic::value, result_type>::__type _IsValidType; - public: /** * Constructs a variate generator with the uniform random number * generator @p __eng for the random distribution @p __dist. @@ -360,7 +358,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) */ result_type min() const - { return (__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; } + { return (__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; } /** * Gets the largest possible value in the output range. @@ -448,7 +446,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) void seed(_Gen& __g, false_type); - private: _UIntType _M_x; }; @@ -542,7 +539,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) result_type max() const - { return _Shift<_UIntType, __w>::__value - 1; } + { return __detail::_Shift<_UIntType, __w>::__value - 1; } result_type operator()(); @@ -625,7 +622,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) void seed(_Gen& __g, false_type); - private: _UIntType _M_x[state_size]; int _M_p; }; @@ -682,7 +678,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) static const int long_lag = __r; static const int short_lag = __s; - public: /** * Constructs a default-initialized % subtract_with_carry random number * generator. @@ -826,7 +821,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) void seed(_Gen& __g, false_type); - private: typedef typename __gnu_cxx::__add_unsigned<_IntType>::__type _UIntType; _UIntType _M_x[long_lag]; @@ -857,7 +851,6 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) static const int long_lag = __r; static const int short_lag = __s; - public: /** * Constructs a default-initialized % subtract_with_carry_01 random * number generator. @@ -1011,12 +1004,12 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) void seed(_Gen& __g, false_type); - private: void _M_initialize_npows(); static const int __n = (__w + 31) / 32; + typedef __detail::_UInt32Type _UInt32Type; _UInt32Type _M_x[long_lag][__n]; _RealType _M_npows[__n]; _UInt32Type _M_carry; diff --git a/libstdc++-v3/include/tr1/random.tcc b/libstdc++-v3/include/tr1/random.tcc index 46d73dad56e..ba43ac8edce 100644 --- a/libstdc++-v3/include/tr1/random.tcc +++ b/libstdc++-v3/include/tr1/random.tcc @@ -34,7 +34,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) /* * (Further) implementation-space details. */ - namespace + namespace __detail { // General case for x = (ax + c) mod m -- use Schrage's algorithm to avoid // integer overflow. @@ -86,8 +86,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) __calc(_Tp __x) { return __a * __x + __c; } }; - } // anonymous namespace - + } // namespace __detail /** * Seeds the LCR with integral value @p __x0, adjusted so that the @@ -98,11 +97,11 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) linear_congruential<_UIntType, __a, __c, __m>:: seed(unsigned long __x0) { - if ((__mod<_UIntType, 1, 0, __m>(__c) == 0) - && (__mod<_UIntType, 1, 0, __m>(__x0) == 0)) - _M_x = __mod<_UIntType, 1, 0, __m>(1); + if ((__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) + && (__detail::__mod<_UIntType, 1, 0, __m>(__x0) == 0)) + _M_x = __detail::__mod<_UIntType, 1, 0, __m>(1); else - _M_x = __mod<_UIntType, 1, 0, __m>(__x0); + _M_x = __detail::__mod<_UIntType, 1, 0, __m>(__x0); } /** @@ -115,11 +114,11 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) seed(_Gen& __g, false_type) { _UIntType __x0 = __g(); - if ((__mod<_UIntType, 1, 0, __m>(__c) == 0) - && (__mod<_UIntType, 1, 0, __m>(__x0) == 0)) - _M_x = __mod<_UIntType, 1, 0, __m>(1); + if ((__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) + && (__detail::__mod<_UIntType, 1, 0, __m>(__x0) == 0)) + _M_x = __detail::__mod<_UIntType, 1, 0, __m>(1); else - _M_x = __mod<_UIntType, 1, 0, __m>(__x0); + _M_x = __detail::__mod<_UIntType, 1, 0, __m>(__x0); } /** @@ -130,7 +129,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) linear_congruential<_UIntType, __a, __c, __m>:: operator()() { - _M_x = __mod<_UIntType, __a, __c, __m>(_M_x); + _M_x = __detail::__mod<_UIntType, __a, __c, __m>(_M_x); return _M_x; } @@ -177,8 +176,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) __b, __t, __c, __l>:: seed(unsigned long __value) { - _M_x[0] = __mod<_UIntType, 1, 0, - _Shift<_UIntType, __w>::__value>(__value); + _M_x[0] = __detail::__mod<_UIntType, 1, 0, + __detail::_Shift<_UIntType, __w>::__value>(__value); for (int __i = 1; __i < state_size; ++__i) { @@ -186,8 +185,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) __x ^= __x >> (__w - 2); __x *= 1812433253ul; __x += __i; - _M_x[__i] = __mod<_UIntType, 1, 0, - _Shift<_UIntType, __w>::__value>(__x); + _M_x[__i] = __detail::__mod<_UIntType, 1, 0, + __detail::_Shift<_UIntType, __w>::__value>(__x); } _M_p = state_size; } @@ -202,8 +201,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) seed(_Gen& __gen, false_type) { for (int __i = 0; __i < state_size; ++__i) - _M_x[__i] = __mod<_UIntType, 1, 0, - _Shift<_UIntType, __w>::__value>(__gen()); + _M_x[__i] = __detail::__mod<_UIntType, 1, 0, + __detail::_Shift<_UIntType, __w>::__value>(__gen()); _M_p = state_size; } @@ -313,7 +312,7 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) __lcg(__value); for (int __i = 0; __i < long_lag; ++__i) - _M_x[__i] = __mod<_UIntType, 1, 0, modulus>(__lcg()); + _M_x[__i] = __detail::__mod<_UIntType, 1, 0, modulus>(__lcg()); _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0; _M_p = 0; @@ -333,10 +332,10 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) _UIntType __factor = 1; for (int __j = 0; __j < __n; ++__j) { - __tmp += __mod<_UInt32Type, 1, 0, 0>(__gen()) * __factor; - __factor *= _Shift<_UIntType, 32>::__value; + __tmp += __detail::__mod<__detail::_UInt32Type, 1, 0, 0>(__gen()) * __factor; + __factor *= __detail::_Shift<_UIntType, 32>::__value; } - _M_x[__i] = __mod<_UIntType, 1, 0, modulus>(__tmp); + _M_x[__i] = __detail::__mod<_UIntType, 1, 0, modulus>(__tmp); } _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0; _M_p = 0; @@ -453,9 +452,9 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) for (int __i = 0; __i < long_lag; ++__i) { for (int __j = 0; __j < __n - 1; ++__j) - _M_x[__i][__j] = __mod<_UInt32Type, 1, 0, 0>(__gen()); - _M_x[__i][__n - 1] = __mod<_UInt32Type, 1, 0, - _Shift<_UInt32Type, __w % 32>::__value>(__gen()); + _M_x[__i][__j] = __detail::__mod<_UInt32Type, 1, 0, 0>(__gen()); + _M_x[__i][__n - 1] = __detail::__mod<_UInt32Type, 1, 0, + __detail::_Shift<_UInt32Type, __w % 32>::__value>(__gen()); } _M_carry = 1; @@ -498,8 +497,8 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) else __new_carry = 1; - _M_x[_M_p][__n - 1] = __mod<_UInt32Type, 1, 0, - _Shift<_UInt32Type, __w % 32>::__value> + _M_x[_M_p][__n - 1] = __detail::__mod<_UInt32Type, 1, 0, + __detail::_Shift<_UInt32Type, __w % 32>::__value> (_M_x[__ps][__n - 1] - _M_x[_M_p][__n - 1] - _M_carry); _M_carry = __new_carry; @@ -623,11 +622,11 @@ _GLIBCXX_BEGIN_NAMESPACE(tr1) const result_type __m1 = std::min(result_type(_M_b1.max() - _M_b1.min()), - _Shift::__value - 1); + __detail::_Shift::__value - 1); const result_type __m2 = std::min(result_type(_M_b2.max() - _M_b2.min()), - _Shift::__value - 1); + __detail::_Shift::__value - 1); // NB: In TR1 s1 is not required to be >= s2. if (__s1 < __s2) diff --git a/libstdc++-v3/src/ext-inst.cc b/libstdc++-v3/src/ext-inst.cc index 1e356d6dcb8..7f98b415b4a 100644 --- a/libstdc++-v3/src/ext-inst.cc +++ b/libstdc++-v3/src/ext-inst.cc @@ -34,13 +34,13 @@ #include #include -namespace -{ - const int min_len = _S_max_rope_depth + 1; -} - _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) + namespace + { + const int min_len = __detail::_S_max_rope_depth + 1; + } + template const unsigned long rope >::_S_min_len[min_len];