re PR libstdc++/42381 (deque shouldn't reserve that much memory)

2009-12-15  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libsdtc++/42381
	* include/bits/stl_deque.h (_GLIBCXX_DEQUE_BUF_SIZE): Add.
	(__deque_buf_size(size_t)): Use it.
	* testsuite/23_containers/deque/requirements/dr438/
	assign_neg.cc: Adjust dg-error line numbers.
	* 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.

From-SVN: r155271
This commit is contained in:
Paolo Carlini 2009-12-15 20:58:29 +00:00 committed by Paolo Carlini
parent abcd7e0847
commit 465d76b735
6 changed files with 30 additions and 6 deletions

View File

@ -1,3 +1,17 @@
2009-12-15 Paolo Carlini <paolo.carlini@oracle.com>
PR libsdtc++/42381
* include/bits/stl_deque.h (_GLIBCXX_DEQUE_BUF_SIZE): Add.
(__deque_buf_size(size_t)): Use it.
* testsuite/23_containers/deque/requirements/dr438/
assign_neg.cc: Adjust dg-error line numbers.
* 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.
2009-12-15 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/std/future (unique_future::get, promise::set_value): Remove

View File

@ -72,11 +72,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
* This function started off as a compiler kludge from SGI, but seems to
* be a useful wrapper around a repeated constant expression. The '512' is
* tunable (and no other code needs to change), but no investigation has
* been done since inheriting the SGI code.
* been done since inheriting the SGI code. Touch _GLIBCXX_DEQUE_BUF_SIZE
* only if you know what you are doing, however: changing it breaks the
* binary compatibility!!
*/
#ifndef _GLIBCXX_DEQUE_BUF_SIZE
#define _GLIBCXX_DEQUE_BUF_SIZE 512
#endif
inline size_t
__deque_buf_size(size_t __size)
{ return __size < 512 ? size_t(512 / __size) : size_t(1); }
{ return (__size < _GLIBCXX_DEQUE_BUF_SIZE
? size_t(_GLIBCXX_DEQUE_BUF_SIZE / __size) : size_t(1)); }
/**
@ -1798,6 +1806,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y)
{ __x.swap(__y); }
#undef _GLIBCXX_DEQUE_BUF_SIZE
_GLIBCXX_END_NESTED_NAMESPACE
#endif /* _STL_DEQUE_H */

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1494 }
// { dg-error "no matching" "" { target *-*-* } 1502 }
// { dg-excess-errors "" }
#include <deque>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1433 }
// { dg-error "no matching" "" { target *-*-* } 1441 }
// { dg-excess-errors "" }
#include <deque>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1433 }
// { dg-error "no matching" "" { target *-*-* } 1441 }
// { dg-excess-errors "" }
#include <deque>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1578 }
// { dg-error "no matching" "" { target *-*-* } 1586 }
// { dg-excess-errors "" }
#include <deque>