diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2013-09-21 19:04:13 -0700 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@gcc.gnu.org> | 2013-09-21 19:04:13 -0700 |
commit | 9779c871afc648329500747748c70b59b47abdf7 (patch) | |
tree | 1807bb351c1ef7b319a9d9f950ffb248e213222c /libstdc++-v3/include/ext/vstring.h | |
parent | 0e2148ad570e2c48e69e1d861a02bb9445719410 (diff) | |
download | gcc-9779c871afc648329500747748c70b59b47abdf7.zip gcc-9779c871afc648329500747748c70b59b47abdf7.tar.gz gcc-9779c871afc648329500747748c70b59b47abdf7.tar.bz2 |
Print additional info when various out-of-range conditions are detected.
2013-09-21 Paul Pluzhnikov <ppluzhnikov@google.com>
* include/bits/functexcept.h (__throw_out_of_range_fmt): New.
* src/c++11/functexcept.cc (__throw_out_of_range_fmt): New.
* src/c++11/snprintf_lite.cc: New.
* src/c++11/Makefile.am: Add snprintf_lite.cc.
* src/c++11/Makefile.in: Regenerate.
* config/abi/pre/gnu.ver: Add _ZSt24__throw_out_of_range_fmtPKcz.
* include/std/array (at): Use __throw_out_of_range_fmt.
* include/debug/array (at): Likewise.
* include/profile/array (at): Likewise.
* include/std/bitset (_M_check_initial_position, _M_check): New.
(bitset::bitset): Use _M_check_initial_position.
(set, reset, flip, test): Use _M_check.
* include/ext/vstring.h (_M_check, at): Use __throw_out_of_range_fmt.
* include/bits/stl_vector.h (_M_range_check): Likewise.
* include/bits/stl_bvector.h (_M_range_check): Likewise.
* include/bits/stl_deque.h (_M_range_check): Likewise.
* include/bits/basic_string.h (_M_check, at): Likewise.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Adjust.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc:
Likewise.
* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc: Likewise.
* testsuite/23_containers/array/tuple_interface/tuple_element_debug_neg.cc:
Likewise.
* testsuite/23_containers/array/tuple_interface/get_neg.cc: Likewise.
* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc: Likewise.
* testsuite/util/exception/safety.h (generate): Use __throw_out_of_range_fmt.
From-SVN: r202818
Diffstat (limited to 'libstdc++-v3/include/ext/vstring.h')
-rw-r--r-- | libstdc++-v3/include/ext/vstring.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h index bd93c80..8eb8597 100644 --- a/libstdc++-v3/include/ext/vstring.h +++ b/libstdc++-v3/include/ext/vstring.h @@ -85,7 +85,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_check(size_type __pos, const char* __s) const { if (__pos > this->size()) - std::__throw_out_of_range(__N(__s)); + std::__throw_out_of_range_fmt(__N("%s: __pos (which is %zu) > " + "this->size() (which is %zu)"), + __s, __pos, this->size()); return __pos; } @@ -575,7 +577,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION at(size_type __n) const { if (__n >= this->size()) - std::__throw_out_of_range(__N("__versa_string::at")); + std::__throw_out_of_range_fmt(__N("__versa_string::at: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); return this->_M_data()[__n]; } @@ -594,7 +599,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION at(size_type __n) { if (__n >= this->size()) - std::__throw_out_of_range(__N("__versa_string::at")); + std::__throw_out_of_range_fmt(__N("__versa_string::at: __n " + "(which is %zu) >= this->size() " + "(which is %zu)"), + __n, this->size()); this->_M_leak(); return this->_M_data()[__n]; } |