Commit 465d76b7 by Paolo Carlini Committed by Paolo Carlini

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
parent abcd7e08
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> 2009-12-15 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/std/future (unique_future::get, promise::set_value): Remove * include/std/future (unique_future::get, promise::set_value): Remove
......
...@@ -72,11 +72,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) ...@@ -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 * 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 * be a useful wrapper around a repeated constant expression. The '512' is
* tunable (and no other code needs to change), but no investigation has * 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 inline size_t
__deque_buf_size(size_t __size) __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) ...@@ -1798,6 +1806,8 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D)
swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y) swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y)
{ __x.swap(__y); } { __x.swap(__y); }
#undef _GLIBCXX_DEQUE_BUF_SIZE
_GLIBCXX_END_NESTED_NAMESPACE _GLIBCXX_END_NESTED_NAMESPACE
#endif /* _STL_DEQUE_H */ #endif /* _STL_DEQUE_H */
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1494 } // { dg-error "no matching" "" { target *-*-* } 1502 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <deque> #include <deque>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1433 } // { dg-error "no matching" "" { target *-*-* } 1441 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <deque> #include <deque>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1433 } // { dg-error "no matching" "" { target *-*-* } 1441 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <deque> #include <deque>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>. // <http://www.gnu.org/licenses/>.
// { dg-do compile } // { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1578 } // { dg-error "no matching" "" { target *-*-* } 1586 }
// { dg-excess-errors "" } // { dg-excess-errors "" }
#include <deque> #include <deque>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment