aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2009-12-15 20:58:29 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2009-12-15 20:58:29 +0000
commit465d76b7352eec414e0444a1c5840e0c339415b8 (patch)
tree343851c183a60a7393bf85c776dacb679c2e15bc /libstdc++-v3
parentabcd7e08477154884ab6be8ae846059eed0e9f45 (diff)
downloadgcc-465d76b7352eec414e0444a1c5840e0c339415b8.zip
gcc-465d76b7352eec414e0444a1c5840e0c339415b8.tar.gz
gcc-465d76b7352eec414e0444a1c5840e0c339415b8.tar.bz2
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
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog14
-rw-r--r--libstdc++-v3/include/bits/stl_deque.h14
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc2
-rw-r--r--libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc2
6 files changed, 30 insertions, 6 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 4e77d33..fd5dc86 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index 7f601cb..d7589f7 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -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 */
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
index f743994..314a13f 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
index b1136f5..2ae51b8 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
index 8752a7e..22bb275 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
index 8cf322e..cdacae4 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
@@ -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>