diff options
author | ppluzhnikov <ppluzhnikov@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-22 02:04:13 +0000 |
---|---|---|
committer | ppluzhnikov <ppluzhnikov@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-09-22 02:04:13 +0000 |
commit | b473f47fc414a1e6014f6fed59098f22f85bee6b (patch) | |
tree | 1807bb351c1ef7b319a9d9f950ffb248e213222c /libstdc++-v3/include/debug | |
parent | d777af107191d6f0e3ad8e0bad7889bc0702b06c (diff) | |
download | gcc-b473f47fc414a1e6014f6fed59098f22f85bee6b.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@202818 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/debug')
-rw-r--r-- | libstdc++-v3/include/debug/array | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libstdc++-v3/include/debug/array b/libstdc++-v3/include/debug/array index d3eea853856..6ee23846518 100644 --- a/libstdc++-v3/include/debug/array +++ b/libstdc++-v3/include/debug/array @@ -165,7 +165,10 @@ namespace __debug at(size_type __n) { if (__n >= _Nm) - std::__throw_out_of_range(__N("array::at")); + std::__throw_out_of_range_fmt(__N("array::at: __n " + "(which is %zu) >= _Nm " + "(which is %zu)"), + __n, _Nm); return _AT_Type::_S_ref(_M_elems, __n); } @@ -175,7 +178,9 @@ namespace __debug // Result of conditional expression must be an lvalue so use // boolean ? lvalue : (throw-expr, lvalue) return __n < _Nm ? _AT_Type::_S_ref(_M_elems, __n) - : (std::__throw_out_of_range(__N("array::at")), + : (std::__throw_out_of_range_fmt(__N("array::at: __n (which is %zu) " + ">= _Nm (which is %zu)"), + __n, _Nm), _AT_Type::_S_ref(_M_elems, 0)); } |