aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.3/libstdc++-v3
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.4.3/libstdc++-v3')
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/backward/hashtable.h3
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/bits/stl_algo.h7
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/bits/stl_tree.h26
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/sso_string_base.h51
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/vstring.h4
-rw-r--r--gcc-4.4.3/libstdc++-v3/include/ext/vstring.tcc10
6 files changed, 65 insertions, 36 deletions
diff --git a/gcc-4.4.3/libstdc++-v3/include/backward/hashtable.h b/gcc-4.4.3/libstdc++-v3/include/backward/hashtable.h
index ca04c76fd..4d74eaf95 100644
--- a/gcc-4.4.3/libstdc++-v3/include/backward/hashtable.h
+++ b/gcc-4.4.3/libstdc++-v3/include/backward/hashtable.h
@@ -124,7 +124,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_Hashtable_iterator(_Node* __n, _Hashtable* __tab)
: _M_cur(__n), _M_ht(__tab) { }
- _Hashtable_iterator() { }
+ _Hashtable_iterator()
+ : _M_cur(0), _M_ht(0) { }
reference
operator*() const
diff --git a/gcc-4.4.3/libstdc++-v3/include/bits/stl_algo.h b/gcc-4.4.3/libstdc++-v3/include/bits/stl_algo.h
index f54b1cd77..d4b04d1da 100644
--- a/gcc-4.4.3/libstdc++-v3/include/bits/stl_algo.h
+++ b/gcc-4.4.3/libstdc++-v3/include/bits/stl_algo.h
@@ -74,13 +74,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#if __google_stl_debug_compare
template<typename _Compare>
struct _CheckedCompare {
- // Mutable because some clients use non-const operator().
- mutable _Compare _M_compare;
+ _Compare _M_compare;
_CheckedCompare(const _Compare & __comp): _M_compare(__comp) { }
template <typename _Tp>
- bool operator()(const _Tp& __x, const _Tp& __y) const {
+ bool operator()(const _Tp& __x, const _Tp& __y) {
if (_M_compare(__x, __x))
__throw_runtime_error("strict weak ordering: (__x LT __x) != false");
if (_M_compare(__y, __y))
@@ -96,7 +95,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
// indexterm/internal/numericterms.cc
// fails without this.
template <typename _Tp1, typename _Tp2>
- bool operator()(const _Tp1& __x, const _Tp2& __y) const {
+ bool operator()(const _Tp1& __x, const _Tp2& __y) {
return _M_compare(__x, __y);
}
};
diff --git a/gcc-4.4.3/libstdc++-v3/include/bits/stl_tree.h b/gcc-4.4.3/libstdc++-v3/include/bits/stl_tree.h
index 4f0ad2d8d..e2cc1518d 100644
--- a/gcc-4.4.3/libstdc++-v3/include/bits/stl_tree.h
+++ b/gcc-4.4.3/libstdc++-v3/include/bits/stl_tree.h
@@ -456,22 +456,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
#if __google_stl_debug_rbtree
template<typename _KeyCompare>
struct _CheckedCompare {
- // Mutable because some clients use non-const operator().
- mutable _KeyCompare _M_key_compare;
+ _KeyCompare _M_key_compare;
_CheckedCompare(): _M_key_compare() { }
_CheckedCompare(const _KeyCompare & __comp): _M_key_compare(__comp) { }
- bool operator()(const _Key& __x, const _Key& __y) const {
- if (_M_key_compare(__x, __x))
+ // Template arg required to avoid duplicating code in the two op()
+ // operators below. User-provided _M_key_compare may not be const,
+ // but needs to be callable from our const op().
+ // See http://b/1731200 for details.
+ template <typename _KeyCompareT>
+ static bool _M_compare_with(_KeyCompareT& __comp, const _Key& __x, const _Key& __y) {
+ if (__comp(__x, __x))
__throw_runtime_error("strict weak ordering: (__x LT __x) != false");
- if (_M_key_compare(__y, __y))
+ if (__comp(__y, __y))
__throw_runtime_error("strict weak ordering: (__y LT __y) != false");
- bool lt = _M_key_compare(__x, __y);
- if (lt && _M_key_compare(__y, __x))
+ bool lt = __comp(__x, __y);
+ if (lt && __comp(__y, __x))
__throw_runtime_error("strict weak ordering: ((__x LT __y) && (__y LT __x)) != false");
return lt;
}
+ bool operator()(const _Key& __x, const _Key& __y) const {
+ return _M_compare_with(_M_key_compare, __x, __y);
+ }
+
+ bool operator()(const _Key& __x, const _Key& __y) {
+ return _M_compare_with(_M_key_compare, __x, __y);
+ }
+
operator _KeyCompare() const { return _M_key_compare; }
};
diff --git a/gcc-4.4.3/libstdc++-v3/include/ext/sso_string_base.h b/gcc-4.4.3/libstdc++-v3/include/ext/sso_string_base.h
index ee704f51d..c32960902 100644
--- a/gcc-4.4.3/libstdc++-v3/include/ext/sso_string_base.h
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/sso_string_base.h
@@ -84,7 +84,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
{
if (!_M_is_local())
_M_destroy(_M_allocated_capacity);
-#if __google_stl_debug_string
+#if __google_stl_debug_string_dangling
else {
// Wipe local storage for destructed string with 0xCD.
// This mimics what DebugAllocation does to free()d memory.
@@ -170,15 +170,29 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_M_leak() { }
void
- _M_set_length(size_type __n)
+ _M_set_length_no_wipe(size_type __n)
{
_M_length(__n);
traits_type::assign(_M_data()[__n], _CharT());
}
+ void
+ _M_set_length(size_type __n)
+ {
+#if __google_stl_debug_string_dangling
+ if (__n + 1 < _M_length())
+ {
+ // Wipe the storage with 0xCD.
+ // Also wipes the old NUL terminator.
+ __builtin_memset(_M_data() + __n + 1, 0xcd, _M_length() - __n);
+ }
+#endif
+ _M_set_length_no_wipe(__n);
+ }
+
__sso_string_base()
: _M_dataplus(_M_local_data)
- { _M_set_length(0); }
+ { _M_set_length_no_wipe(0); }
__sso_string_base(const _Alloc& __a);
@@ -235,6 +249,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__sso_string_base<_CharT, _Traits, _Alloc>::
_M_swap(__sso_string_base& __rcs)
{
+ if (this == &__rcs)
+ return;
+
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 431. Swapping containers with unequal allocators.
std::__alloc_swap<_CharT_alloc_type>::_S_do_it(_M_get_allocator(),
@@ -334,7 +351,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__sso_string_base<_CharT, _Traits, _Alloc>::
__sso_string_base(const _Alloc& __a)
: _M_dataplus(__a, _M_local_data)
- { _M_set_length(0); }
+ { _M_set_length_no_wipe(0); }
template<typename _CharT, typename _Traits, typename _Alloc>
__sso_string_base<_CharT, _Traits, _Alloc>::
@@ -409,7 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// Allocate more space.
__capacity = __len + 1;
_CharT* __another = _M_create(__capacity, __len);
- _S_copy(__another, _M_data(), __len);
+ this->_S_copy(__another, _M_data(), __len);
_M_dispose();
_M_data(__another);
_M_capacity(__capacity);
@@ -424,7 +441,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__throw_exception_again;
}
- _M_set_length(__len);
+ _M_set_length_no_wipe(__len);
}
template<typename _CharT, typename _Traits, typename _Alloc>
@@ -449,14 +466,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// Check for out_of_range and length_error exceptions.
__try
- { _S_copy_chars(_M_data(), __beg, __end); }
+ { this->_S_copy_chars(_M_data(), __beg, __end); }
__catch(...)
{
_M_dispose();
__throw_exception_again;
}
- _M_set_length(__dnew);
+ _M_set_length_no_wipe(__dnew);
}
template<typename _CharT, typename _Traits, typename _Alloc>
@@ -471,9 +488,9 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}
if (__n)
- _S_assign(_M_data(), __n, __c);
+ this->_S_assign(_M_data(), __n, __c);
- _M_set_length(__n);
+ _M_set_length_no_wipe(__n);
}
template<typename _CharT, typename _Traits, typename _Alloc>
@@ -496,7 +513,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
}
if (__rsize)
- _S_copy(_M_data(), __rcs._M_data(), __rsize);
+ this->_S_copy(_M_data(), __rcs._M_data(), __rsize);
_M_set_length(__rsize);
}
@@ -518,14 +535,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|| __res > size_type(_S_local_capacity))
{
_CharT* __tmp = _M_create(__res, __capacity);
- _S_copy(__tmp, _M_data(), _M_length() + 1);
+ this->_S_copy(__tmp, _M_data(), _M_length() + 1);
_M_dispose();
_M_data(__tmp);
_M_capacity(__res);
}
else if (!_M_is_local())
{
- _S_copy(_M_local_data, _M_data(), _M_length() + 1);
+ this->_S_copy(_M_local_data, _M_data(), _M_length() + 1);
_M_destroy(__capacity);
_M_data(_M_local_data);
}
@@ -544,11 +561,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
_CharT* __r = _M_create(__new_capacity, _M_capacity());
if (__pos)
- _S_copy(__r, _M_data(), __pos);
+ this->_S_copy(__r, _M_data(), __pos);
if (__s && __len2)
- _S_copy(__r + __pos, __s, __len2);
+ this->_S_copy(__r + __pos, __s, __len2);
if (__how_much)
- _S_copy(__r + __pos + __len2,
+ this->_S_copy(__r + __pos + __len2,
_M_data() + __pos + __len1, __how_much);
_M_dispose();
@@ -564,7 +581,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
const size_type __how_much = _M_length() - __pos - __n;
if (__how_much && __n)
- _S_move(_M_data() + __pos, _M_data() + __pos + __n,
+ this->_S_move(_M_data() + __pos, _M_data() + __pos + __n,
__how_much);
_M_set_length(_M_length() - __n);
diff --git a/gcc-4.4.3/libstdc++-v3/include/ext/vstring.h b/gcc-4.4.3/libstdc++-v3/include/ext/vstring.h
index c7bf2d2bf..6377ca57d 100644
--- a/gcc-4.4.3/libstdc++-v3/include/ext/vstring.h
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/vstring.h
@@ -1340,7 +1340,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
&& __i2 <= _M_iend());
__glibcxx_requires_valid_range(__k1, __k2);
typedef typename std::__is_integer<_InputIterator>::__type _Integral;
- return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
+ return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
}
// Specializations for the common case of pointer and iterator:
@@ -1899,7 +1899,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
int __r = traits_type::compare(this->_M_data(), __str.data(), __len);
if (!__r)
- __r = _S_compare(__size, __osize);
+ __r = this->_S_compare(__size, __osize);
return __r;
}
diff --git a/gcc-4.4.3/libstdc++-v3/include/ext/vstring.tcc b/gcc-4.4.3/libstdc++-v3/include/ext/vstring.tcc
index 99193896b..2c3a8e276 100644
--- a/gcc-4.4.3/libstdc++-v3/include/ext/vstring.tcc
+++ b/gcc-4.4.3/libstdc++-v3/include/ext/vstring.tcc
@@ -464,7 +464,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
int __r = traits_type::compare(this->_M_data() + __pos,
__str.data(), __len);
if (!__r)
- __r = _S_compare(__n, __osize);
+ __r = this->_S_compare(__n, __osize);
return __r;
}
@@ -483,7 +483,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
int __r = traits_type::compare(this->_M_data() + __pos1,
__str.data() + __pos2, __len);
if (!__r)
- __r = _S_compare(__n1, __n2);
+ __r = this->_S_compare(__n1, __n2);
return __r;
}
@@ -499,7 +499,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
const size_type __len = std::min(__size, __osize);
int __r = traits_type::compare(this->_M_data(), __s, __len);
if (!__r)
- __r = _S_compare(__size, __osize);
+ __r = this->_S_compare(__size, __osize);
return __r;
}
@@ -516,7 +516,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
const size_type __len = std::min(__n1, __osize);
int __r = traits_type::compare(this->_M_data() + __pos, __s, __len);
if (!__r)
- __r = _S_compare(__n1, __osize);
+ __r = this->_S_compare(__n1, __osize);
return __r;
}
@@ -533,7 +533,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
const size_type __len = std::min(__n1, __n2);
int __r = traits_type::compare(this->_M_data() + __pos, __s, __len);
if (!__r)
- __r = _S_compare(__n1, __n2);
+ __r = this->_S_compare(__n1, __n2);
return __r;
}