diff options
Diffstat (limited to 'libstdc++-v3/testsuite/23_containers')
42 files changed, 326 insertions, 130 deletions
diff --git a/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc b/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc index 089b10b83a6..475880888cc 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc @@ -1,6 +1,6 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -17,16 +17,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <deque> #include <testsuite_hooks.h> #include <testsuite_rvalref.h> using namespace __gnu_test; -// According to n1771, there should be two resizes, with and without -// parameter. We only have one at present, whose second parameter defaults -// to a default-constructed object. void test01() { @@ -38,30 +34,17 @@ test01() a.resize(98); a.resize(99); a.resize(100); -#if ! defined _GLIBCXX_DEBUG && ! defined _GLIBCXX_PROFILE - VERIFY( copycounter::copycount == 100 ); -#else - VERIFY( copycounter::copycount == 100 + 4 ); -#endif + VERIFY( copycounter::copycount == 0 ); + a.resize(99); a.resize(0); -#if ! defined _GLIBCXX_DEBUG && ! defined _GLIBCXX_PROFILE - VERIFY( copycounter::copycount == 100 ); -#else - VERIFY( copycounter::copycount == 100 + 6 ); -#endif + VERIFY( copycounter::copycount == 0 ); + a.resize(100); -#if ! defined _GLIBCXX_DEBUG && ! defined _GLIBCXX_PROFILE - VERIFY( copycounter::copycount == 200 ); -#else - VERIFY( copycounter::copycount == 200 + 7 ); -#endif + VERIFY( copycounter::copycount == 0 ); + a.clear(); -#if ! defined _GLIBCXX_DEBUG && ! defined _GLIBCXX_PROFILE - VERIFY( copycounter::copycount == 200 ); -#else - VERIFY( copycounter::copycount == 200 + 7 ); -#endif + VERIFY( copycounter::copycount == 0 ); } diff --git a/libstdc++-v3/testsuite/23_containers/deque/capacity/resize_size.cc b/libstdc++-v3/testsuite/23_containers/deque/capacity/resize_size.cc new file mode 100644 index 00000000000..229a0eb60bc --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/capacity/resize_size.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <deque> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::deque<__gnu_test::NonCopyConstructible> d; + VERIFY( std::distance(d.begin(), d.end()) == 0 ); + + d.resize(1000); + VERIFY( std::distance(d.begin(), d.end()) == 1000 ); + for(auto it = d.begin(); it != d.end(); ++it) + VERIFY( *it == -1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/deque/cons/cons_size.cc new file mode 100644 index 00000000000..0207fd7174c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/cons/cons_size.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <deque> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::deque<__gnu_test::NonCopyConstructible> d(1000); + VERIFY( std::distance(d.begin(), d.end()) == 1000 ); + for(auto it = d.begin(); it != d.end(); ++it) + VERIFY( *it == -1 ); +} + +int main() +{ + test01(); + return 0; +} 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 96be31cb62a..bd6ee636305 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 *-*-* } 1577 } +// { dg-error "no matching" "" { target *-*-* } 1659 } // { 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 59d4e2f4158..21c9d4e4f3c 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 *-*-* } 1516 } +// { dg-error "no matching" "" { target *-*-* } 1592 } // { 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 6208581b877..08f54d68018 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 @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007, 2008, 2009 Free Software Foundation +// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1516 } +// { dg-error "no matching" "" { target *-*-* } 1592 } // { 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 7fb2479d02c..a5bd6065c1c 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 *-*-* } 1661 } +// { dg-error "no matching" "" { target *-*-* } 1743 } // { dg-excess-errors "" } #include <deque> diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/cons/10.cc b/libstdc++-v3/testsuite/23_containers/forward_list/capacity/resize_size.cc index 4e599dab6bc..e22af3cbc19 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/cons/10.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/capacity/resize_size.cc @@ -21,24 +21,17 @@ #include <forward_list> #include <testsuite_hooks.h> - -struct NoCopyConstructor -{ - NoCopyConstructor() : num(-1) { } - NoCopyConstructor(const NoCopyConstructor&) = delete; - - operator int() { return num; } - -private: - int num; -}; +#include <testsuite_api.h> void test01() { bool test __attribute__((unused)) = true; - std::forward_list<NoCopyConstructor> fl(5); - VERIFY( std::distance(fl.begin(), fl.end()) == 5 ); + std::forward_list<__gnu_test::NonCopyConstructible> fl; + VERIFY( std::distance(fl.begin(), fl.end()) == 0 ); + + fl.resize(1000); + VERIFY( std::distance(fl.begin(), fl.end()) == 1000 ); for(auto it = fl.begin(); it != fl.end(); ++it) VERIFY( *it == -1 ); } diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/6.cc b/libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc index 985f592e602..3d07f672089 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/modifiers/6.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/cons/cons_size.cc @@ -21,27 +21,14 @@ #include <forward_list> #include <testsuite_hooks.h> - -struct NoCopyConstructor -{ - NoCopyConstructor() : num(-1) { } - NoCopyConstructor(const NoCopyConstructor&) = delete; - - operator int() { return num; } - -private: - int num; -}; +#include <testsuite_api.h> void test01() { bool test __attribute__((unused)) = true; - std::forward_list<NoCopyConstructor> fl; - VERIFY( std::distance(fl.begin(), fl.end()) == 0 ); - - fl.resize(10); - VERIFY( std::distance(fl.begin(), fl.end()) == 10 ); + std::forward_list<__gnu_test::NonCopyConstructible> fl(1000); + VERIFY( std::distance(fl.begin(), fl.end()) == 1000 ); for(auto it = fl.begin(); it != fl.end(); ++it) VERIFY( *it == -1 ); } diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc index 1625e3bc76b..aa0f3e07def 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/assign_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1196 } +// { dg-error "no matching" "" { target *-*-* } 1198 } // { dg-excess-errors "" } // Copyright (C) 2009, 2010 Free Software Foundation diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc index 5acfcd1f47f..3975b051611 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_1_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1196 } +// { dg-error "no matching" "" { target *-*-* } 1198 } // { dg-excess-errors "" } // Copyright (C) 2009, 2010 Free Software Foundation diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc index dcf69089b00..0b0471c8cc9 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/constructor_2_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1196 } +// { dg-error "no matching" "" { target *-*-* } 1198 } // { dg-excess-errors "" } // Copyright (C) 2009, 2010 Free Software Foundation diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc index 22574fd081a..849eb643e87 100644 --- a/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/forward_list/requirements/dr438/insert_neg.cc @@ -1,6 +1,6 @@ // { dg-do compile } // { dg-options "-std=gnu++0x" } -// { dg-error "no matching" "" { target *-*-* } 1196 } +// { dg-error "no matching" "" { target *-*-* } 1198 } // { dg-excess-errors "" } // Copyright (C) 2009, 2010 Free Software Foundation diff --git a/libstdc++-v3/testsuite/23_containers/headers/array/std_c++0x_neg.cc b/libstdc++-v3/testsuite/23_containers/headers/array/std_c++0x_neg.cc index 3c47ae204c1..5d9bf7e0a3f 100644 --- a/libstdc++-v3/testsuite/23_containers/headers/array/std_c++0x_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/headers/array/std_c++0x_neg.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <array> // { dg-excess-errors "In file included from" } +#include <array> // { dg-error "upcoming ISO" "" { target *-*-* } 31 } diff --git a/libstdc++-v3/testsuite/23_containers/headers/tuple/std_c++0x_neg.cc b/libstdc++-v3/testsuite/23_containers/headers/tuple/std_c++0x_neg.cc index 89f850cc090..266874da23b 100644 --- a/libstdc++-v3/testsuite/23_containers/headers/tuple/std_c++0x_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/headers/tuple/std_c++0x_neg.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <tuple> // { dg-excess-errors "In file included from" } +#include <tuple> // { dg-error "upcoming ISO" "" { target *-*-* } 31 } diff --git a/libstdc++-v3/testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc b/libstdc++-v3/testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc index 65f05e1e693..dc85bc50e92 100644 --- a/libstdc++-v3/testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <unordered_map> // { dg-excess-errors "In file included from" } +#include <unordered_map> // { dg-error "upcoming ISO" "" { target *-*-* } 31 } diff --git a/libstdc++-v3/testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc b/libstdc++-v3/testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc index 3dabc3207be..ab22c39a6ba 100644 --- a/libstdc++-v3/testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -#include <unordered_set> // { dg-excess-errors "In file included from" } +#include <unordered_set> // { dg-error "upcoming ISO" "" { target *-*-* } 31 } diff --git a/libstdc++-v3/testsuite/23_containers/list/23781.cc b/libstdc++-v3/testsuite/23_containers/list/23781.cc index ca275bda5ad..7b291df798a 100644 --- a/libstdc++-v3/testsuite/23_containers/list/23781.cc +++ b/libstdc++-v3/testsuite/23_containers/list/23781.cc @@ -1,6 +1,6 @@ // 2005-09-10 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2005, 2009 Free Software Foundation, Inc. +// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -22,6 +22,7 @@ // libstdc++/23781 #include <list> +#include <cstddef> typedef std::list<int> list_type; list_type::iterator it = NULL; // { dg-error "conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc b/libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc new file mode 100644 index 00000000000..06424c0a8c1 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/capacity/resize_size.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <list> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::list<__gnu_test::NonCopyConstructible> l; + VERIFY( std::distance(l.begin(), l.end()) == 0 ); + + l.resize(1000); + VERIFY( std::distance(l.begin(), l.end()) == 1000 ); + for(auto it = l.begin(); it != l.end(); ++it) + VERIFY( *it == -1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc new file mode 100644 index 00000000000..f59f520f928 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/cons/cons_size.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <list> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::list<__gnu_test::NonCopyConstructible> l(1000); + VERIFY( std::distance(l.begin(), l.end()) == 1000 ); + for(auto it = l.begin(); it != l.end(); ++it) + VERIFY( *it == -1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/list/pthread1.cc b/libstdc++-v3/testsuite/23_containers/list/pthread1.cc index fcbb039dce3..00dc817b152 100644 --- a/libstdc++-v3/testsuite/23_containers/list/pthread1.cc +++ b/libstdc++-v3/testsuite/23_containers/list/pthread1.cc @@ -1,6 +1,6 @@ // 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org> // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009 +// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -45,9 +45,9 @@ class task_queue public: task_queue () { - pthread_mutex_init (&fooLock, NULL); - pthread_cond_init (&fooCond1, NULL); - pthread_cond_init (&fooCond2, NULL); + pthread_mutex_init (&fooLock, 0); + pthread_cond_init (&fooCond1, 0); + pthread_cond_init (&fooCond2, 0); } ~task_queue () { @@ -115,14 +115,14 @@ main() for (int i = 0; i < thread_pairs; i++) { tq[i] = new task_queue; - pthread_create (&prod[i], NULL, produce, static_cast<void*> (tq[i])); - pthread_create (&cons[i], NULL, consume, static_cast<void*> (tq[i])); + pthread_create (&prod[i], 0, produce, static_cast<void*> (tq[i])); + pthread_create (&cons[i], 0, consume, static_cast<void*> (tq[i])); } for (int i = 0; i < thread_pairs; i++) { - pthread_join (prod[i], NULL); - pthread_join (cons[i], NULL); + pthread_join (prod[i], 0); + pthread_join (cons[i], 0); delete tq[i]; } } diff --git a/libstdc++-v3/testsuite/23_containers/list/pthread5.cc b/libstdc++-v3/testsuite/23_containers/list/pthread5.cc index 57411eef3f0..4f464372124 100644 --- a/libstdc++-v3/testsuite/23_containers/list/pthread5.cc +++ b/libstdc++-v3/testsuite/23_containers/list/pthread5.cc @@ -2,7 +2,7 @@ // Adpated from libstdc++/5464 submitted by jjessel@amadeus.net // Jean-Francois JESSEL (Amadeus SAS Development) // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009 +// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -99,7 +99,7 @@ main () #endif pthread_attr_t tattr; - int ret = pthread_attr_init (&tattr); + int ret __attribute__((unused)) = pthread_attr_init (&tattr); #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING ret = pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM); #endif diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc index eb35a24c89d..2446157597f 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1411 } +// { dg-error "no matching" "" { target *-*-* } 1478 } // { dg-excess-errors "" } #include <list> diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc index 937404b26a8..cbac8e80cbf 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1380 } +// { dg-error "no matching" "" { target *-*-* } 1434 } // { dg-excess-errors "" } #include <list> diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc index 74fc1b7a163..232bd042ddb 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1380 } +// { dg-error "no matching" "" { target *-*-* } 1434 } // { dg-excess-errors "" } #include <list> diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc index 3aebda5ddb2..aefb1f583fd 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1380 } +// { dg-error "no matching" "" { target *-*-* } 1434 } // { dg-excess-errors "" } #include <list> diff --git a/libstdc++-v3/testsuite/23_containers/map/23781.cc b/libstdc++-v3/testsuite/23_containers/map/23781.cc index f7967693f79..e282c754667 100644 --- a/libstdc++-v3/testsuite/23_containers/map/23781.cc +++ b/libstdc++-v3/testsuite/23_containers/map/23781.cc @@ -1,6 +1,6 @@ // 2005-09-10 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2005, 2009 Free Software Foundation, Inc. +// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -22,6 +22,7 @@ // libstdc++/23781 #include <map> +#include <cstddef> std::map<int, int>::iterator it = NULL; // { dg-error "conversion" } std::map<int, int>::const_iterator cit = NULL; // { dg-error "conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/map/dr130.cc b/libstdc++-v3/testsuite/23_containers/map/dr130.cc index d7f3c2b0856..9186a621ea7 100644 --- a/libstdc++-v3/testsuite/23_containers/map/dr130.cc +++ b/libstdc++-v3/testsuite/23_containers/map/dr130.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2008-07-22 Edward Smith-Rowland <3dw4rd@verizon.net> // -// Copyright (C) 2009 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -34,7 +34,7 @@ test01() typedef map<int, int>::value_type value_type; typedef pair<iterator, bool> insert_return_type; - insert_return_type irt0 = m0.insert(value_type(1, 1)); + m0.insert(value_type(1, 1)); insert_return_type irt1 = m0.insert(value_type(2, 2)); insert_return_type irt2 = m0.insert(value_type(3, 3)); @@ -58,7 +58,7 @@ test02() typedef pair<iterator, bool> insert_return_type; insert_return_type irt0 = m0.insert(value_type(1, 1)); - insert_return_type irt1 = m0.insert(value_type(2, 2)); + m0.insert(value_type(2, 2)); insert_return_type irt2 = m0.insert(value_type(3, 3)); insert_return_type irt3 = m0.insert(value_type(4, 4)); diff --git a/libstdc++-v3/testsuite/23_containers/map/pthread6.cc b/libstdc++-v3/testsuite/23_containers/map/pthread6.cc index 608527e8f08..38c20ed647f 100644 --- a/libstdc++-v3/testsuite/23_containers/map/pthread6.cc +++ b/libstdc++-v3/testsuite/23_containers/map/pthread6.cc @@ -1,7 +1,7 @@ // 2002-01-23 Loren J. Rittle <rittle@labs.mot.com> <ljrittle@acm.org> // Adpated from libstdc++/5444 submitted by markus.breuer@materna.de // -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009 +// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -78,10 +78,10 @@ main (void) #endif for (int i = 0; i < max_thread_count; i++) - pthread_create (&tid[i], NULL, thread_main, 0); + pthread_create (&tid[i], 0, thread_main, 0); for (int i = 0; i < max_thread_count; i++) - pthread_join (tid[i], NULL); + pthread_join (tid[i], 0); return 0; } diff --git a/libstdc++-v3/testsuite/23_containers/multimap/23781.cc b/libstdc++-v3/testsuite/23_containers/multimap/23781.cc index 912bb926b98..50ec929064e 100644 --- a/libstdc++-v3/testsuite/23_containers/multimap/23781.cc +++ b/libstdc++-v3/testsuite/23_containers/multimap/23781.cc @@ -1,6 +1,6 @@ // 2005-09-10 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2005, 2009 Free Software Foundation, Inc. +// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -22,6 +22,7 @@ // libstdc++/23781 #include <map> +#include <cstddef> std::multimap<int, int>::iterator it = NULL; // { dg-error "conversion" } std::multimap<int, int>::const_iterator cit = NULL; // { dg-error "conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/multiset/23781.cc b/libstdc++-v3/testsuite/23_containers/multiset/23781.cc index 80d13370345..6b0bacf955b 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/23781.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/23781.cc @@ -1,6 +1,6 @@ // 2005-09-10 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2005, 2009 Free Software Foundation, Inc. +// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -22,6 +22,7 @@ // libstdc++/23781 #include <set> +#include <cstddef> std::multiset<int>::iterator it = NULL; // { dg-error "conversion" } std::multiset<int>::const_iterator cit = NULL; // { dg-error "conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc b/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc index 416468617f1..0c21b25f900 100644 --- a/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc +++ b/libstdc++-v3/testsuite/23_containers/priority_queue/members/7161.cc @@ -1,6 +1,6 @@ // 2002-06-28 pme -// Copyright (C) 2002, 2004, 2005, 2009 Free Software Foundation, Inc. +// Copyright (C) 2002, 2004, 2005, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -28,12 +28,10 @@ test03() { int data[] = {1, 2, 3}; std::priority_queue<int> pq; - std::size_t size = pq.size(); for (int i = 0; i < 3; ++i) pq.push(data[i]); - size = pq.size(); pq.top(); for (int i = 0; i < 2; ++i) pq.pop(); diff --git a/libstdc++-v3/testsuite/23_containers/set/23781.cc b/libstdc++-v3/testsuite/23_containers/set/23781.cc index 7a2a2bc7240..b47b748ec8d 100644 --- a/libstdc++-v3/testsuite/23_containers/set/23781.cc +++ b/libstdc++-v3/testsuite/23_containers/set/23781.cc @@ -1,6 +1,6 @@ // 2005-09-10 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2005, 2009 Free Software Foundation, Inc. +// Copyright (C) 2005, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -22,6 +22,7 @@ // libstdc++/23781 #include <set> +#include <cstddef> std::set<int>::iterator it = NULL; // { dg-error "conversion" } std::set<int>::const_iterator cit = NULL; // { dg-error "conversion" } diff --git a/libstdc++-v3/testsuite/23_containers/set/dr130.cc b/libstdc++-v3/testsuite/23_containers/set/dr130.cc index 1904dcdc0bd..1dac5628d37 100644 --- a/libstdc++-v3/testsuite/23_containers/set/dr130.cc +++ b/libstdc++-v3/testsuite/23_containers/set/dr130.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // 2008-07-22 Edward Smith-Rowland <3dw4rd@verizon.net> // -// Copyright (C) 2009 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -33,7 +33,7 @@ test01() typedef set<int>::const_iterator const_iterator; typedef pair<iterator, bool> insert_return_type; - insert_return_type irt0 = s0.insert(1); + s0.insert(1); insert_return_type irt1 = s0.insert(2); insert_return_type irt2 = s0.insert(3); @@ -56,7 +56,7 @@ test02() typedef pair<iterator, bool> insert_return_type; insert_return_type irt0 = s0.insert(1); - insert_return_type irt1 = s0.insert(2); + s0.insert(2); insert_return_type irt2 = s0.insert(3); insert_return_type irt3 = s0.insert(4); diff --git a/libstdc++-v3/testsuite/23_containers/vector/resize/1.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc index 168df7a4a97..168df7a4a97 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/resize/1.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/1.cc diff --git a/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc index 47fdf8fcafa..5ba026dbeb5 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/moveable.cc @@ -1,6 +1,7 @@ // { dg-options "-std=gnu++0x" } -// Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 +// Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -17,19 +18,12 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. - #include <vector> #include <testsuite_hooks.h> #include <testsuite_rvalref.h> using namespace __gnu_test; -// According to n1771, there should be two resizes, with and without -// parameter. We only have one at present, whose second parameter defaults -// to a default-constructed object. -// Also, the values are one higher than might be expected because internally -// resize calls fill, which copies its input value in case it is already in -// the vector when the vector isn't moved. void test01() { @@ -41,30 +35,17 @@ test01() a.resize(98); a.resize(99); a.resize(100); -#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE) - VERIFY( copycounter::copycount == 100 + 1 ); -#else - VERIFY( copycounter::copycount == 100 + 1 + 4 ); -#endif + VERIFY( copycounter::copycount == 0 ); + a.resize(99); a.resize(0); -#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE) - VERIFY( copycounter::copycount == 100 + 1 ); -#else - VERIFY( copycounter::copycount == 100 + 1 + 6 ); -#endif + VERIFY( copycounter::copycount == 0 ); + a.resize(100); -#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE) - VERIFY( copycounter::copycount == 200 + 2 ); -#else - VERIFY( copycounter::copycount == 200 + 2 + 7 ); -#endif + VERIFY( copycounter::copycount == 0 ); + a.clear(); -#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE) - VERIFY( copycounter::copycount == 200 + 2 ); -#else - VERIFY( copycounter::copycount == 200 + 2 + 7 ); -#endif + VERIFY( copycounter::copycount == 0 ); } diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc new file mode 100644 index 00000000000..d181168acf7 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/resize/resize_size.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <vector> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::vector<__gnu_test::NonCopyConstructible> v; + VERIFY( std::distance(v.begin(), v.end()) == 0 ); + + v.resize(1000); + VERIFY( std::distance(v.begin(), v.end()) == 1000 ); + for(auto it = v.begin(); it != v.end(); ++it) + VERIFY( *it == -1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc new file mode 100644 index 00000000000..a33ba1ad69e --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/cons_size.cc @@ -0,0 +1,40 @@ +// { dg-options "-std=gnu++0x" } + +// 2010-06-18 Paolo Carlini <paolo.carlini@oracle.com> + +// Copyright (C) 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +#include <vector> +#include <testsuite_hooks.h> +#include <testsuite_api.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::vector<__gnu_test::NonCopyConstructible> v(1000); + VERIFY( std::distance(v.begin(), v.end()) == 1000 ); + for(auto it = v.begin(); it != v.end(); ++it) + VERIFY( *it == -1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc index b96b5359963..6925c1776a4 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1063 } +// { dg-error "no matching" "" { target *-*-* } 1148 } // { dg-excess-errors "" } #include <vector> diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc index 950643857c5..662bf169b23 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1003 } +// { dg-error "no matching" "" { target *-*-* } 1078 } // { dg-excess-errors "" } #include <vector> diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc index f17b541a4e0..fe2a2b25475 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1003 } +// { dg-error "no matching" "" { target *-*-* } 1078 } // { dg-excess-errors "" } #include <vector> diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc index 19d3fd08c4b..9869af131df 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1104 } +// { dg-error "no matching" "" { target *-*-* } 1189 } // { dg-excess-errors "" } #include <vector> |