diff options
Diffstat (limited to 'libstdc++-v3/testsuite')
752 files changed, 22184 insertions, 2175 deletions
diff --git a/libstdc++-v3/testsuite/17_intro/headers/all.cc b/libstdc++-v3/testsuite/17_intro/headers/all.cc index c0ef4bfa5f2..662bad6b10f 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/all.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/all.cc @@ -117,8 +117,6 @@ #include <ext/debug_allocator.h> #include <ext/enc_filebuf.h> #include <ext/functional> -#include <ext/hash_map> -#include <ext/hash_set> #include <ext/iterator> #include <ext/malloc_allocator.h> #include <ext/memory> diff --git a/libstdc++-v3/testsuite/17_intro/headers/all_c++200x_compatibility.cc b/libstdc++-v3/testsuite/17_intro/headers/all_c++200x_compatibility.cc index 1052cd7cf26..9410805a085 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/all_c++200x_compatibility.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/all_c++200x_compatibility.cc @@ -118,8 +118,6 @@ #include <ext/debug_allocator.h> #include <ext/enc_filebuf.h> #include <ext/functional> -#include <ext/hash_map> -#include <ext/hash_set> #include <ext/iterator> #include <ext/malloc_allocator.h> #include <ext/memory> diff --git a/libstdc++-v3/testsuite/17_intro/headers/all_pedantic_errors.cc b/libstdc++-v3/testsuite/17_intro/headers/all_pedantic_errors.cc new file mode 100644 index 00000000000..2b72a3928a5 --- /dev/null +++ b/libstdc++-v3/testsuite/17_intro/headers/all_pedantic_errors.cc @@ -0,0 +1,144 @@ +// { dg-do compile } +// { dg-options "-pedantic-errors" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// Make sure all the includes can be compiled with -Wc++0x-compat +// libstdc++/30571 + +// C +#include <cassert> +#include <cctype> +#include <cerrno> +#include <cfloat> +#include <ciso646> +#include <climits> +#include <clocale> +#include <cmath> +#include <csetjmp> +#include <csignal> +#include <cstdarg> +#include <cstddef> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <ctime> + +// C++ +#include <algorithm> +#include <bitset> +#include <complex> +#include <deque> +#include <exception> +#include <fstream> +#include <functional> +#include <iomanip> +#include <ios> +#include <iosfwd> +#include <iostream> +#include <istream> +#include <iterator> +#include <limits> +#include <list> +#include <locale> +#include <map> +#include <memory> +#include <new> +#include <numeric> +#include <ostream> +#include <queue> +#include <set> +#include <sstream> +#include <stack> +#include <stdexcept> +#include <streambuf> +#include <string> +#include <typeinfo> +#include <utility> +#include <valarray> +#include <vector> + +// TR1 +#include <tr1/array> +#include <tr1/cctype> +#include <tr1/cfenv> +#include <tr1/cfloat> +#include <tr1/cinttypes> +#include <tr1/climits> +#include <tr1/cmath> +#include <tr1/complex> +#include <tr1/cstdarg> +#include <tr1/cstdbool> +#include <tr1/cstdint> +#include <tr1/cstdio> +#include <tr1/cstdlib> +#include <tr1/ctgmath> +#include <tr1/ctime> +#include <tr1/cwchar> +#include <tr1/cwctype> +#include <tr1/functional> +#include <tr1/random> +#include <tr1/tuple> +#include <tr1/unordered_map> +#include <tr1/unordered_set> +#include <tr1/utility> + +// Extensions +#include <ext/algorithm> +#include <ext/array_allocator.h> +#include <ext/atomicity.h> +#include <ext/bitmap_allocator.h> +#include <ext/codecvt_specializations.h> +#include <ext/concurrence.h> +#include <ext/debug_allocator.h> +#include <ext/enc_filebuf.h> +#include <ext/functional> +#include <ext/iterator> +#include <ext/malloc_allocator.h> +#include <ext/memory> +#include <ext/mt_allocator.h> +#include <ext/new_allocator.h> +#include <ext/numeric> +#include <ext/pod_char_traits.h> +#include <ext/pool_allocator.h> +#include <ext/rb_tree> +#include <ext/rope> +#include <ext/slist> +#include <ext/stdio_filebuf.h> +#include <ext/stdio_sync_filebuf.h> +#include <ext/throw_allocator.h> +#include <ext/typelist.h> +#include <ext/type_traits.h> +#include <ext/vstring.h> +#include <ext/pb_ds/assoc_container.hpp> +#include <ext/pb_ds/priority_queue.hpp> +#include <ext/pb_ds/exception.hpp> +#include <ext/pb_ds/hash_policy.hpp> +#include <ext/pb_ds/list_update_policy.hpp> +#include <ext/pb_ds/tree_policy.hpp> +#include <ext/pb_ds/trie_policy.hpp> diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all.cc index 2704e491f4d..6416734276a 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all.cc @@ -61,8 +61,12 @@ #include <stdlib.h> #include <string.h> #include <time.h> +#ifdef _GLIBCXX_HAVE_WCHAR_H #include <wchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCTYPE_H #include <wctype.h> +#endif // "C++" headers #include <algorithm> diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_multiple_inclusion.cc b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_multiple_inclusion.cc index a1cb289039a..831616b9512 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_multiple_inclusion.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++1998/all_multiple_inclusion.cc @@ -61,8 +61,12 @@ #include <stdlib.h> #include <string.h> #include <time.h> +#ifdef _GLIBCXX_HAVE_WCHAR_H #include <wchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCTYPE_H #include <wctype.h> +#endif // "C++" headers #include <algorithm> @@ -136,8 +140,12 @@ #include <stdlib.h> #include <string.h> #include <time.h> +#ifdef _GLIBCXX_HAVE_WCHAR_H #include <wchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCTYPE_H #include <wctype.h> +#endif // "C++" headers #include <algorithm> diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc index 76566d0ac91..f1ed7cf38b5 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all.cc @@ -82,8 +82,12 @@ #include <tgmath.h> #endif #include <time.h> +#ifdef _GLIBCXX_HAVE_WCHAR_H #include <wchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCTYPE_H #include <wctype.h> +#endif // "C++" headers #include <algorithm> @@ -117,6 +121,7 @@ #include <stdexcept> #include <streambuf> #include <string> +#include <system_error> #include <tuple> #include <typeinfo> #include <type_traits> diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc index d788be21578..9aa802c7041 100644 --- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc +++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc @@ -82,8 +82,12 @@ #include <tgmath.h> #endif #include <time.h> +#ifdef _GLIBCXX_HAVE_WCHAR_H #include <wchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCTYPE_H #include <wctype.h> +#endif // "C++" headers #include <algorithm> @@ -188,8 +192,12 @@ #include <tgmath.h> #endif #include <time.h> +#ifdef _GLIBCXX_HAVE_WCHAR_H #include <wchar.h> +#endif +#ifdef _GLIBCXX_HAVE_WCTYPE_H #include <wctype.h> +#endif // "C++" headers #include <algorithm> diff --git a/libstdc++-v3/testsuite/18_support/headers/cstddef/macros.cc b/libstdc++-v3/testsuite/18_support/headers/cstddef/macros.cc index 4751d161e8e..6cad8c00ffd 100644 --- a/libstdc++-v3/testsuite/18_support/headers/cstddef/macros.cc +++ b/libstdc++-v3/testsuite/18_support/headers/cstddef/macros.cc @@ -1,7 +1,8 @@ // { dg-do compile } // 2001-02-06 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001, 2003, 2007 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 @@ -42,7 +43,7 @@ namespace gnu void test02() { // Must not be (void*)0 - const int j = NULL; + const int j __attribute__((unused)) = NULL; #ifndef NULL #error "NULL_must_be_a_macro" diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc new file mode 100644 index 00000000000..2609c430998 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/copy_neg.cc @@ -0,0 +1,56 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> +#include <testsuite_hooks.h> + +namespace __gnu_test +{ + struct test_category : public std::error_category + { + virtual std::posix_error::posix_errno + posix(int __v) const + { return std::posix_error::posix_errno(__v); } + + virtual const std::string& + name() const + { + static std::string s("__gnu_test::test_category"); + return s; + } + }; +} + +int main() +{ + bool test __attribute__((unused)) = true; + + __gnu_test::test_category c1; + __gnu_test::test_category c2(c1); + + return 0; +} + +// { dg-error "is private" "" { target *-*-* } 75 } +// { dg-error "within this context" "" { target *-*-* } 29 } +// { dg-error "first required here" "" { target *-*-* } 48 } +// { dg-excess-errors "copy constructor" } diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc new file mode 100644 index 00000000000..1072cc63c67 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/cons/default.cc @@ -0,0 +1,61 @@ +// { dg-options "-std=gnu++0x" } +// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> +#include <testsuite_hooks.h> + +namespace __gnu_test +{ + struct test_category : public std::error_category + { + virtual std::posix_error::posix_errno + posix(int __v) const + { return std::posix_error::posix_errno(__v); } + + virtual const std::string& + name() const + { + static std::string s("__gnu_test::test_category"); + return s; + } + }; + + struct test_derived_category : public test_category + { + virtual const std::string& + name() const + { + static std::string s("__gnu_test::test_derived_category"); + return s; + } + }; +} + +int main() +{ + bool test __attribute__((unused)) = true; + + // 1 + __gnu_test::test_category c1; + __gnu_test::test_derived_category c2; + + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc new file mode 100644 index 00000000000..7b8a19cd7e3 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/equal.cc @@ -0,0 +1,62 @@ +// { dg-options "-std=gnu++0x" } +// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> +#include <testsuite_hooks.h> + +namespace __gnu_test +{ + struct test_category : public std::error_category + { + virtual std::posix_error::posix_errno + posix(int __v) const + { return std::posix_error::posix_errno(__v); } + + virtual const std::string& + name() const + { + static std::string s("__gnu_test::test_category"); + return s; + } + }; + + struct test_derived_category : public test_category + { + virtual const std::string& + name() const + { + static std::string s("__gnu_test::test_derived_category"); + return s; + } + }; +} + +int main() +{ + bool test __attribute__((unused)) = true; + + __gnu_test::test_category c1; + __gnu_test::test_derived_category c2; + VERIFY( c1 == c1 ); + VERIFY( !(c1 == c2) ); + + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc new file mode 100644 index 00000000000..043c8a207a3 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_category/operators/not_equal.cc @@ -0,0 +1,62 @@ +// { dg-options "-std=gnu++0x" } +// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> +#include <testsuite_hooks.h> + +namespace __gnu_test +{ + struct test_category : public std::error_category + { + virtual std::posix_error::posix_errno + posix(int __v) const + { return std::posix_error::posix_errno(__v); } + + virtual const std::string& + name() const + { + static std::string s("__gnu_test::test_category"); + return s; + } + }; + + struct test_derived_category : public test_category + { + virtual const std::string& + name() const + { + static std::string s("__gnu_test::test_derived_category"); + return s; + } + }; +} + +int main() +{ + bool test __attribute__((unused)) = true; + + __gnu_test::test_category c1; + __gnu_test::test_derived_category c2; + VERIFY( !(c1 != c1) ); + VERIFY( c1 != c2 ); + + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc new file mode 100644 index 00000000000..ea1316d067a --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/cons/1.cc @@ -0,0 +1,63 @@ +// { dg-options "-std=gnu++0x" } +// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> +#include <testsuite_hooks.h> + +namespace __gnu_test +{ + struct test_category : public std::error_category + { + virtual std::posix_error::posix_errno + posix(int __v) const + { return std::posix_error::posix_errno(__v); } + + virtual const std::string& + name() const + { + static std::string s("__gnu_test::test_category"); + return s; + } + }; +} + +int main() +{ + bool test __attribute__((unused)) = true; + + // 1 + std::error_code e1; + VERIFY( e1.value() == 0 ); + VERIFY( e1.category() == std::system_category ); + + // 2 + const __gnu_test::test_category cat; + std::error_code e2(e1.value(), cat); + VERIFY( e2.value() == e1.value() ); + VERIFY( e2.category() == cat ); + + // 3 + std::error_code e3(std::posix_error::operation_not_supported); + VERIFY( e3.value() == int(std::posix_error::operation_not_supported) ); + VERIFY( e3.category() == std::system_category ); + + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc new file mode 100644 index 00000000000..04fd44fb677 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=gnu++0x" } +// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> +#include <testsuite_hooks.h> + +// unspecified bool operator positive tests +int main() +{ + bool test __attribute__((unused)) = true; + + // 1 + std::error_code e1; + if (e1) + { + VERIFY( false ); + } + + // 2 + std::error_code e2(std::posix_error::operation_not_supported); + if (e2) + { + VERIFY( true ); + } + + return 0; +} diff --git a/libstdc++-v3/testsuite/backward/header_deque_h.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool_neg.cc index d3a7f2b0b1c..6af9d13a61d 100644 --- a/libstdc++-v3/testsuite/backward/header_deque_h.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/bool_neg.cc @@ -1,6 +1,8 @@ -// 2001-09-20 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2007 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 @@ -18,14 +20,15 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. -// backward header deque.h - -#include <deque.h> +#include <system_error> #include <testsuite_hooks.h> -// { dg-options "-Wno-deprecated" } - -int main(void) +int main() { - return 0; + std::error_code e; + int i = e; + + return i; } + +// { dg-error "invalid conversion" "" { target *-*-* } 29 } diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc new file mode 100644 index 00000000000..a98ed9023a0 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/equal.cc @@ -0,0 +1,58 @@ +// { dg-options "-std=gnu++0x" } +// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> +#include <testsuite_hooks.h> + +namespace __gnu_test +{ + struct test_category : public std::error_category + { + virtual std::posix_error::posix_errno + posix(int __v) const + { return std::posix_error::posix_errno(__v); } + + virtual const std::string& + name() const + { + static std::string s("__gnu_test::test_category"); + return s; + } + }; +} + +// unspecified bool operator positive tests +int main() +{ + bool test __attribute__((unused)) = true; + + std::error_code e1; + std::error_code e2(std::posix_error::operation_not_supported); + + VERIFY( e1 == e1 ); + VERIFY( !(e1 == e2) ); + + const __gnu_test::test_category cat; + std::error_code e3(e2.value(), cat); + VERIFY( !(e2 == e3) ); + + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc new file mode 100644 index 00000000000..00153456403 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/error_code/operators/not_equal.cc @@ -0,0 +1,58 @@ +// { dg-options "-std=gnu++0x" } +// 2007-08-22 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> +#include <testsuite_hooks.h> + +namespace __gnu_test +{ + struct test_category : public std::error_category + { + virtual std::posix_error::posix_errno + posix(int __v) const + { return std::posix_error::posix_errno(__v); } + + virtual const std::string& + name() const + { + static std::string s("__gnu_test::test_category"); + return s; + } + }; +} + +// unspecified bool operator positive tests +int main() +{ + bool test __attribute__((unused)) = true; + + std::error_code e1; + std::error_code e2(std::posix_error::operation_not_supported); + + VERIFY( !(e1 != e1) ); + VERIFY( e1 != e2 ); + + const __gnu_test::test_category cat; + std::error_code e3(e2.value(), cat); + VERIFY( e2 != e3 ); + + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/34538.cc b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/34538.cc new file mode 100644 index 00000000000..d682a64a128 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/34538.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <stdexcept> +#include <system_error> + +// libstdc++/34538 +int main() +{ + throw std::invalid_argument("foo"); +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc new file mode 100644 index 00000000000..fc04cf55fb9 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc @@ -0,0 +1,26 @@ +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> // { dg-excess-errors "In file included from" } + +// { dg-error "upcoming ISO" "" { target *-*-* } 36 } + + + diff --git a/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc new file mode 100644 index 00000000000..31b6d4bf531 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/headers/system_error/types_std_c++0x.cc @@ -0,0 +1,154 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> + +namespace gnu +{ + using std::system_error; + using std::error_code; + using std::error_category; + using std::system_category; + + using std::posix_error::posix_errno; + using std::posix_error::address_family_not_supported; + using std::posix_error::address_in_use; + using std::posix_error::address_not_available; + using std::posix_error::already_connected; + using std::posix_error::argument_list_too_long; + using std::posix_error::argument_out_of_domain; + using std::posix_error::bad_address; + using std::posix_error::bad_file_descriptor; + +#ifdef _GLIBCXX_HAVE_EBADMSG + using std::posix_error::bad_message; +#endif + + using std::posix_error::broken_pipe; + using std::posix_error::connection_aborted; + using std::posix_error::connection_already_in_progress; + using std::posix_error::connection_refused; + using std::posix_error::connection_reset; + using std::posix_error::cross_device_link; + using std::posix_error::destination_address_required; + using std::posix_error::device_or_resource_busy; + using std::posix_error::directory_not_empty; + using std::posix_error::executable_format_error; + using std::posix_error::file_exists; + using std::posix_error::file_too_large; + using std::posix_error::filename_too_long; + using std::posix_error::function_not_supported; + using std::posix_error::host_unreachable; + using std::posix_error::identifier_removed; + using std::posix_error::illegal_byte_sequence; + using std::posix_error::inappropriate_io_control_operation; + using std::posix_error::interrupted; + using std::posix_error::invalid_argument; + using std::posix_error::invalid_seek; + using std::posix_error::io_error; + using std::posix_error::is_a_directory; + using std::posix_error::message_size; + using std::posix_error::network_down; + using std::posix_error::network_reset; + using std::posix_error::network_unreachable; + using std::posix_error::no_buffer_space; + using std::posix_error::no_child_process; + +#ifdef _GLIBCXX_HAVE_ENOLINK + using std::posix_error::no_link; +#endif + + using std::posix_error::no_lock_available; + +#ifdef _GLIBCXX_HAVE_ENODATA + using std::posix_error::no_message_available; +#endif + + using std::posix_error::no_message; + using std::posix_error::no_posix_equivalent; + using std::posix_error::no_protocol_option; + using std::posix_error::no_space_on_device; + +#ifdef _GLIBCXX_HAVE_ENOSR + using std::posix_error::no_stream_resources; +#endif + + using std::posix_error::no_such_device_or_address; + using std::posix_error::no_such_device; + using std::posix_error::no_such_file_or_directory; + using std::posix_error::no_such_process; + using std::posix_error::not_a_directory; + using std::posix_error::not_a_socket; + +#ifdef _GLIBCXX_HAVE_ENOSTR + using std::posix_error::not_a_stream; +#endif + + using std::posix_error::not_connected; + using std::posix_error::not_enough_memory; + using std::posix_error::not_supported; + +#ifdef _GLIBCXX_HAVE_ECANCELED + using std::posix_error::operation_canceled; +#endif + + using std::posix_error::operation_in_progress; + using std::posix_error::operation_not_permitted; + using std::posix_error::operation_not_supported; + using std::posix_error::operation_would_block; + +#ifdef _GLIBCXX_HAVE_EOWNERDEAD + using std::posix_error::owner_dead; +#endif + + using std::posix_error::permission_denied; + +#ifdef _GLIBCXX_HAVE_EPROTO + using std::posix_error::protocol_error; +#endif + + using std::posix_error::protocol_not_supported; + using std::posix_error::read_only_file_system; + using std::posix_error::resource_deadlock_would_occur; + using std::posix_error::resource_unavailable_try_again; + using std::posix_error::result_out_of_range; + +#ifdef _GLIBCXX_HAVE_ENOTRECOVERABLE + using std::posix_error::state_not_recoverable; +#endif + +#ifdef _GLIBCXX_HAVE_ETIME + using std::posix_error::stream_timeout; +#endif + + using std::posix_error::text_file_busy; + using std::posix_error::timed_out; + using std::posix_error::too_many_files_open_in_system; + using std::posix_error::too_many_files_open; + using std::posix_error::too_many_links; + using std::posix_error::too_many_synbolic_link_levels; + +#ifdef _GLIBCXX_HAVE_EOVERFLOW + using std::posix_error::value_too_large; +#endif + + using std::posix_error::wrong_protocol_type; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc new file mode 100644 index 00000000000..2885dad2723 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons-1.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=gnu++0x" } +// 2007-06-05 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cstring> +#include <system_error> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + const std::string s("too late: boulangerie out of pain au raisin"); + const std::error_code e(std::posix_error::operation_not_supported); + + // 1 + { + std::system_error err1(s, e); + VERIFY( err1.code() == e ); + VERIFY( std::strcmp(err1.runtime_error::what(), s.c_str()) == 0 ); + } + + // 2 + { + std::system_error err2(s, 95, std::system_category); + VERIFY( err2.code() == std::error_code(95, std::system_category) ); + VERIFY( std::strcmp(err2.runtime_error::what(), s.c_str()) == 0 ); + } + + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc new file mode 100644 index 00000000000..09ba2fd13e4 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/cons_virtual_derivation.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } +// 2007-05-29 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <system_error> +#include <testsuite_api.h> + +int main() +{ + typedef std::system_error test_type; + __gnu_test::diamond_derivation<test_type, false>::test(); + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc new file mode 100644 index 00000000000..c178e542a3c --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-1.cc @@ -0,0 +1,59 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 19.1 Exception classes + +#include <string> +#include <system_error> +#include <cstring> +#include <testsuite_hooks.h> + +// libstdc++/1972 +void test01() +{ + bool test __attribute__((unused)) = true; + std::string s("lack of sunlight, no water error"); + + // 1 + std::system_error obj1 = std::system_error(s); + + // 2 + std::system_error obj2(s); + + VERIFY( std::strcmp(obj1.what(), s.data()) == 0 ); + VERIFY( std::strcmp(obj2.what(), s.data()) == 0 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + std::string s("lack of sunlight error"); + std::system_error x(s); + + VERIFY( std::strcmp(x.what(), s.data()) == 0 ); +} + +int main(void) +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc new file mode 100644 index 00000000000..eb8e14c9cc1 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-2.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 19.1 Exception classes + +#include <string> +#include <system_error> +#include <cstring> +#include <testsuite_hooks.h> + +// libstdc++/2089 +class fuzzy_logic : public std::system_error +{ +public: + fuzzy_logic() : std::system_error("whoa") { } +}; + +void test03() +{ + bool test __attribute__((unused)) = true; + try + { throw fuzzy_logic(); } + catch(const fuzzy_logic& obj) + { VERIFY( std::strcmp("whoa", obj.what()) == 0 ); } + catch(...) + { VERIFY( false ); } +} + +int main(void) +{ + test03(); + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc new file mode 100644 index 00000000000..23d99a87d94 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-3.cc @@ -0,0 +1,69 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <string> +#include <system_error> +#include <cstring> +#include <testsuite_hooks.h> + +// test copy ctors, assignment operators, and persistence of member string data +// libstdc++/1972 +// via Greg Bumgardner <bumgard@roguewave.com> +void allocate_on_stack(void) +{ + const size_t num = 512; + __extension__ char array[num]; + for (size_t i = 0; i < num; i++) + array[i]=0; +} + +void test04() +{ + bool test __attribute__((unused)) = true; + const std::string s("CA ISO emergency once again:immediate power down"); + const char* strlit1 = "wish I lived in Palo Alto"; + const char* strlit2 = "...or Santa Barbara"; + std::system_error obj1(s); + + // block 01 + { + const std::string s2(strlit1); + std::system_error obj2(s2); + obj1 = obj2; + } + allocate_on_stack(); + VERIFY( std::strcmp(strlit1, obj1.what()) == 0 ); + + // block 02 + { + const std::string s3(strlit2); + std::system_error obj3 = std::system_error(s3); + obj1 = obj3; + } + allocate_on_stack(); + VERIFY( std::strcmp(strlit2, obj1.what()) == 0 ); +} + +int main(void) +{ + test04(); + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc new file mode 100644 index 00000000000..89570f04721 --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-4.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 +// 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 19.1 Exception classes + +#include <cstring> +#include <string> +#include <system_error> +#include <testsuite_hooks.h> + +// Make sure each invocation of what() doesn't grow the message. +void test01() +{ + bool test __attribute__((unused)) = true; + std::string s("after nine thirty, this request cannot be met"); + + std::system_error obj = std::system_error(s, std::posix_error::invalid_argument); + std::string s1(obj.what()); + std::string s2(obj.what()); + VERIFY( s1 == s2 ); +} + +int main(void) +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc new file mode 100644 index 00000000000..765bcbf19fe --- /dev/null +++ b/libstdc++-v3/testsuite/19_diagnostics/system_error/what-big.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <cstring> +#include <string> +#include <system_error> +#include <testsuite_hooks.h> + +// Can construct and return 10k character error string. +void test01() +{ + typedef std::system_error test_type; + + bool test __attribute__((unused)) = true; + const std::string xxx(10000, 'x'); + test_type t(xxx); + VERIFY( std::strcmp(t.what(), xxx.c_str()) == 0 ); +} + +int main(void) +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..2b6a9d18fb9 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } +// 2007-09-17 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NB: This file is for testing type_traits with NO OTHER INCLUDES. + +#include <type_traits> + +namespace std +{ + typedef short test_type; + template struct aligned_storage<1, alignment_of<test_type>::value>; + template struct aligned_storage<2>; +} diff --git a/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc b/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc new file mode 100644 index 00000000000..2ea6fee4956 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc @@ -0,0 +1,68 @@ +// { dg-options "-std=gnu++0x" } +// 2007-09-17 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <type_traits> +#include <testsuite_hooks.h> +#include <testsuite_tr1.h> + +struct MSAlignType { } __attribute__((__aligned__)); + +void test01() +{ + bool test __attribute__((unused)) = true; + using std::aligned_storage; + using std::alignment_of; + using namespace __gnu_test; + + const std::size_t align_c = alignment_of<char>::value; + VERIFY( (sizeof(aligned_storage<4, align_c>::type) >= 4) ); + VERIFY( (__alignof__(aligned_storage<4, align_c>::type) == align_c) ); + + const std::size_t align_s = alignment_of<short>::value; + VERIFY( (sizeof(aligned_storage<1, align_s>::type) >= 1) ); + VERIFY( (__alignof__(aligned_storage<1, align_s>::type) == align_s) ); + + const std::size_t align_i = alignment_of<int>::value; + VERIFY( (sizeof(aligned_storage<7, align_i>::type) >= 7) ); + VERIFY( (__alignof__(aligned_storage<7, align_i>::type) == align_i) ); + + const std::size_t align_d = alignment_of<double>::value; + VERIFY( (sizeof(aligned_storage<2, align_d>::type) >= 2) ); + VERIFY( (__alignof__(aligned_storage<2, align_d>::type) == align_d) ); + + const std::size_t align_ai = alignment_of<int[4]>::value; + VERIFY( (sizeof(aligned_storage<20, align_ai>::type) >= 20) ); + VERIFY( (__alignof__(aligned_storage<20, align_ai>::type) == align_ai) ); + + const std::size_t align_ct = alignment_of<ClassType>::value; + VERIFY( (sizeof(aligned_storage<11, align_ct>::type) >= 11) ); + VERIFY( (__alignof__(aligned_storage<11, align_ct>::type) == align_ct) ); + + const std::size_t align_msa = alignment_of<MSAlignType>::value; + VERIFY( (sizeof(aligned_storage<5>::type) >= 5) ); + VERIFY( (__alignof__(aligned_storage<5>::type) == align_msa) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/backward/header_hash_map_h.cc b/libstdc++-v3/testsuite/20_util/allocator/33807.cc index cede092eeb4..7d9c9ba198d 100644 --- a/libstdc++-v3/testsuite/backward/header_hash_map_h.cc +++ b/libstdc++-v3/testsuite/20_util/allocator/33807.cc @@ -1,6 +1,6 @@ -// 2002-03-15 Philipp Thomas <pthomas@suse.de> +// { dg-do compile } -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2007 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 @@ -18,14 +18,16 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. -// backward header hash_map.h +#include <list> -#include <hash_map.h> -#include <testsuite_hooks.h> +// libstdc++/33807 +template <class T> +bool operator != (const T& x, const T& y) { return !(x == y); } -// { dg-options "-Wno-deprecated" } +struct foo { }; -int main(void) +void fnx() { - return 0; + std::list<foo> l1, l2; + l1 = l2; } diff --git a/libstdc++-v3/testsuite/20_util/auto_ptr/assign_neg.cc b/libstdc++-v3/testsuite/20_util/auto_ptr/assign_neg.cc index ffca8986fad..04a17068dfd 100644 --- a/libstdc++-v3/testsuite/20_util/auto_ptr/assign_neg.cc +++ b/libstdc++-v3/testsuite/20_util/auto_ptr/assign_neg.cc @@ -1,6 +1,7 @@ // { dg-do compile } -// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation +// Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 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 @@ -46,5 +47,5 @@ main() test01(); return 0; } -// { dg-error "candidates" "" { target *-*-* } 141 } -// { dg-error "::auto_ptr" "" { target *-*-* } 271 } +// { dg-error "candidates" "" { target *-*-* } 139 } +// { dg-error "::auto_ptr" "" { target *-*-* } 267 } diff --git a/libstdc++-v3/testsuite/20_util/function_objects/bad_function_call/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc index 6cc46c02a51..6cc46c02a51 100644 --- a/libstdc++-v3/testsuite/20_util/function_objects/bad_function_call/cons_virtual_derivation.cc +++ b/libstdc++-v3/testsuite/20_util/bad_function_call/cons_virtual_derivation.cc diff --git a/libstdc++-v3/testsuite/20_util/decay/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/decay/requirements/typedefs.cc index 162ddd2ff42..30b98d518e0 100644 --- a/libstdc++-v3/testsuite/20_util/decay/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/decay/requirements/typedefs.cc @@ -34,8 +34,9 @@ void test01() typedef decay<bool>::type test1_type; VERIFY( (is_same<test1_type, bool>::value) ); + // NB: DR 705. typedef decay<const int>::type test2_type; - VERIFY( (is_same<test2_type, const int>::value) ); + VERIFY( (is_same<test2_type, int>::value) ); typedef decay<int[4]>::type test3_type; VERIFY( (is_same<test3_type, std::remove_extent<int[4]>::type*>::value) ); diff --git a/libstdc++-v3/testsuite/20_util/function_objects/dr660.cc b/libstdc++-v3/testsuite/20_util/function_objects/dr660.cc new file mode 100644 index 00000000000..bbc27b02a10 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/function_objects/dr660.cc @@ -0,0 +1,42 @@ +// 2007-08-02 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <functional> +#include <testsuite_hooks.cc> + +// DR 660. Missing Bitwise Operations. +void test01() +{ + bool test __attribute__((unused)) = true; + + for (int i1 = 0; i1 < 1000; ++i1) + for (int i2 = 0; i2 < 1000; ++i2) + { + VERIFY( std::bit_and<int>()(i1, i2) == (i1 & i2) ); + VERIFY( std::bit_or<int>()(i1, i2) == (i1 | i2) ); + VERIFY( std::bit_xor<int>()(i1, i2) == (i1 ^ i2) ); + } +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/hash/operators/size_t.cc b/libstdc++-v3/testsuite/20_util/hash/operators/size_t.cc new file mode 100644 index 00000000000..89e82cd4a90 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/hash/operators/size_t.cc @@ -0,0 +1,55 @@ +// { dg-options "-std=gnu++0x" } +// 2007-08-20 <benjamin@redhat.com> +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <functional> +#include <system_error> +#include <testsuite_hooks.h> + +template<typename T> + void + do_test() + { + bool test __attribute__((unused)) = true; + + typedef T value_type; + typedef std::hash<value_type> hash_type; + using std::size_t; + + value_type v; // default initialized is fine, same value all that matters. + hash_type h1; + size_t r1 = size_t(h1(v)); + + hash_type h2; + size_t r2 = size_t(h2(v)); + + VERIFY( r1 == r2 ); + } + +void test01() +{ + do_test<std::error_code>(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc new file mode 100644 index 00000000000..7b82eeeab2f --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/hash/requirements/explicit_instantiation.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02110-1301, USA. + +#include <functional> +#include <string> +#include <system_error> + +// Verify that we can instantiate hash for every required type. +template class std::hash<bool>; +template class std::hash<char>; +template class std::hash<signed char>; +template class std::hash<unsigned char>; +template class std::hash<short>; +template class std::hash<int>; +template class std::hash<long>; +template class std::hash<unsigned short>; +template class std::hash<unsigned int>; +template class std::hash<unsigned long>; +template class std::hash<float>; +template class std::hash<double>; +template class std::hash<long double>; +template class std::hash<void*>; +template class std::hash<std::string>; +template class std::hash<std::error_code>; + +#ifdef _GLIBCXX_USE_WCHAR_T +template class std::hash<wchar_t>; +template class std::hash<std::wstring>; +#endif + diff --git a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc index 774dca5af70..ff912c2cc0a 100644 --- a/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs_neg.cc @@ -49,8 +49,8 @@ void test01() // { dg-error "instantiated from here" "" { target *-*-* } 41 } // { dg-error "instantiated from here" "" { target *-*-* } 43 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 489 } -// { dg-error "declaration of" "" { target *-*-* } 455 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 511 } +// { dg-error "declaration of" "" { target *-*-* } 477 } // { dg-excess-errors "At global scope" } // { dg-excess-errors "In instantiation of" } diff --git a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc index 56ce7b9d225..5b2b3dc9f82 100644 --- a/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc +++ b/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs_neg.cc @@ -49,8 +49,8 @@ void test01() // { dg-error "instantiated from here" "" { target *-*-* } 41 } // { dg-error "instantiated from here" "" { target *-*-* } 43 } -// { dg-error "invalid use of incomplete type" "" { target *-*-* } 414 } -// { dg-error "declaration of" "" { target *-*-* } 380 } +// { dg-error "invalid use of incomplete type" "" { target *-*-* } 436 } +// { dg-error "declaration of" "" { target *-*-* } 402 } // { dg-excess-errors "At global scope" } // { dg-excess-errors "In instantiation of" } diff --git a/libstdc++-v3/testsuite/20_util/pair/moveable.cc b/libstdc++-v3/testsuite/20_util/pair/moveable.cc new file mode 100644 index 00000000000..cd5de4162eb --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/pair/moveable.cc @@ -0,0 +1,72 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on pair, and also vector. If the implementation +// changes this test may begin to fail. + +#include <vector> +#include <utility> +#include <testsuite_hooks.h> + +bool test __attribute__((unused)) = true; + +void +test1() +{ + std::pair<int,int> a(1,1),b(2,2); + a=std::move(b); + VERIFY(a.first == 2 && a.second == 2 && b.first == 2 && b.second == 2); + std::pair<int,int> c(std::move(a)); + VERIFY(c.first == 2 && c.second == 2 && a.first == 2 && a.second == 2); +} + +void +test2() +{ + std::vector<int> v,w; + v.push_back(1); + w.push_back(2); + w.push_back(2); + std::pair<int, std::vector<int> > p = make_pair(1,v); + std::pair<int, std::vector<int> > q = make_pair(2,w); + p = std::move(q); + VERIFY(p.first == 2 && q.first == 2 && + p.second.size() == 2 && q.second.size() == 0); + std::pair<int, std::vector<int> > r(std::move(p)); + VERIFY(r.first == 2 && p.first == 2 && + r.second.size() == 2 && p.second.size() == 0); +} + +int +main() +{ + test1(); + test2(); +} diff --git a/libstdc++-v3/testsuite/20_util/pair/swap.cc b/libstdc++-v3/testsuite/20_util/pair/swap.cc new file mode 100644 index 00000000000..e045097b4a2 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/pair/swap.cc @@ -0,0 +1,59 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <utility> +#include <testsuite_allocator.h> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef __gnu_test::uneq_allocator<double> ua_type; + ua_type one(1), two(2); + + std::pair<ua_type, int> p1(one, 1), p2(two, 2); + + p1.swap(p2); + VERIFY( p1.first.get_personality() == 2 ); + VERIFY( p1.second == 2 ); + VERIFY( p2.first.get_personality() == 1 ); + VERIFY( p2.second == 1 ); + + swap(p1, p2); + VERIFY( p2.first.get_personality() == 2 ); + VERIFY( p2.second == 2 ); + VERIFY( p1.first.get_personality() == 1 ); + VERIFY( p1.second == 1 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/raw_storage_iterator/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/raw_storage_iterator/requirements/typedefs.cc index 4a51c4c6fd3..56019a7494b 100644 --- a/libstdc++-v3/testsuite/20_util/raw_storage_iterator/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/20_util/raw_storage_iterator/requirements/typedefs.cc @@ -1,7 +1,8 @@ // { dg-do compile } // 2001-06-18 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001, 2003, 2007 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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,7 +29,6 @@ void test01() using namespace std; // Check for required typedefs - long l; typedef raw_storage_iterator<long*, long> test_iterator; typedef test_iterator::value_type value_type; typedef test_iterator::difference_type difference_type; diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/assign.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/assign.cc new file mode 100644 index 00000000000..6f428ca0d34 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/assign.cc @@ -0,0 +1,73 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A +{ + A() { ++ctor_count; } + virtual ~A() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long A::ctor_count = 0; +long A::dtor_count = 0; + +struct reset_count_struct +{ + ~reset_count_struct() + { + A::ctor_count = 0; + A::dtor_count = 0; + } +}; + + +// 20.6.6.2.3 shared_ptr assignment [util.smartptr.shared.assign] + +// Assignment from shared_ptr<Y> +void +test01() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a; + + a = std::shared_ptr<A>(new A); + VERIFY( a.get() != 0 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + + a = std::shared_ptr<A>(); + VERIFY( a.get() == 0 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 1 ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc new file mode 100644 index 00000000000..2a18b486236 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr.cc @@ -0,0 +1,86 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A +{ + A() { ++ctor_count; } + virtual ~A() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long A::ctor_count = 0; +long A::dtor_count = 0; + +struct B : A +{ + B() { ++ctor_count; } + virtual ~B() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long B::ctor_count = 0; +long B::dtor_count = 0; + + +struct reset_count_struct +{ + ~reset_count_struct() + { + A::ctor_count = 0; + A::dtor_count = 0; + B::ctor_count = 0; + B::dtor_count = 0; + } +}; + + +// 20.6.6.2.3 shared_ptr assignment [util.smartptr.shared.assign] + +// Assignment from auto_ptr<Y> +int +test01() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a(new A); + std::auto_ptr<B> b(new B); + a = b; + VERIFY( a.get() != 0 ); + VERIFY( b.get() == 0 ); + VERIFY( A::ctor_count == 2 ); + VERIFY( A::dtor_count == 1 ); + VERIFY( B::ctor_count == 1 ); + VERIFY( B::dtor_count == 0 ); + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc new file mode 100644 index 00000000000..79bb73f1a79 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_neg.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; +struct B { }; + +// 20.6.6.2.3 shared_ptr assignment [util.smartptr.shared.assign] + +// Assignment from incompatible auto_ptr<Y> +int +test01() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a; + std::auto_ptr<B> b; + a = b; // { dg-error "here" } + + return 0; +} + +int +main() +{ + test01(); + return 0; +} +// { dg-excess-errors "In constructor" } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue_neg.cc new file mode 100644 index 00000000000..afa284931b5 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/auto_ptr_rvalue_neg.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; +std::auto_ptr<A> source() { return std::auto_ptr<A>(); } + +// 20.6.6.2.3 shared_ptr assignment [util.smartptr.shared.assign] + +// Assignment from rvalue auto_ptr +int +test01() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a; + a = source(); // { dg-error "no match" } + + return 0; +} + +int +main() +{ + test01(); + return 0; +} +// { dg-excess-errors "candidates are" } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/dr541.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/dr541.cc new file mode 100644 index 00000000000..86f648d263a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/dr541.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> + +// DR 541. shared_ptr template assignment and void +void test01() +{ + std::shared_ptr<void> p; + p.operator=<void>(p); +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/move.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/move.cc new file mode 100644 index 00000000000..34c9f8dc935 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/move.cc @@ -0,0 +1,119 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <utility> +#include <testsuite_hooks.h> + +struct A +{ + A() { ++ctor_count; } + virtual ~A() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long A::ctor_count = 0; +long A::dtor_count = 0; + +struct B : A +{ + B() { ++ctor_count; } + virtual ~B() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long B::ctor_count = 0; +long B::dtor_count = 0; + +struct reset_count_struct +{ + ~reset_count_struct() + { + A::ctor_count = 0; + A::dtor_count = 0; + B::ctor_count = 0; + B::dtor_count = 0; + } +}; + + +// 20.6.6.2.1 shared_ptr constructors [util.smartptr.shared.const] + +// Rvalue assignment from shared_ptr +void +test01() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a1; + std::shared_ptr<A> a2(new A); + + a1 = std::move(a2); + VERIFY( a1.get() != 0 ); + VERIFY( a2.get() == 0 ); + VERIFY( a1.use_count() == 1 ); + VERIFY( a2.use_count() == 0 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + + a1 = std::move(std::shared_ptr<A>()); + VERIFY( a1.get() == 0 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 1 ); +} + +// Rvalue assignment from shared_ptr<Y> +void +test02() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a; + std::shared_ptr<B> b(new B); + + a = std::move(b); + VERIFY( a.get() != 0 ); + VERIFY( b.get() == 0 ); + VERIFY( a.use_count() == 1 ); + VERIFY( b.use_count() == 0 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 1 ); + VERIFY( B::dtor_count == 0 ); + + a = std::move(std::shared_ptr<A>()); + VERIFY( a.get() == 0 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 1 ); + VERIFY( B::ctor_count == 1 ); + VERIFY( B::dtor_count == 1 ); +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr.cc new file mode 100644 index 00000000000..983c70e4bfc --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr.cc @@ -0,0 +1,97 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A +{ + A() { ++ctor_count; } + virtual ~A() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long A::ctor_count = 0; +long A::dtor_count = 0; + +struct B : A +{ + B() { ++ctor_count; } + virtual ~B() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long B::ctor_count = 0; +long B::dtor_count = 0; + + +struct reset_count_struct +{ + ~reset_count_struct() + { + A::ctor_count = 0; + A::dtor_count = 0; + B::ctor_count = 0; + B::dtor_count = 0; + } +}; + + +// 20.6.6.2.3 shared_ptr assignment [util.smartptr.shared.assign] + +// Assignment from shared_ptr<Y> +void +test01() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a; + + a = std::shared_ptr<A>(); + VERIFY( a.get() == 0 ); + VERIFY( A::ctor_count == 0 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 0 ); + VERIFY( B::dtor_count == 0 ); + + a = std::shared_ptr<A>(new A); + VERIFY( a.get() != 0 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 0 ); + VERIFY( B::dtor_count == 0 ); + + a = std::shared_ptr<B>(new B); + VERIFY( a.get() != 0 ); + VERIFY( A::ctor_count == 2 ); + VERIFY( A::dtor_count == 1 ); + VERIFY( B::ctor_count == 1 ); + VERIFY( B::dtor_count == 0 ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc new file mode 100644 index 00000000000..ab272d8c62f --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/shared_ptr_neg.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; +struct B { }; + +// 20.6.6.2.3 shared_ptr assignment [util.smartptr.shared.assign] + +// Assignment from incompatible shared_ptr<Y> +int +test01() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a; + std::shared_ptr<B> b; + a = b; // { dg-error "here" } + + return 0; +} + +int +main() +{ + test01(); + return 0; +} +// { dg-error "In member function" "" { target *-*-* } 0 } +// { dg-error "cannot convert" "" { target *-*-* } 0 } +// { dg-error "instantiated from" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/casts/1.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/casts/1.cc new file mode 100644 index 00000000000..58ebded5ca7 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/casts/1.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2.10 shared_ptr casts [util.smartptr.shared.cast] + +#include <memory> +#include <testsuite_tr1.h> + +// { dg-do compile } + +struct MyP { virtual ~MyP() { }; }; +struct MyDP : MyP { }; + +int main() +{ + using __gnu_test::check_ret_type; + using std::shared_ptr; + using std::static_pointer_cast; + using std::const_pointer_cast; + using std::dynamic_pointer_cast; + + shared_ptr<double> spd; + shared_ptr<const int> spci; + shared_ptr<MyP> spa; + + check_ret_type<shared_ptr<void> >(static_pointer_cast<void>(spd)); + check_ret_type<shared_ptr<int> >(const_pointer_cast<int>(spci)); + check_ret_type<shared_ptr<MyDP> >(static_pointer_cast<MyDP>(spa)); +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/cmp.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/cmp.cc new file mode 100644 index 00000000000..55041f8ee81 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/comparison/cmp.cc @@ -0,0 +1,85 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A +{ + virtual ~A() { } +}; + +struct B : A +{ +}; + +// 20.6.6.2.6 shared_ptr comparison [util.smartptr.shared.cmp] + +int +test01() +{ + // test empty shared_ptrs compare equivalent + std::shared_ptr<A> p1; + std::shared_ptr<B> p2; + VERIFY( p1 == p2 ); + VERIFY( !(p1 != p2) ); + VERIFY( !(p1 < p2) && !(p2 < p1) ); + return 0; +} + + +// Construction from pointer +int +test02() +{ + std::shared_ptr<A> A_default; + + std::shared_ptr<A> A_from_A(new A); + VERIFY( A_default != A_from_A ); + VERIFY( !(A_default == A_from_A) ); + VERIFY( (A_default < A_from_A) || (A_from_A < A_default) ); + + std::shared_ptr<B> B_from_B(new B); + VERIFY( B_from_B != A_from_A ); + VERIFY( !(B_from_B == A_from_A) ); + VERIFY( (B_from_B < A_from_A) || (A_from_A < B_from_B) ); + + A_from_A.reset(); + VERIFY( A_default == A_from_A ); + VERIFY( !(A_default != A_from_A) ); + VERIFY( !(A_default < A_from_A) && !(A_from_A < A_default) ); + + B_from_B.reset(); + VERIFY( B_from_B == A_from_A ); + VERIFY( !(B_from_B != A_from_A) ); + VERIFY( !(B_from_B < A_from_A) && !(A_from_A < B_from_B) ); + + return 0; +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/alias.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/alias.cc new file mode 100644 index 00000000000..a707740c9ec --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/alias.cc @@ -0,0 +1,108 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A +{ + A() : i() { } + virtual ~A() { } + int i; +}; + +struct B : A +{ + B() : A(), a() { } + virtual ~B() { } + A a; +}; + +void deletefunc(A* p) { delete p; } + +// 20.6.6.2.1 shared_ptr constructors [util.smartptr.shared.const] + +// Aliasing constructors + +int test01() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a; + std::shared_ptr<bool> b1(a, &test); + VERIFY( b1.use_count() == 0 ); + VERIFY( a.get() == 0 ); + VERIFY( b1.get() == &test ); + + std::shared_ptr<bool> b2(b1); + VERIFY( b2.use_count() == 0 ); + VERIFY( b1.get() == b2.get() ); + + return 0; +} + +int +test02() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a(new A); + std::shared_ptr<int> i1(a, &a->i); + VERIFY( i1.use_count() == 2 ); + + std::shared_ptr<int> i2(i1); + VERIFY( i2.use_count() == 3 ); + VERIFY( i2.get() == &a->i ); + + return 0; +} + +int +test03() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<B> b(new B); + std::shared_ptr<A> a1(b, b.get()); + std::shared_ptr<A> a2(b, &b->a); + VERIFY( a2.use_count() == 3 ); + VERIFY( a1 == b ); + VERIFY( a2 != b ); + VERIFY( a1.get() != a2.get() ); + + std::shared_ptr<A> a3(a1); + VERIFY( a3 == b ); + + a3 = a2; + VERIFY( a3.get() == &b->a ); + + return 0; +} + +int +main() +{ + test01(); + test02(); + test03(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/alloc.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/alloc.cc new file mode 100644 index 00000000000..10ee34b5a6b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/alloc.cc @@ -0,0 +1,104 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +using __gnu_test::tracker_allocator_counter; +using __gnu_test::tracker_allocator; + +struct A { }; +void deletefunc(A* p) { delete p; } +struct D +{ + void operator()(A* p) { delete p; ++delete_count; } + static long delete_count; +}; +long D::delete_count = 0; + +// 20.6.6.2.1 shared_ptr constructors [util.smartptr.shared.const] + +// Construction with allocator +int +test01() +{ + bool test __attribute__((unused)) = true; + tracker_allocator_counter::reset(); + + std::shared_ptr<A> p1(new A, deletefunc, tracker_allocator<A>()); + std::size_t const sz = tracker_allocator_counter::get_allocation_count(); + VERIFY( sz > 0 ); + { + std::shared_ptr<A> p2(p1); + VERIFY( p2.use_count() == 2 ); + VERIFY( tracker_allocator_counter::get_allocation_count() == sz ); + VERIFY( tracker_allocator_counter::get_deallocation_count() == 0 ); + } + VERIFY( p1.use_count() == 1 ); + VERIFY( tracker_allocator_counter::get_allocation_count() == sz ); + VERIFY( tracker_allocator_counter::get_deallocation_count() == 0 ); + p1.reset(); + VERIFY( p1.use_count() == 0 ); + VERIFY( tracker_allocator_counter::get_allocation_count() == sz ); + VERIFY( tracker_allocator_counter::get_deallocation_count() == sz ); + + return 0; +} + +// Construction with allocator +int +test02() +{ + bool test __attribute__((unused)) = true; + tracker_allocator_counter::reset(); + + std::shared_ptr<A> p1(new A, deletefunc, tracker_allocator<A>()); + std::size_t const sz1 = tracker_allocator_counter::get_allocation_count(); + VERIFY( sz1 > 0 ); + std::shared_ptr<A> p2(new A, D(), tracker_allocator<A>()); + std::size_t const sz2 = tracker_allocator_counter::get_allocation_count(); + VERIFY( sz2 > sz1 ); + VERIFY( tracker_allocator_counter::get_deallocation_count() == 0 ); + p1 = p2; + VERIFY( p2.use_count() == 2 ); + VERIFY( tracker_allocator_counter::get_allocation_count() == sz2 ); + VERIFY( tracker_allocator_counter::get_deallocation_count() == sz1 ); + p1.reset(); + VERIFY( p2.use_count() == 1 ); + VERIFY( tracker_allocator_counter::get_allocation_count() == sz2 ); + VERIFY( tracker_allocator_counter::get_deallocation_count() == sz1 ); + p2.reset(); + VERIFY( tracker_allocator_counter::get_allocation_count() == sz2 ); + VERIFY( tracker_allocator_counter::get_deallocation_count() == sz2 ); + VERIFY( D::delete_count == 1 ); + + return 0; +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc new file mode 100644 index 00000000000..b82bcfb82f6 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.1 shared_ptr constructors [util.smartptr.shared.const] + +// Construction from auto_ptr +int +test01() +{ + bool test __attribute__((unused)) = true; + + std::auto_ptr<A> a(new A); + std::shared_ptr<A> a2(a); + VERIFY( a.get() == 0 ); + VERIFY( a2.get() != 0 ); + VERIFY( a2.use_count() == 1 ); + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc new file mode 100644 index 00000000000..3f9275ac114 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/auto_ptr_neg.cc @@ -0,0 +1,49 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.3 shared_ptr assignment [util.smartptr.shared.const] + +// Construction from const auto_ptr +int +test01() +{ + bool test __attribute__((unused)) = true; + + const std::auto_ptr<A> a; + std::shared_ptr<A> p(a); // { dg-error "no match" } + + return 0; +} + +int +main() +{ + test01(); + return 0; +} +// { dg-excess-errors "candidates are" } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/copy.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/copy.cc new file mode 100644 index 00000000000..b802e4366a3 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/copy.cc @@ -0,0 +1,137 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A +{ + A() { ++ctor_count; } + virtual ~A() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long A::ctor_count = 0; +long A::dtor_count = 0; + +struct B : A +{ + B() { ++ctor_count; } + virtual ~B() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long B::ctor_count = 0; +long B::dtor_count = 0; + +void deleter(A* p) { delete p; } + +struct reset_count_struct +{ + ~reset_count_struct() + { + A::ctor_count = 0; + A::dtor_count = 0; + B::ctor_count = 0; + B::dtor_count = 0; + } +}; + +// 20.6.6.2.1 shared_ptr constructors [util.smartptr.shared.const] + +// Copy construction +int test01() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a1; + std::shared_ptr<A> a2(a1); + VERIFY( a2.use_count() == 0 ); + VERIFY( A::ctor_count == 0 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 0 ); + VERIFY( B::dtor_count == 0 ); + + return 0; +} + +int +test02() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a1(new A); + std::shared_ptr<A> a2(a1); + VERIFY( a2.use_count() == 2 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 0 ); + VERIFY( B::dtor_count == 0 ); + + return 0; +} + +int +test03() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<B> b(new B); + std::shared_ptr<A> a(b); + VERIFY( a.use_count() == 2 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 1 ); + VERIFY( B::dtor_count == 0 ); + + return 0; +} + +int +test04() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<B> b(new B, &deleter); + std::shared_ptr<A> a(b); + VERIFY( a.use_count() == 2 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 1 ); + VERIFY( B::dtor_count == 0 ); + + return 0; +} + +int +main() +{ + test01(); + test02(); + test03(); + test04(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/default.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/default.cc new file mode 100644 index 00000000000..b6c326b4035 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/default.cc @@ -0,0 +1,47 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.1 shared_ptr constructors [util.smartptr.shared.const] + +// Default construction +int +test01() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a; + VERIFY( a.get() == 0 ); + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/move.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/move.cc new file mode 100644 index 00000000000..065c2555ef6 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/move.cc @@ -0,0 +1,165 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// TR1 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <utility> +#include <testsuite_hooks.h> + +struct A +{ + A() { ++ctor_count; } + virtual ~A() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long A::ctor_count = 0; +long A::dtor_count = 0; + +struct B : A +{ + B() { ++ctor_count; } + virtual ~B() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long B::ctor_count = 0; +long B::dtor_count = 0; + +struct D +{ + void operator()(B* p) const { delete p; ++delete_count; } + static long delete_count; +}; +long D::delete_count = 0; + +struct reset_count_struct +{ + ~reset_count_struct() + { + A::ctor_count = 0; + A::dtor_count = 0; + B::ctor_count = 0; + B::dtor_count = 0; + D::delete_count = 0; + } +}; + +// 20.6.6.2.1 shared_ptr constructors [util.smartptr.shared.const] + +// Rvalue construction +int test01() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a1; + std::shared_ptr<A> a2(std::move(a1)); + VERIFY( a1.use_count() == 0 ); + VERIFY( a2.use_count() == 0 ); + VERIFY( A::ctor_count == 0 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 0 ); + VERIFY( B::dtor_count == 0 ); + + return 0; +} + +int +test02() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a1(new A); + std::shared_ptr<A> a2(std::move(a1)); + VERIFY( a1.use_count() == 0 ); + VERIFY( a2.use_count() == 1 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + + return 0; +} + +int +test03() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<B> b(new B); + std::shared_ptr<A> a(std::move(b)); + VERIFY( b.use_count() == 0 ); + VERIFY( a.use_count() == 1 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 1 ); + VERIFY( B::dtor_count == 0 ); + + return 0; +} + +int +test04() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<B> b(new B, D()); + std::shared_ptr<A> a(std::move(b)); + VERIFY( b.use_count() == 0 ); + VERIFY( a.use_count() == 1 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 1 ); + VERIFY( B::dtor_count == 0 ); + + a = std::move(std::shared_ptr<A>()); + VERIFY( D::delete_count == 1 ); + VERIFY( B::dtor_count == 1 ); + + return 0; +} + +int +test05() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a(std::move(std::shared_ptr<A>(new A))); + VERIFY( a.use_count() == 1 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + + return 0; +} + +int +main() +{ + test01(); + test02(); + test03(); + test04(); + test05(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/pointer.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/pointer.cc new file mode 100644 index 00000000000..98d17fb287a --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/pointer.cc @@ -0,0 +1,81 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; +struct B : A { }; + + +// 20.6.6.2.1 shared_ptr constructors [util.smartptr.shared.const] + +// Construction from pointer + +int +test01() +{ + bool test __attribute__((unused)) = true; + + A * const a = 0; + std::shared_ptr<A> p(a); + VERIFY( p.get() == 0 ); + VERIFY( p.use_count() == 1 ); + + return 0; +} + +int +test02() +{ + bool test __attribute__((unused)) = true; + + A * const a = new A; + std::shared_ptr<A> p(a); + VERIFY( p.get() == a ); + VERIFY( p.use_count() == 1 ); + + return 0; +} + + +int +test03() +{ + bool test __attribute__((unused)) = true; + + B * const b = new B; + std::shared_ptr<A> p(b); + VERIFY( p.get() == b ); + VERIFY( p.use_count() == 1 ); + + return 0; +} + +int +main() +{ + test01(); + test02(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr.cc new file mode 100644 index 00000000000..b56fad236f1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.1 shared_ptr constructors [util.smartptr.shared.const] + +// Construction from weak_ptr +int +test01() +{ + bool test __attribute__((unused)) = true; + + A * const a = new A; + std::shared_ptr<A> a1(a); + std::weak_ptr<A> wa(a1); + std::shared_ptr<A> a2(wa); + VERIFY( a2.get() == a ); + VERIFY( a2.use_count() == wa.use_count() ); + + return 0; +} + + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc new file mode 100644 index 00000000000..7facf9252bd --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc @@ -0,0 +1,63 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do run { xfail *-*-* } } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.1 shared_ptr constructors [util.smartptr.shared.const] + +// Construction from expired weak_ptr +int +test01() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a1(new A); + std::weak_ptr<A> wa(a1); + a1.reset(); + VERIFY( wa.expired() ); + try + { + std::shared_ptr<A> a2(wa); + } + catch (const std::bad_weak_ptr&) + { + // Expected. + __throw_exception_again; + } + catch (...) + { + // Failed. + } + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/creation/alloc.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/alloc.cc new file mode 100644 index 00000000000..90fce24c73b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/alloc.cc @@ -0,0 +1,111 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007, 2008 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +using __gnu_test::tracker_allocator_counter; +using __gnu_test::tracker_allocator; + +struct A +{ + A(int i, double d, char c = '\0') : i(i), d(d), c(c) { ++ctor_count; } + explicit A(int i) : i(i), d(), c() { ++ctor_count; } + A() : i(), d(), c() { ++ctor_count; } + ~A() { ++dtor_count; } + int i; + double d; + char c; + static int ctor_count; + static int dtor_count; +}; +int A::ctor_count = 0; +int A::dtor_count = 0; + +struct reset_count_struct +{ + ~reset_count_struct() + { + A::ctor_count = 0; + A::dtor_count = 0; + tracker_allocator_counter::reset(); + } +}; + +// 20.6.6.2.6 shared_ptr creation [util.smartptr.shared.create] + +void +test01() +{ + bool test __attribute__((unused)) = true; + reset_count_struct __attribute__((unused)) reset; + + { + std::shared_ptr<A> p1 = std::allocate_shared<A>(tracker_allocator<A>()); + VERIFY( p1.get() != 0 ); + VERIFY( p1.use_count() == 1 ); + VERIFY( A::ctor_count == 1 ); + VERIFY( tracker_allocator_counter::get_allocation_count() > 0 ); + } + VERIFY( A::ctor_count == A::dtor_count ); + VERIFY( tracker_allocator_counter::get_allocation_count() + == tracker_allocator_counter::get_deallocation_count() ); +} + +void +test02() +{ + bool test __attribute__((unused)) = true; + reset_count_struct __attribute__((unused)) reset; + + std::shared_ptr<A> p1; + + p1 = std::allocate_shared<A>(tracker_allocator<A>(), 1); + VERIFY( A::ctor_count == 1 ); + VERIFY( tracker_allocator_counter::get_allocation_count() > 0 ); + + p1 = std::allocate_shared<A>(tracker_allocator<A>(), 1, 2.0); + VERIFY( A::ctor_count == 2 ); + VERIFY( A::dtor_count == 1 ); + VERIFY( tracker_allocator_counter::get_deallocation_count() > 0 ); + + p1 = std::allocate_shared<A>(tracker_allocator<A>(), 1, 2.0, '3'); + VERIFY( A::ctor_count == 3 ); + VERIFY( A::dtor_count == 2 ); + VERIFY( p1->i == 1 ); + VERIFY( p1->d == 2.0 ); + VERIFY( p1->c == '3' ); + + p1 = std::shared_ptr<A>(); + VERIFY( A::ctor_count == A::dtor_count ); + VERIFY( tracker_allocator_counter::get_allocation_count() + == tracker_allocator_counter::get_deallocation_count() ); +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/creation/dr402.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/dr402.cc new file mode 100644 index 00000000000..b096f4ff461 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/dr402.cc @@ -0,0 +1,49 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007, 2008 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <new> +#include <testsuite_hooks.h> + +struct A +{ + void* operator new(size_t n) { return new char[sizeof(A)]; } + void operator delete(void* p, size_t) { delete (char*)p; } +}; + +// 20.6.6.2.6 shared_ptr creation [util.smartptr.shared.create] + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> p = std::make_shared<A>(); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/creation/make.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/make.cc new file mode 100644 index 00000000000..006208318da --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/creation/make.cc @@ -0,0 +1,98 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007, 2008 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A +{ + A(int i, double d, char c = '\0') : i(i), d(d), c(c) { ++ctor_count; } + explicit A(int i) : i(i), d(), c() { ++ctor_count; } + A() : i(), d(), c() { ++ctor_count; } + ~A() { ++dtor_count; } + int i; + double d; + char c; + static int ctor_count; + static int dtor_count; +}; +int A::ctor_count = 0; +int A::dtor_count = 0; + +struct reset_count_struct +{ + ~reset_count_struct() + { + A::ctor_count = 0; + A::dtor_count = 0; + } +}; + +// 20.6.6.2.6 shared_ptr creation [util.smartptr.shared.create] + +void +test01() +{ + bool test __attribute__((unused)) = true; + reset_count_struct __attribute__((unused)) reset; + + { + std::shared_ptr<A> p1 = std::make_shared<A>(); + VERIFY( p1.get() != 0 ); + VERIFY( p1.use_count() == 1 ); + VERIFY( A::ctor_count == 1 ); + } + VERIFY( A::ctor_count == A::dtor_count ); +} + +void +test02() +{ + bool test __attribute__((unused)) = true; + reset_count_struct __attribute__((unused)) reset; + + std::shared_ptr<A> p1; + + p1 = std::make_shared<A>(1); + VERIFY( A::ctor_count == 1 ); + + p1 = std::make_shared<A>(1, 2.0); + VERIFY( A::ctor_count == 2 ); + VERIFY( A::dtor_count == 1 ); + + p1 = std::make_shared<A>(1, 2.0, '3'); + VERIFY( A::ctor_count == 3 ); + VERIFY( A::dtor_count == 2 ); + VERIFY( p1->i == 1 ); + VERIFY( p1->d == 2.0 ); + VERIFY( p1->c == '3' ); + + p1 = std::shared_ptr<A>(); + VERIFY( A::ctor_count == A::dtor_count ); +} + +int +main() +{ + test01(); + test02(); +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/dest/dest.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/dest/dest.cc new file mode 100644 index 00000000000..f3e6b813016 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/dest/dest.cc @@ -0,0 +1,135 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A +{ + A() { ++ctor_count; } + ~A() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long A::ctor_count = 0; +long A::dtor_count = 0; + +struct B : A +{ + B() { ++ctor_count; } + ~B() { ++dtor_count; } + static long ctor_count; + static long dtor_count; +}; +long B::ctor_count = 0; +long B::dtor_count = 0; + +struct D +{ + void operator()(const B* p) { delete p; ++delete_count; } + static long delete_count; +}; +long D::delete_count = 0; + +struct reset_count_struct +{ + ~reset_count_struct() + { + A::ctor_count = 0; + A::dtor_count = 0; + B::ctor_count = 0; + B::dtor_count = 0; + D::delete_count = 0; + } +}; + + +// 20.6.6.2.2 shared_ptr destructor [util.smartptr.shared.dest] + +// empty shared_ptr +int +test01() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + { + std::shared_ptr<A> a; + } + VERIFY( A::ctor_count == 0 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 0 ); + VERIFY( B::dtor_count == 0 ); + VERIFY( D::delete_count == 0 ); + + return 0; +} + +// shared ownership +int +test02() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> a; + { + a = std::shared_ptr<A>(new B, D()); + } + VERIFY( A::ctor_count == 1 ); + VERIFY( A::dtor_count == 0 ); + VERIFY( B::ctor_count == 1 ); + VERIFY( B::dtor_count == 0 ); + VERIFY( D::delete_count == 0 ); + + return 0; +} + +// exclusive ownership +int +test03() +{ + reset_count_struct __attribute__((unused)) reset; + bool test __attribute__((unused)) = true; + + { + std::shared_ptr<A> a1(new B); + std::shared_ptr<A> a2(new B, D()); + } + VERIFY( A::ctor_count == 2 ); + VERIFY( A::dtor_count == 2 ); + VERIFY( B::ctor_count == 2 ); + VERIFY( B::dtor_count == 2 ); + VERIFY( D::delete_count == 1 ); + + return 0; +} + + +int +main() +{ + test01(); + test02(); + test03(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/misc/24595.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/misc/24595.cc new file mode 100644 index 00000000000..e35765638af --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/misc/24595.cc @@ -0,0 +1,41 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +using std::get_deleter; + +// libstdc++/24595 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<int> sp; + VERIFY( !get_deleter<void(*)(int*)>(sp) ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/misc/io.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/misc/io.cc new file mode 100644 index 00000000000..45d9ad808ac --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/misc/io.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <sstream> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.8 shared_ptr I/O [util.smartptr.shared.io] + +// operator<< +int +test01() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> p(new A); + std::ostringstream buf; + buf << p; + const std::string s = buf.str(); + buf.str(""); + buf << p.get(); + VERIFY( s == buf.str() ); + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/misc/swap.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/misc/swap.cc new file mode 100644 index 00000000000..f2e0468dad5 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/misc/swap.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.9 shared_ptr specialized algorithms [util.smartptr.shared.spec] + +// std::swap +int +test01() +{ + bool test __attribute__((unused)) = true; + + A * const a1 = new A; + A * const a2 = new A; + std::shared_ptr<A> p1(a1); + std::shared_ptr<A> p2(a2); + std::swap(p1, p2); + VERIFY( p1.get() == a2 ); + VERIFY( p2.get() == a1 ); + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/24805.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/24805.cc new file mode 100644 index 00000000000..b555bf58f1d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/24805.cc @@ -0,0 +1,31 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> + +// 20.6.6.2.4 shared_ptr modifiers [util.smartptr.shared.mod] + +// swap + +// libstdc++/24805 +using std::swap; diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/reset.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/reset.cc new file mode 100644 index 00000000000..c7349469bfa --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/reset.cc @@ -0,0 +1,90 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; +struct B : A { }; +struct D +{ + void operator()(B* p) { delete p; ++delete_count; } + static long delete_count; +}; +long D::delete_count = 0; + +// 20.6.6.2.4 shared_ptr modifiers [util.smartptr.shared.mod] + +// reset +int +test01() +{ + bool test __attribute__((unused)) = true; + + A * const a = new A; + std::shared_ptr<A> p1(a); + std::shared_ptr<A> p2(p1); + p1.reset(); + VERIFY( p1.get() == 0 ); + VERIFY( p2.get() == a ); + + return 0; +} + +int +test02() +{ + bool test __attribute__((unused)) = true; + + A * const a = new A; + B * const b = new B; + std::shared_ptr<A> p1(a); + std::shared_ptr<A> p2(p1); + p1.reset(b); + VERIFY( p1.get() == b ); + VERIFY( p2.get() == a ); + + return 0; +} + +int +test03() +{ + bool test __attribute__((unused)) = true; + + { + std::shared_ptr<A> p1; + p1.reset(new B, D()); + } + VERIFY( D::delete_count == 1 ); + + return 0; +} + +int +main() +{ + test01(); + test02(); + test03(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/reset_alloc.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/reset_alloc.cc new file mode 100644 index 00000000000..04d90519383 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/reset_alloc.cc @@ -0,0 +1,64 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> +#include <testsuite_allocator.h> + +using __gnu_test::tracker_allocator_counter; +using __gnu_test::tracker_allocator; + +struct A { }; +struct B : A { }; +struct D +{ + void operator()(B* p) { delete p; ++delete_count; } + static long delete_count; +}; +long D::delete_count = 0; + +// 20.6.6.2.4 shared_ptr modifiers [util.smartptr.shared.mod] + +// Reset with allocator +int +test01() +{ + bool test __attribute__((unused)) = true; + tracker_allocator_counter::reset(); + + { + std::shared_ptr<A> p1; + p1.reset(new B, D(), tracker_allocator<B>()); + VERIFY( tracker_allocator_counter::get_allocation_count() > 0 ); + } + VERIFY( D::delete_count == 1 ); + VERIFY( tracker_allocator_counter::get_allocation_count() == tracker_allocator_counter::get_deallocation_count() ); + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/reset_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/reset_neg.cc new file mode 100644 index 00000000000..16773539879 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/reset_neg.cc @@ -0,0 +1,48 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.4 shared_ptr modifiers [util.smartptr.shared.mod] + +// reset +int +test01() +{ + bool test __attribute__((unused)) = true; + + const std::shared_ptr<A> p1(new A); + p1.reset(); // { dg-error "discards qualifiers" } + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/swap.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/swap.cc new file mode 100644 index 00000000000..5c18e65a55e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/swap.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.4 shared_ptr modifiers [util.smartptr.shared.mod] + +// swap +int +test01() +{ + bool test __attribute__((unused)) = true; + + A * const a1 = new A; + A * const a2 = new A; + std::shared_ptr<A> p1(a1); + std::shared_ptr<A> p2(a2); + p1.swap(p2); + VERIFY( p1.get() == a2 ); + VERIFY( p2.get() == a1 ); + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/swap_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/swap_neg.cc new file mode 100644 index 00000000000..995cfc0b40c --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/modifiers/swap_neg.cc @@ -0,0 +1,49 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.4 shared_ptr modifiers [util.smartptr.shared.mod] + +// swap +int +test01() +{ + bool test __attribute__((unused)) = true; + + const std::shared_ptr<A> p1(new A); + std::shared_ptr<A> p2(new A); + p1.swap(p2); // { dg-error "discards qualifiers" } + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/observers/bool_conv.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/observers/bool_conv.cc new file mode 100644 index 00000000000..9efe26fc28c --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/observers/bool_conv.cc @@ -0,0 +1,82 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.5 shared_ptr observers [util.smartptr.shared.obs] + +// conversion to bool +int +test01() +{ + bool test __attribute__((unused)) = true; + + const std::shared_ptr<A> p1; + VERIFY( p1 == false ); + const std::shared_ptr<A> p2(p1); + VERIFY( p2 == false ); + + return 0; +} + +int +test02() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> p1(new A); + VERIFY( p1 ); + std::shared_ptr<A> p2(p1); + VERIFY( p2 ); + p1.reset(); + VERIFY( !p1 ); + VERIFY( p2 ); + + return 0; +} + +int +test03() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> p1(new A); + std::shared_ptr<A> p2(p1); + p2.reset(new A); + VERIFY( p1 ); + VERIFY( p2 ); + + return 0; +} + + +int +main() +{ + test01(); + test02(); + test03(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/observers/get.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/observers/get.cc new file mode 100644 index 00000000000..c64ed38fc70 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/observers/get.cc @@ -0,0 +1,82 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A +{ + A() : i() {} + int i; +}; + +// 20.6.6.2.5 shared_ptr observers [util.smartptr.shared.obs] + +// get +int +test01() +{ + bool test __attribute__((unused)) = true; + + A * const a = new A; + const std::shared_ptr<A> p(a); + VERIFY( p.get() == a ); + + return 0; +} + +// operator* +int +test02() +{ + bool test __attribute__((unused)) = true; + + A * const a = new A; + const std::shared_ptr<A> p(a); + VERIFY( &*p == a ); + + return 0; +} + + +// operator-> +int +test03() +{ + bool test __attribute__((unused)) = true; + + A * const a = new A; + const std::shared_ptr<A> p(a); + VERIFY( &p->i == &a->i ); + + return 0; +} + + +int +main() +{ + test01(); + test02(); + test03(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/observers/unique.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/observers/unique.cc new file mode 100644 index 00000000000..de7ab15a7b0 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/observers/unique.cc @@ -0,0 +1,82 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; + +// 20.6.6.2.5 shared_ptr observers [util.smartptr.shared.obs] + +// unique +int +test01() +{ + bool test __attribute__((unused)) = true; + + const std::shared_ptr<A> p1; + VERIFY( !p1.unique() ); + const std::shared_ptr<A> p2(p1); + VERIFY( !p1.unique() ); + + return 0; +} + +int +test02() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> p1(new A); + VERIFY( p1.unique() ); + std::shared_ptr<A> p2(p1); + VERIFY( !p1.unique() ); + p1.reset(); + VERIFY( !p1.unique() ); + VERIFY( p2.unique() ); + + return 0; +} + +int +test03() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> p1(new A); + std::shared_ptr<A> p2(p1); + p2.reset(new A); + VERIFY( p1.unique() ); + VERIFY( p2.unique() ); + + return 0; +} + + +int +main() +{ + test01(); + test02(); + test03(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/observers/use_count.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/observers/use_count.cc new file mode 100644 index 00000000000..8e074a8b888 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/observers/use_count.cc @@ -0,0 +1,81 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_hooks.h> + +struct A { }; +struct B : A { }; + +// 20.6.6.2.5 shared_ptr observers [util.smartptr.shared.obs] + +// use_count +int +test01() +{ + bool test __attribute__((unused)) = true; + + const std::shared_ptr<A> p1; + VERIFY( p1.use_count() == 0 ); + const std::shared_ptr<A> p2(p1); + VERIFY( p1.use_count() == 0 ); + + return 0; +} + +int +test02() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> p1(new A); + std::shared_ptr<A> p2(p1); + p1.reset(); + VERIFY( p1.use_count() == 0 ); + VERIFY( p2.use_count() == 1 ); + + return 0; +} + +int +test03() +{ + bool test __attribute__((unused)) = true; + + std::shared_ptr<A> p1(new A); + std::shared_ptr<A> p2(p1); + p2.reset(new B); + VERIFY( p1.use_count() == 1 ); + VERIFY( p2.use_count() == 1 ); + + return 0; +} + + +int +main() +{ + test01(); + test02(); + test03(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation.cc deleted file mode 100644 index 7e54a738fe4..00000000000 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation.cc +++ /dev/null @@ -1,24 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// { dg-do compile } - -// Copyright (C) 2007 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, 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 COPYING. If not, write to -// the Free Software Foundation, 51 Franklin Street, Fifth Floor, -// Boston, MA 02110-1301, USA. - -#include <memory> - -template class std::shared_ptr<int>; diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc new file mode 100644 index 00000000000..880c38ab893 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/1.cc @@ -0,0 +1,32 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_tr1.h> + +using namespace __gnu_test; +using std::shared_ptr; +template class shared_ptr<int>; +template class shared_ptr<void>; +template class shared_ptr<ClassType>; +template class shared_ptr<IncompleteClass>; diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..293f54881c4 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/requirements/explicit_instantiation/2.cc @@ -0,0 +1,35 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_tr1.h> + +// Check the _S_single lock policy can be instantiated. For a thread-enabled +// library this checks the templates can be instantiated for non-default +// lock policy, for a single-threaded lib this is redundant but harmless. +using namespace __gnu_test; +using std::__shared_ptr; +using std::_S_single; +template class __shared_ptr<int, _S_single>; +template class __shared_ptr<ClassType, _S_single>; +template class __shared_ptr<IncompleteClass, _S_single>; diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc new file mode 100644 index 00000000000..5bdd65c2700 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc @@ -0,0 +1,195 @@ +// Copyright (C) 2006, 2007, 2008 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } } +// { dg-options "-pthread -std=gnu++0x" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } } +// { dg-options "-pthreads -std=gnu++0x" { target *-*-solaris* } } +// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } + +#include <memory> +#include <random> +#include <vector> +#include <testsuite_hooks.h> +#include <iostream> +#include <cstdlib> + +#include <pthread.h> + +#ifdef _GLIBCXX_HAVE_UNISTD_H +#include <unistd.h> // To test for _POSIX_THREAD_PRIORITY_SCHEDULING +#endif + +/* This (brute-force) tests the atomicity and thus thread safety of the + * shared_ptr <- weak_ptr + * assignment operation by allocating a test object, retrieving a weak + * reference to it, and letting a number of threads repeatedly create strong + * references from the weak reference. + * Specifically, this tests the function _Sp_counted_base<true>::add_ref_lock() + */ + + +const unsigned int HAMMER_MAX_THREADS = 10; +const unsigned int POOL_SIZE = 1000; +const unsigned long HAMMER_REPEAT = 100000; +const unsigned long KILL_ONE_IN = 1000; + +struct A + { + static _Atomic_word counter; + A() + { + __gnu_cxx::__atomic_add(&counter, 1); + } + ~A() + { + __gnu_cxx::__atomic_add(&counter, -1); + } + }; + +_Atomic_word A::counter = 0; + +typedef std::shared_ptr<A> sp_A_t; +typedef std::weak_ptr<A> wp_A_t; + +typedef std::vector<sp_A_t> sp_vector_t; +typedef std::vector<wp_A_t> wp_vector_t; + +struct shared_and_weak_pools +{ + sp_vector_t& shared_pool; + wp_vector_t& weak_pool; + + shared_and_weak_pools(sp_vector_t& _shared_pool, wp_vector_t& _weak_pool) + : shared_pool(_shared_pool), weak_pool(_weak_pool) + { } +}; + +void* thread_hammer_and_kill(void* opaque_pools) +{ + shared_and_weak_pools& pools = *static_cast<shared_and_weak_pools*>(opaque_pools); + // Using the same parameters as in the RNG test cases. + std::mersenne_twister< + unsigned long, 32, 624, 397, 31, + 0x9908b0dful, 11, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18> rng; + + sp_vector_t::iterator cur_shared = pools.shared_pool.begin(); + wp_vector_t::iterator cur_weak = pools.weak_pool.begin(); + + for (unsigned int i = 0; i < HAMMER_REPEAT; ++i) + { + try + { + sp_A_t strong(*cur_weak); + } + catch (std::bad_weak_ptr& exception) + { + ++cur_weak; + if (cur_weak == pools.weak_pool.end()) + break; + } + + if (rng() % KILL_ONE_IN == 0) + { + cur_shared->reset(); + ++cur_shared; + } + } + return 0; +} + +void* thread_hammer(void* opaque_weak) +{ + wp_vector_t& weak_pool = *static_cast<wp_vector_t*>(opaque_weak); + // Using the same parameters as in the RNG test cases. + std::mersenne_twister< + unsigned long, 32, 624, 397, 31, + 0x9908b0dful, 11, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18> rng; + wp_vector_t::iterator cur_weak = weak_pool.begin(); + + for (unsigned int i = 0; i < HAMMER_REPEAT; ++i) + { + try + { + sp_A_t strong(*cur_weak); + } + catch (std::bad_weak_ptr& exception) + { + ++cur_weak; + if (cur_weak == weak_pool.end()) + break; + } + } + return 0; +} + +int +test01() +{ + bool test __attribute__((unused)) = true; + sp_vector_t obj_pool(POOL_SIZE); + + for(sp_vector_t::iterator cur = obj_pool.begin(); cur != obj_pool.end(); ++cur) + { + cur->reset(new A); + } + // Obtain weak references. + std::vector<wp_vector_t> weak_pool(HAMMER_MAX_THREADS, wp_vector_t(obj_pool.begin(), obj_pool.end())); + + // Launch threads with pointer to weak reference. + pthread_t threads[HAMMER_MAX_THREADS]; +#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500 + pthread_setconcurrency (HAMMER_MAX_THREADS); +#endif + + pthread_attr_t tattr; + pthread_attr_init(&tattr); + + shared_and_weak_pools pools(obj_pool, weak_pool[0]); + pthread_create(threads, &tattr, thread_hammer_and_kill, static_cast<void*>(&pools)); + for (unsigned int worker = 1; worker < HAMMER_MAX_THREADS; worker++) + { + if (pthread_create(&threads[worker], &tattr, + thread_hammer, static_cast<void*>(&weak_pool[worker]))) + std::abort(); + } + // Wait for threads to complete, then check integrity of reference. + void* status; + for (unsigned int worker = 0; worker < HAMMER_MAX_THREADS; worker++) + { + if (pthread_join(threads[worker], &status)) + std::abort(); + } + obj_pool.clear(); + + VERIFY( A::counter == 0 ); + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc new file mode 100644 index 00000000000..20c2da146e0 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc @@ -0,0 +1,197 @@ +// Copyright (C) 2006, 2007, 2008 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } } +// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } } +// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } +// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } + +#include <memory> +#include <random> +#include <vector> +#include <testsuite_hooks.h> +#include <iostream> +#include <cstdlib> + +#include <pthread.h> + +#ifdef _GLIBCXX_HAVE_UNISTD_H +#include <unistd.h> // To test for _POSIX_THREAD_PRIORITY_SCHEDULING +#endif + +/* This (brute-force) tests the atomicity and thus thread safety of the + * shared_ptr <- weak_ptr + * assignment operation by allocating a test object, retrieving a weak + * reference to it, and letting a number of threads repeatedly create strong + * references from the weak reference. + * Specifically, this tests the function _Sp_counted_base<true>::add_ref_lock() + */ + + +const unsigned int HAMMER_MAX_THREADS = 10; +const unsigned int POOL_SIZE = 1000; +const unsigned long HAMMER_REPEAT = 100000; +const unsigned long KILL_ONE_IN = 1000; + +struct A + { + static _Atomic_word counter; + A() + { + __gnu_cxx::__atomic_add(&counter, 1); + } + ~A() + { + __gnu_cxx::__atomic_add(&counter, -1); + } + }; + +_Atomic_word A::counter = 0; + +using std::_S_mutex; + +typedef std::__shared_ptr<A, _S_mutex> sp_A_t; +typedef std::__weak_ptr<A, _S_mutex> wp_A_t; + +typedef std::vector<sp_A_t> sp_vector_t; +typedef std::vector<wp_A_t> wp_vector_t; + +struct shared_and_weak_pools +{ + sp_vector_t& shared_pool; + wp_vector_t& weak_pool; + + shared_and_weak_pools(sp_vector_t& _shared_pool, wp_vector_t& _weak_pool) + : shared_pool(_shared_pool), weak_pool(_weak_pool) + { } +}; + +void* thread_hammer_and_kill(void* opaque_pools) +{ + shared_and_weak_pools& pools = *static_cast<shared_and_weak_pools*>(opaque_pools); + // Using the same parameters as in the RNG test cases. + std::mersenne_twister< + unsigned long, 32, 624, 397, 31, + 0x9908b0dful, 11, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18> rng; + + sp_vector_t::iterator cur_shared = pools.shared_pool.begin(); + wp_vector_t::iterator cur_weak = pools.weak_pool.begin(); + + for (unsigned int i = 0; i < HAMMER_REPEAT; ++i) + { + try + { + sp_A_t strong(*cur_weak); + } + catch (std::bad_weak_ptr& exception) + { + ++cur_weak; + if (cur_weak == pools.weak_pool.end()) + break; + } + + if (rng() % KILL_ONE_IN == 0) + { + cur_shared->reset(); + ++cur_shared; + } + } + return 0; +} + +void* thread_hammer(void* opaque_weak) +{ + wp_vector_t& weak_pool = *static_cast<wp_vector_t*>(opaque_weak); + // Using the same parameters as in the RNG test cases. + std::mersenne_twister< + unsigned long, 32, 624, 397, 31, + 0x9908b0dful, 11, 7, + 0x9d2c5680ul, 15, + 0xefc60000ul, 18> rng; + wp_vector_t::iterator cur_weak = weak_pool.begin(); + + for (unsigned int i = 0; i < HAMMER_REPEAT; ++i) + { + try + { + sp_A_t strong(*cur_weak); + } + catch (std::bad_weak_ptr& exception) + { + ++cur_weak; + if (cur_weak == weak_pool.end()) + break; + } + } + return 0; +} + +int +test01() +{ + bool test __attribute__((unused)) = true; + sp_vector_t obj_pool(POOL_SIZE); + + for(sp_vector_t::iterator cur = obj_pool.begin(); cur != obj_pool.end(); ++cur) + { + cur->reset(new A); + } + // Obtain weak references. + std::vector<wp_vector_t> weak_pool(HAMMER_MAX_THREADS, wp_vector_t(obj_pool.begin(), obj_pool.end())); + + // Launch threads with pointer to weak reference. + pthread_t threads[HAMMER_MAX_THREADS]; +#if defined(__sun) && defined(__svr4__) && _XOPEN_VERSION >= 500 + pthread_setconcurrency (HAMMER_MAX_THREADS); +#endif + + pthread_attr_t tattr; + pthread_attr_init(&tattr); + + shared_and_weak_pools pools(obj_pool, weak_pool[0]); + pthread_create(threads, &tattr, thread_hammer_and_kill, static_cast<void*>(&pools)); + for (unsigned int worker = 1; worker < HAMMER_MAX_THREADS; worker++) + { + if (pthread_create(&threads[worker], &tattr, + thread_hammer, static_cast<void*>(&weak_pool[worker]))) + std::abort(); + } + // Wait for threads to complete, then check integrity of reference. + void* status; + for (unsigned int worker = 0; worker < HAMMER_MAX_THREADS; worker++) + { + if (pthread_join(threads[worker], &status)) + std::abort(); + } + obj_pool.clear(); + + VERIFY( A::counter == 0 ); + + return 0; +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/move_iterators/1.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/move_iterators/1.cc new file mode 100644 index 00000000000..11e07a76aea --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_copy/move_iterators/1.cc @@ -0,0 +1,67 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#undef _GLIBCXX_CONCEPT_CHECKS +#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + +#include <algorithm> +#include <iterator> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::input_iterator_wrapper; +using __gnu_test::forward_iterator_wrapper; +using __gnu_test::rvalstruct; +using std::uninitialized_copy; + +typedef test_container<rvalstruct, input_iterator_wrapper> container_in; +typedef test_container<rvalstruct, forward_iterator_wrapper> container_out; + +void test01() +{ + bool test __attribute__((unused)) = true; + + int inarray[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + const int size = sizeof(inarray) / sizeof(int); + + rvalstruct in[size], out[size]; + std::copy(inarray, inarray + size, in); + + container_in incon(in, in + size); + container_out outcon(out, out + size); + + uninitialized_copy(std::move_iterator<input_iterator_wrapper<rvalstruct> >(incon.begin()), + std::move_iterator<input_iterator_wrapper<rvalstruct> >(incon.end()), + outcon.begin()); + VERIFY( std::equal(out, out + size, inarray) ); + for (int z = 0; z < size; ++z) + VERIFY( out[z].valid ); + for (int z = 0; z < size; ++z) + VERIFY( !in[z].valid ); +} + + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/32158.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/32158.cc index 1f9867e01b2..1f9867e01b2 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/32158.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill/32158.cc diff --git a/libstdc++-v3/testsuite/20_util/specialized_algorithms/16505.cc b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill_n/16505.cc index b20c0496ee8..b20c0496ee8 100644 --- a/libstdc++-v3/testsuite/20_util/specialized_algorithms/16505.cc +++ b/libstdc++-v3/testsuite/20_util/specialized_algorithms/uninitialized_fill_n/16505.cc diff --git a/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/comparisons.cc b/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/comparisons.cc new file mode 100644 index 00000000000..847785cb02b --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/comparison_operators/comparisons.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +bool test __attribute__((unused)) = true; + +#define TEST1(x) VERIFY( x == x && !(x != x) && x <= x && !(x < x) ) + +int +main() +{ + int i=0; + int j=0; + int k=2; + tuple<int, int, int> a(0, 0, 0); + tuple<int, int, int> b(0, 0, 1); + tuple<int& , int& , int&> c(i,j,k); + tuple<const int&, const int&, const int&> d(c); + TEST1(a); + TEST1(b); + TEST1(c); + TEST1(d); + VERIFY(!(a > a) && !(b > b)); + VERIFY(a >= a && b >= b); + VERIFY(a < b && !(b < a) && a <= b && !(b <= a)); + VERIFY(b > a && !(a > b) && b >= a && !(a >= b)); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/assignment.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/assignment.cc new file mode 100644 index 00000000000..86defaccf16 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/assignment.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + tuple<> ta; + tuple<> tb; + ta = tb; + + tuple<int> tc(1); + tuple<int> td(0); + td = tc; + VERIFY(get<0>(td) == 1); + + int i=0; + tuple<int&> te(i); + te = tc; + VERIFY(i == 1); + + tuple<const int&> tf(tc); + + get<0>(tc) = 2; + VERIFY(get<0>(tf) == 2); + tuple<double> tg; + tg = tc; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/big_tuples.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/big_tuples.cc new file mode 100644 index 00000000000..0c60ec9ddef --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/big_tuples.cc @@ -0,0 +1,105 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +// A simple class without conversions to check some things +struct foo +{ }; + +void +test_constructors() +{ + bool test __attribute__((unused)) = true; + + int x1=0,x2=0; + const int &z1=x1; + + // Test empty constructor + tuple<> ta __attribute__((unused)); + tuple<int,int> tb; + // Test construction from values + tuple<int,int> tc(x1,x2); + tuple<int,int&> td(x1,x2); + tuple<const int&> te(z1); + x1=1; + x2=1; + VERIFY(get<0>(td) == 0 && get<1>(td) == 1 && get<0>(te) == 1); + + // Test identical tuple copy constructor + tuple<int,int> tf(tc); + tuple<int,int> tg(td); + tuple<const int&> th(te); + // Test different tuple copy constructor + tuple<int,double> ti(tc); + tuple<int,double> tj(td); + // Test constructing from a pair + pair<int,int> pair1(1,1); + const pair<int,int> pair2(pair1); + tuple<int,int> tl(pair1); + tuple<int,const int&> tm(pair1); + tuple<int,int> tn(pair2); + tuple<int,const int&> to(pair2); +} + +int +main(void) +{ + //test construction + typedef tuple<int,int,int,int,int,int,int,int,int,int> type1; + type1 a(0, 0, 0, 0, 0, 0, 0, 0, 0, 1); + type1 b(0, 0, 0, 0, 0, 0, 0, 0, 0, 2); + type1 c(a); + typedef tuple<int,int,int,int,int,int,int,int,int,char> type2; + type2 d(0, 0, 0, 0, 0, 0, 0, 0, 0, 3); + type1 e(d); + typedef tuple<foo,int,int,int,int,int,int,int,int,foo> type3; + // get + VERIFY(get<9>(a)==1 && get<9>(b)==2); + // comparisons + VERIFY(a==a && !(a!=a) && a<=a && a>=a && !(a<a) && !(a>a)); + VERIFY(!(a==b) && a!=b && a<=b && a<b && !(a>=b) && !(a>b)); + //tie + { + int i = 0; + tie(ignore, ignore, ignore, ignore, ignore, ignore, ignore, ignore, + ignore, i) = a; + VERIFY(i == 1); + } + //test_assignment + a=d; + a=b; + //make_tuple + make_tuple(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + //tuple_size + VERIFY(tuple_size<type3>::value == 10); + //tuple_element + { + foo q1; + tuple_element<0,type3>::type q2(q1); + tuple_element<9,type3>::type q3(q1); + } +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/constructor.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/constructor.cc new file mode 100644 index 00000000000..105727d7983 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/constructor.cc @@ -0,0 +1,65 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007, 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + int x1=0,x2=0; + const int &z1=x1; + + // Test empty constructor + tuple<> ta __attribute__((unused)); + tuple<int,int> tb; + // Test construction from values + tuple<int,int> tc(x1,x2); + tuple<int,int&> td(x1,x2); + tuple<const int&> te(z1); + x1=1; + x2=1; + VERIFY(get<0>(td) == 0 && get<1>(td) == 1 && get<0>(te) == 1); + + // Test identical tuple copy constructor + tuple<int,int> tf(tc); + tuple<int,int> tg(td); + tuple<const int&> th(te); + // Test different tuple copy constructor + tuple<int,double> ti(tc); + tuple<int,double> tj(td); + //tuple<int&, int&> tk(tc); + tuple<const int&, const int&> tl(tc); + tuple<const int&, const int&> tm(tl); + // Test constructing from a pair + pair<int,int> pair1(1,1); + const pair<int,int> pair2(pair1); + tuple<int,int> tn(pair1); + tuple<int,const int&> to(pair1); + tuple<int,int> tp(pair2); + tuple<int,const int&> tq(pair2); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/23978.cc b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/23978.cc new file mode 100644 index 00000000000..edb4aef61b0 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/23978.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <utility> +#include <testsuite_hooks.h> + +using namespace std; + +// libstdc++/23978 +void test01() +{ + bool test __attribute__((unused)) = true; + + pair<int, int> p(1, 2); + int x = 0; + int y = 0; + tie(x, y) = p; + VERIFY( x == 1 && y == 2 ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/make_tuple.cc b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/make_tuple.cc new file mode 100644 index 00000000000..a6eba6d4154 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/make_tuple.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <functional> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + int i=0; + make_tuple(1,2,4.0); + make_tuple(ref(i)) = tuple<int>(1); + VERIFY(i == 1); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tie.cc b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tie.cc new file mode 100644 index 00000000000..e7f5c056e4e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tie.cc @@ -0,0 +1,43 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + int x1 = 0; + int x2 = 0; + int y1 = 0; + int y2 = 0; + tuple<int,int> ta(1,1); + tuple<const int&,const int&> tc(x1,x2); + tie(y1,y2)=ta; + VERIFY(y1 == 1 && y2 == 1); + tie(y1,y2)=tc; + VERIFY(y1 == 0 && y2 == 0); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tie2.cc b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tie2.cc new file mode 100644 index 00000000000..c0b52f57a00 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/creation_functions/tie2.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <string> +#include <testsuite_hooks.h> + +int +main() +{ + bool test __attribute__((unused)) = true; + using namespace std; + + int i; + string s; + + tie(i, ignore, s) = make_tuple(42, 3.14, "C++"); + VERIFY( i == 42 ); + VERIFY( s == "C++" ); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/element_access/get.cc b/libstdc++-v3/testsuite/20_util/tuple/element_access/get.cc new file mode 100644 index 00000000000..32015ee7da6 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/element_access/get.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + int j=1; + const int k=2; + tuple<int,int &,const int&> a(0,j,k); + const tuple<int,int &,const int&> b(1,j,k); + VERIFY(get<0>(a)==0 && get<1>(a)==1 && get<2>(a)==2); + get<0>(a)=3; + get<1>(a)=4; + VERIFY(get<0>(a)==3 && get<1>(a)==4); + VERIFY(j==4); + get<1>(b)=5; + VERIFY(get<0>(b)==1 && get<1>(b)==5 && get<2>(b)==2); + VERIFY(j==5); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/moveable.cc b/libstdc++-v3/testsuite/20_util/tuple/moveable.cc new file mode 100644 index 00000000000..bd2f18ad86e --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/moveable.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on tuple. If the implementation changed +// this test may begin to fail. + +#include <tuple> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::tuple<int, double> a(1, 2.0), b; + b = std::move(a); + VERIFY( std::get<0>(b) == 1 && std::get<1>(b) == 2.0 ); + VERIFY( std::get<0>(a) == 1 && std::get<1>(a) == 2.0 ); + + std::tuple<int, double> c(std::move(b)); + VERIFY( std::get<0>(c) == 1 && std::get<1>(c) == 2.0 ); + VERIFY( std::get<0>(b) == 1 && std::get<1>(b) == 2.0 ); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/moveable2.cc b/libstdc++-v3/testsuite/20_util/tuple/moveable2.cc new file mode 100644 index 00000000000..ae7a4e2279d --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/moveable2.cc @@ -0,0 +1,73 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <tuple> +#include <utility> + +struct MoveOnly +{ + MoveOnly () { } + + MoveOnly (MoveOnly&&) { } + + MoveOnly& operator=(MoveOnly&&) + { return *this; } + +private: + MoveOnly(MoveOnly const&); // = delete + MoveOnly& operator=(MoveOnly const&); // = delete +}; + +MoveOnly +make_move_only () +{ return MoveOnly(); } + +// http://gcc.gnu.org/ml/libstdc++/2008-02/msg00046.html +void test01() +{ + typedef std::tuple<MoveOnly> move_only_tuple; + + move_only_tuple t1(make_move_only()); + move_only_tuple t2(std::move(t1)); + move_only_tuple t3 = std::move(t2); + t1 = std::move(t3); + + typedef std::tuple<MoveOnly, MoveOnly> move_only_tuple2; + + move_only_tuple2 t4(make_move_only(), make_move_only()); + move_only_tuple2 t5(std::move(t4)); + move_only_tuple2 t6 = std::move(t5); + t4 = std::move(t6); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc index 55afcc86fdb..29b886d1266 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/requirements/explicit_instantiation.cc @@ -28,6 +28,6 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#include <tr1/tuple> +#include <tuple> -template class std::tr1::tuple<short, int, double>; +template class std::tuple<short, int, double>; diff --git a/libstdc++-v3/testsuite/20_util/tuple/tuple_element.cc b/libstdc++-v3/testsuite/20_util/tuple/tuple_element.cc new file mode 100644 index 00000000000..1b78a5ca2bb --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/tuple_element.cc @@ -0,0 +1,38 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> + +using namespace std; + +struct foo +{ }; + +int +main() +{ + // As foo isn't constructible from anything else, this + // lets us check if type is returning foo when it should + foo q1; + tuple_element<0,tuple<foo,void,int> >::type q2(q1); + tuple_element<2,tuple<void,int,foo> >::type q3(q1); +} diff --git a/libstdc++-v3/testsuite/20_util/tuple/tuple_size.cc b/libstdc++-v3/testsuite/20_util/tuple/tuple_size.cc new file mode 100644 index 00000000000..f5f398ce0a1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/tuple_size.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tuple> +#include <testsuite_hooks.h> + +using namespace std; + +int +main() +{ + bool test __attribute__((unused)) = true; + + VERIFY(tuple_size<tuple<> >::value == 0); + VERIFY(tuple_size<tuple<int> >::value == 1); + VERIFY(tuple_size<tuple<void> >::value == 1); + typedef tuple<int,const int&,void> test_tuple1; + VERIFY(tuple_size<test_tuple1>::value == 3); + VERIFY(tuple_size<tuple<tuple<void> > >::value == 1); +} diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/lock/1.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/lock/1.cc new file mode 100644 index 00000000000..a6506e379ef --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/lock/1.cc @@ -0,0 +1,37 @@ +// 2006-09-24 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.3 Template class weak_ptr [util.smartptr.weak] + +#include <memory> +#include <testsuite_tr1.h> + +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +int main() +{ + using __gnu_test::check_ret_type; + using std::weak_ptr; + using std::shared_ptr; + + weak_ptr<int> wp; + check_ret_type<shared_ptr<int> >(wp.lock()); +} diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation.cc deleted file mode 100644 index 1bbfe882811..00000000000 --- a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation.cc +++ /dev/null @@ -1,24 +0,0 @@ -// { dg-options "-std=gnu++0x" } -// { dg-do compile } - -// Copyright (C) 2007 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 -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, 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 COPYING. If not, write to -// the Free Software Foundation, 51 Franklin Street, Fifth Floor, -// Boston, MA 02110-1301, USA. - -#include <memory> - -template class std::weak_ptr<int>; diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc new file mode 100644 index 00000000000..ede053bb717 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/1.cc @@ -0,0 +1,32 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2006, 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_tr1.h> + +using namespace __gnu_test; +using std::weak_ptr; +template class weak_ptr<int>; +template class weak_ptr<void>; +template class weak_ptr<ClassType>; +template class weak_ptr<IncompleteClass>; diff --git a/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..272ef4fe444 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/weak_ptr/requirements/explicit_instantiation/2.cc @@ -0,0 +1,36 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.6.6.2 Template class shared_ptr [util.smartptr.shared] + +#include <memory> +#include <testsuite_tr1.h> + +// Check the _S_single lock policy can be instantiated. For a thread-enabled +// library this checks the templates can be instantiated for non-default +// lock policy, for a single-threaded lib this is redundant but harmless. +using namespace __gnu_test; +using std::__weak_ptr; +using std::_S_single; +template class __weak_ptr<int, _S_single>; +template class __weak_ptr<void, _S_single>; +template class __weak_ptr<ClassType, _S_single>; +template class __weak_ptr<IncompleteClass, _S_single>; diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc index f67582c5f26..5f60c2ff627 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/char/28277.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation +// Copyright (C) 2006, 2007 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 @@ -39,7 +39,7 @@ void test01() oss_01 << str_01; VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == width ); + VERIFY( oss_01.str().size() == string::size_type(width) ); } int main() diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc index ff6228f1240..653f4de36db 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/inserters_extractors/wchar_t/28277.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation +// Copyright (C) 2006, 2007 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 @@ -39,7 +39,7 @@ void test01() oss_01 << str_01; VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == width ); + VERIFY( oss_01.str().size() == wstring::size_type(width) ); } int main() diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/debug.cc b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/debug.cc index 8b021755786..8a8951f2db2 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/debug.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/requirements/explicit_instantiation/debug.cc @@ -16,15 +16,6 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - // This file tests explicit instantiation of basic_string #include <debug/string> diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/typedefs.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/typedefs.cc index 333142018e4..13b70390766 100644 --- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/typedefs.cc +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/char/typedefs.cc @@ -1,5 +1,4 @@ // { dg-do compile } -// { dg-options "-ansi -pedantic-errors" } // 2001-02-11 gdr // Origin: Craig Rodrigues <rodrigc@mediaone.net> diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/short/1.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/short/1.cc index 3a0394daf1f..2e1b631f75c 100644 --- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/short/1.cc +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/short/1.cc @@ -31,6 +31,7 @@ void test02(void) { + typedef short char_type; bool test __attribute__((unused)) = true; // 21.1.1 character traits requirements @@ -45,67 +46,67 @@ void test02(void) // pos == X::pos_type // state == X::state_type - // void X::assign(short c, short d) + // void X::assign(char_type c, char_type d) // assigns c = d; - short c1 = 'z'; - short c2 = 'u'; + char_type c1 = 'z'; + char_type c2 = 'u'; VERIFY( c1 != c2 ); - std::char_traits<short>::assign(c1,c2); + std::char_traits<char_type>::assign(c1,c2); VERIFY( c1 == 'u' ); - // bool X::eq(short c, short d) + // bool X::eq(char_type c, char_type d) c1 = 'z'; c2 = 'u'; - VERIFY ( !std::char_traits<short>::eq(c1, c2) ); - VERIFY ( std::char_traits<short>::eq(c1, c1) ); - VERIFY ( std::char_traits<short>::eq(c2, c2) ); + VERIFY ( !std::char_traits<char_type>::eq(c1, c2) ); + VERIFY ( std::char_traits<char_type>::eq(c1, c1) ); + VERIFY ( std::char_traits<char_type>::eq(c2, c2) ); - // bool X::lt(short c, short d) + // bool X::lt(char_type c, char_type d) c1 = 'z'; c2 = 'u'; - VERIFY ( std::char_traits<short>::lt(c2, c1) ); - VERIFY ( !std::char_traits<short>::lt(c1, c2) ); - VERIFY ( !std::char_traits<short>::lt(c1, c1) ); - VERIFY ( !std::char_traits<short>::lt(c2, c2) ); + VERIFY ( std::char_traits<char_type>::lt(c2, c1) ); + VERIFY ( !std::char_traits<char_type>::lt(c1, c2) ); + VERIFY ( !std::char_traits<char_type>::lt(c1, c1) ); + VERIFY ( !std::char_traits<char_type>::lt(c2, c2) ); - // short* X::move(short* s, const short* p, size_t n) + // char_type* X::move(char_type* s, const char_type* p, size_t n) // for each i in [0,n) performs X::assign(s[i], p[i]). Copies // correctly even where p is in [s, s + n), and yields s. - short array1[] = {'z', 'u', 'm', 'a', ' ', 'b', 'e', 'a', 'c', 'h', 0}; - const std::basic_string<short> str_01(array1 + 0, array1 + 10); + char_type array1[] = {'z', 'u', 'm', 'a', ' ', 'b', 'e', 'a', 'c', 'h', 0}; + const std::basic_string<char_type> str_01(array1 + 0, array1 + 10); - const short str_lit1[] = {'m', 'o', 'n', 't', 'a', 'r', 'a', ' ', 'a', 'n', 'd', ' ', 'o', 'c', 'e', 'a', 'n', ' ', 'b', 'e', 'a', 'c', 'h', 0}; + const char_type str_lit1[] = {'m', 'o', 'n', 't', 'a', 'r', 'a', ' ', 'a', 'n', 'd', ' ', 'o', 'c', 'e', 'a', 'n', ' ', 'b', 'e', 'a', 'c', 'h', 0}; - int len = sizeof(str_lit1)/sizeof(short) + sizeof(array1)/sizeof(short) - 1; + int len = sizeof(str_lit1)/sizeof(char_type) + sizeof(array1)/sizeof(char_type) - 1; // two terminating chars - short array3[] = {'b', 'o', 'r', 'a', 'c', 'a', 'y', ',', ' ', 'p', 'h', 'i', 'l', 'i', 'p', 'p', 'i', 'n', 'e', 's', 0}; - short array2[len]; - std::char_traits<short>::copy(array2, array3, len); + char_type array3[] = {'b', 'o', 'r', 'a', 'c', 'a', 'y', ',', ' ', 'p', 'h', 'i', 'l', 'i', 'p', 'p', 'i', 'n', 'e', 's', 0}; + char_type array2[len]; + std::char_traits<char_type>::copy(array2, array3, len); VERIFY( str_lit1[0] == 'm' ); c1 = array2[0]; c2 = str_lit1[0]; - short c3 = array2[1]; - short c4 = str_lit1[1]; - std::char_traits<short>::move(array2, str_lit1, 0); + char_type c3 = array2[1]; + char_type c4 = str_lit1[1]; + std::char_traits<char_type>::move(array2, str_lit1, 0); VERIFY( array2[0] == c1 ); VERIFY( str_lit1[0] == c2 ); - std::char_traits<short>::move(array2, str_lit1, 1); + std::char_traits<char_type>::move(array2, str_lit1, 1); VERIFY( array2[0] == c2 ); VERIFY( str_lit1[0] == c2 ); VERIFY( array2[1] == c3 ); VERIFY( str_lit1[1] == c4 ); - std::char_traits<short>::move(array2, str_lit1, 2); + std::char_traits<char_type>::move(array2, str_lit1, 2); VERIFY( array2[0] == c2 ); VERIFY( str_lit1[0] == c2 ); VERIFY( array2[1] == c4 ); VERIFY( str_lit1[1] == c4 ); - short* pc1 = array1 + 1; + char_type* pc1 = array1 + 1; c1 = pc1[0]; c2 = array1[0]; VERIFY( c1 != c2 ); - short* pc2 = std::char_traits<short>::move(array1, pc1, 0); + char_type* pc2 = std::char_traits<char_type>::move(array1, pc1, 0); c3 = pc1[0]; c4 = array1[0]; VERIFY( c1 == c3 ); @@ -114,11 +115,11 @@ void test02(void) c1 = pc1[0]; c2 = array1[0]; - short* pc3 = pc1; - pc2 = std::char_traits<short>::move(array1, pc1, 10); + char_type* pc3 = pc1; + pc2 = std::char_traits<char_type>::move(array1, pc1, 10); c3 = pc1[0]; c4 = array1[0]; - VERIFY( c1 != c3 ); // underlying short array changed. + VERIFY( c1 != c3 ); // underlying char_type array changed. VERIFY( c4 != c3 ); VERIFY( pc2 == array1 ); VERIFY( pc3 == pc1 ); // but pointers o-tay @@ -126,49 +127,47 @@ void test02(void) c2 = array1[0]; VERIFY( c1 != c2 ); - // size_t X::length(const short* p) - len = std::char_traits<short>::length(str_lit1); - VERIFY( len == sizeof(str_lit1) / sizeof(short) - 1 ); + // size_t X::length(const char_type* p) + len = std::char_traits<char_type>::length(str_lit1); + VERIFY( len == sizeof(str_lit1) / sizeof(char_type) - 1 ); - // const short* X::find(const short* s, size_t n, short c) - const int N4 = sizeof(str_lit1) / sizeof(short); - const short* pc4 = std::char_traits<short>::find(str_lit1, N4, 'a'); + // const char_type* X::find(const char_type* s, size_t n, char_type c) + const int N4 = sizeof(str_lit1) / sizeof(char_type); + const char_type* pc4 = std::char_traits<char_type>::find(str_lit1, N4, 'a'); VERIFY( pc4 != 0 ); VERIFY( *pc4 == 'a' ); - pc4 = std::char_traits<short>::find(str_lit1, N4, 0x0a73); + pc4 = std::char_traits<char_type>::find(str_lit1, N4, 0x0a73); VERIFY( pc4 == 0 ); - // short* X::assign(short* s, size_t n, short c) - len = sizeof(array2) / sizeof(short); - std::memset(array2, 0xaf, len * sizeof(short)); + // char_type* X::assign(char_type* s, size_t n, char_type c) + len = sizeof(array2) / sizeof(char_type); + std::memset(array2, 0xaf, len * sizeof(char_type)); VERIFY( array2[0] != 0x15a8 ); - pc1 = std::char_traits<short>::assign (array2, len, 0x15a8); + pc1 = std::char_traits<char_type>::assign (array2, len, 0x15a8); VERIFY( pc1 == array2 ); for (int i = 0; i < len; ++i) VERIFY( array2[i] == 0x15a8 ); - // short* X::copy(short* s, const short* p, size_t n) - int n1 = sizeof(str_lit1) / sizeof(short); - pc1 = std::char_traits<short>::copy(array2, str_lit1, n1); - len = std::char_traits<short>::length(array2); + // char_type* X::copy(char_type* s, const char_type* p, size_t n) + int n1 = sizeof(str_lit1) / sizeof(char_type); + pc1 = std::char_traits<char_type>::copy(array2, str_lit1, n1); + len = std::char_traits<char_type>::length(array2); VERIFY( len == n1 - 1 ); for (int i = 0; i < len; ++i) VERIFY( str_lit1[i] == array2[i] ); - // int X::compare(const short* p, const short* q, size_t n) - const short* pconst1 = str_01.data(); - const short* pconst2 = str_lit1; + // int X::compare(const char_type* p, const char_type* q, size_t n) + const char_type* pconst1 = str_01.data(); + const char_type* pconst2 = str_lit1; - VERIFY( std::char_traits<short>::compare(pconst1, pconst2, 10) > 0 ); - VERIFY( std::char_traits<short>::compare(pconst2, pconst1, 10) < 0 ); - VERIFY( std::char_traits<short>::compare(pconst1, pconst1, 10) == 0 ); - VERIFY( std::char_traits<short>::compare(pconst2, pconst2, 10) == 0 ); + VERIFY( std::char_traits<char_type>::compare(pconst1, pconst2, 10) > 0 ); + VERIFY( std::char_traits<char_type>::compare(pconst2, pconst1, 10) < 0 ); + VERIFY( std::char_traits<char_type>::compare(pconst1, pconst1, 10) == 0 ); + VERIFY( std::char_traits<char_type>::compare(pconst2, pconst2, 10) == 0 ); } - - int main() { test02(); diff --git a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc index 6026eac89af..6bd990aa11f 100644 --- a/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc +++ b/libstdc++-v3/testsuite/21_strings/char_traits/requirements/wchar_t/typedefs.cc @@ -1,5 +1,4 @@ // { dg-do compile } -// { dg-options "-ansi -pedantic-errors" } // 2001-02-11 gdr // Origin: Craig Rodrigues <rodrigc@mediaone.net> diff --git a/libstdc++-v3/testsuite/21_strings/headers/cwchar/macros.cc b/libstdc++-v3/testsuite/21_strings/headers/cwchar/macros.cc index 17d6129dd90..cb3dcc228f6 100644 --- a/libstdc++-v3/testsuite/21_strings/headers/cwchar/macros.cc +++ b/libstdc++-v3/testsuite/21_strings/headers/cwchar/macros.cc @@ -20,6 +20,8 @@ #include <cwchar> +#ifdef _GLIBCXX_USE_WCHAR_T + namespace gnu { #ifndef NULL @@ -38,3 +40,5 @@ namespace gnu #error "WEOF_must_be_a_macro" #endif } + +#endif diff --git a/libstdc++-v3/testsuite/21_strings/headers/cwctype/macros.cc b/libstdc++-v3/testsuite/21_strings/headers/cwctype/macros.cc index a1d78c75c00..ae2e4019192 100644 --- a/libstdc++-v3/testsuite/21_strings/headers/cwctype/macros.cc +++ b/libstdc++-v3/testsuite/21_strings/headers/cwctype/macros.cc @@ -20,9 +20,13 @@ #include <cwctype> +#ifdef _GLIBCXX_HAVE_WCTYPE_H + namespace gnu { #ifndef WEOF #error "WEOF_must_be_a_macro" #endif } + +#endif diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc index a784ee044a2..43bf0283d64 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/char/1.cc @@ -36,7 +36,7 @@ void test01() bool test __attribute__((unused)) = true; const char* c_lit = "black pearl jasmine tea"; const char* from_next; - int size = 25; + int size = 23; char* c_arr = new char[size]; char* c_ref = new char[size]; char* to_next; diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc index f1f06f594f1..01935eabd97 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/in/wchar_t/9.cc @@ -128,9 +128,6 @@ void test09() r1 = cvt->in(state01, efrom, e_lit + i, efrom_next, ito, i_arr + esize, ito_next); - printf("%d %d %d %x %x\n", efrom - e_lit, i, efrom_next - e_lit, - efrom[-1], ito[-1]); - // It it not clear if partial should ever be returned here // (see DR 382). VERIFY( r1 == codecvt_base::ok || r1 == codecvt_base::partial ); diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc index 55d2536fd14..76c293f11a5 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/1.cc @@ -33,7 +33,7 @@ void test01() bool test __attribute__((unused)) = true; const char* c_lit = "black pearl jasmine tea"; - int size = 25; + int size = 23; locale loc = locale::classic(); c_codecvt::state_type state; diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/2.cc b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/2.cc index 16e81b3b8b9..0642e31da3e 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/length/char/2.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/length/char/2.cc @@ -51,7 +51,7 @@ void test02() bool test __attribute__((unused)) = true; const char* c_lit = "black pearl jasmine tea"; - int size = 25; + int size = 23; locale loc (locale::classic(), new length_codecvt); c_codecvt::state_type state; diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc index efef386bbba..7581e2a123b 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/out/char/1.cc @@ -36,7 +36,7 @@ void test01() bool test __attribute__((unused)) = true; const char* c_lit = "black pearl jasmine tea"; const char* from_next; - int size = 25; + int size = 23; char* c_arr = new char[size]; char* c_ref = new char[size]; char* to_next; diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/1.cc b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/1.cc index cb3ec744e56..c6ecb25c383 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/1.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/unshift/char/1.cc @@ -36,7 +36,7 @@ void test01() bool test __attribute__((unused)) = true; const char* c_lit = "black pearl jasmine tea"; const char* from_next; - int size = 25; + int size = 23; char* c_arr = new char[size]; char* c_ref = new char[size]; char* to_next; diff --git a/libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc b/libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc index 94064ecc993..53354292ed6 100644 --- a/libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc +++ b/libstdc++-v3/testsuite/22_locale/collate/compare/char/2.cc @@ -2,7 +2,8 @@ // 2001-08-15 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 @@ -48,19 +49,17 @@ void test02() // int compare(const charT*, const charT*, const charT*, const charT*) const - const char* strlit1 = "monkey picked tikuanyin oolong"; const char* strlit3 = "Äuglein Augment"; // "C" == "Augment Äuglein" const char* strlit4 = "Base baß Baß Bast"; // "C" == "Base baß Baß Bast" int i1; int i2; - int size1 = char_traits<char>::length(strlit1) - 1; int size3 = char_traits<char>::length(strlit3) - 1; int size4 = char_traits<char>::length(strlit4) - 1; i1 = coll_de.compare(strlit3, strlit3 + size3, strlit3, strlit3 + 7); VERIFY ( i1 == 1 ); - i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size1); + i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + size3); VERIFY ( i1 == -1 ); i1 = coll_de.compare(strlit3, strlit3 + 7, strlit3, strlit3 + 7); VERIFY ( i1 == 0 ); diff --git a/libstdc++-v3/testsuite/22_locale/ctype/dr695.cc b/libstdc++-v3/testsuite/22_locale/ctype/dr695.cc new file mode 100644 index 00000000000..7d09f35d528 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/ctype/dr695.cc @@ -0,0 +1,36 @@ +// { dg-do compile } +// 2007-11-08 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 22.2.1 The ctype category + +#include <locale> + +// DR 695. +void +test01() +{ + using namespace std; + + locale loc; + const ctype<char>& ct = use_facet<ctype<char> >(loc); + ct.table(); + ct.classic_table(); +} diff --git a/libstdc++-v3/testsuite/22_locale/global_templates/standard_facet_hierarchies.cc b/libstdc++-v3/testsuite/22_locale/global_templates/standard_facet_hierarchies.cc new file mode 100644 index 00000000000..6b157e35aec --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/global_templates/standard_facet_hierarchies.cc @@ -0,0 +1,81 @@ +// Copyright (C) 2007, 2008 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <string> +#include <locale> +#include <testsuite_hooks.h> + +// Based on Langer Kreft "Standard C++ IOStreams and Locales" p 316-318 +// PR libstdc++/30127 +// PR libstdc++/34449 +int main() +{ + bool test __attribute__((unused)) = true; + + using std::locale; + using std::has_facet; + using std::use_facet; + typedef std::ctype<char> base_facet; + typedef std::ctype_byname<char> derived_facet; + + locale loc_c = locale::classic(); + locale loc_base = loc_c; + locale loc_derived(loc_c, new derived_facet("C")); + + // Standard base facet. + VERIFY( has_facet<base_facet>(loc_c) ); + VERIFY( has_facet<base_facet>(loc_base) ); + VERIFY( has_facet<base_facet>(loc_derived) ); + + // Standard derived facet. + VERIFY( !has_facet<derived_facet>(loc_c) ); + VERIFY( !has_facet<derived_facet>(loc_base) ); + VERIFY( has_facet<derived_facet>(loc_derived) ); + + + // 1 + try + { + if (has_facet<derived_facet>(loc_base)) + { + use_facet<derived_facet>(loc_base).widen('k'); + VERIFY( true ); + } + } + catch (...) + { + // Expect no exception. + VERIFY( true ); + } + + // 2 + try + { + if (has_facet<base_facet>(loc_derived)) + use_facet<base_facet>(loc_derived).widen('k'); + else + VERIFY( true ); + } + catch (...) + { + // Expect no exception. + VERIFY( true ); + } + + return 0; +} diff --git a/libstdc++-v3/testsuite/22_locale/global_templates/user_facet_hierarchies.cc b/libstdc++-v3/testsuite/22_locale/global_templates/user_facet_hierarchies.cc new file mode 100644 index 00000000000..94c41771502 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/global_templates/user_facet_hierarchies.cc @@ -0,0 +1,105 @@ +// Copyright (C) 2007, 2008 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <string> +#include <locale> +#include <testsuite_hooks.h> + +// Based on Langer Kreft "Standard C++ IOStreams and Locales" p 316-318 +struct base_facet: public std::locale::facet +{ + virtual std::string msg() const + { return "base class"; } + + static std::locale::id id; +}; + +std::locale::id base_facet::id; + + +struct derived_facet: public base_facet +{ + virtual std::string msg() const + { return "derived class"; } + + virtual std::string msg_repeater() const + { return "derived class derived class"; } + +}; + +// PR libstdc++/30127 +// PR libstdc++/34449 +int main() +{ + bool test __attribute__((unused)) = true; + + using std::locale; + using std::has_facet; + using std::use_facet; + + locale loc_c = locale::classic(); + locale loc_base(loc_c, new base_facet); + locale loc_derived(loc_c, new derived_facet); + + // Standard facets. + VERIFY( has_facet<std::ctype<char> >(loc_c) ); + VERIFY( has_facet<std::ctype<char> >(loc_base) ); + VERIFY( has_facet<std::ctype<char> >(loc_derived) ); + + // User defined base facet. + VERIFY( !has_facet<base_facet>(loc_c) ); + VERIFY( has_facet<base_facet>(loc_base) ); + VERIFY( has_facet<base_facet>(loc_derived) ); + + // User defined derived facet. + VERIFY( !has_facet<derived_facet>(loc_c) ); + VERIFY( !has_facet<derived_facet>(loc_base) ); + VERIFY( has_facet<derived_facet>(loc_derived) ); + + + // 1 + try + { + if (has_facet<derived_facet>(loc_base)) + { + use_facet<derived_facet>(loc_base).msg_repeater(); + VERIFY( false ); + } + } + catch (...) + { + // Expect no exception. + VERIFY( true ); + } + + // 2 + try + { + if (has_facet<base_facet>(loc_derived)) + use_facet<base_facet>(loc_derived).msg(); + else + VERIFY( true ); + } + catch (...) + { + // Expect no exception. + VERIFY( true ); + } + + return 0; +} diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc index 266388fcc2d..1aff586a125 100644 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc +++ b/libstdc++-v3/testsuite/22_locale/num_get/get/char/1.cc @@ -45,7 +45,6 @@ void test01() bool b1 = true; bool b0 = false; unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; unsigned long ul; double d1 = 1.02345e+308; double d2 = 3.15e-308; diff --git a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc index 60457f70793..a6268e2719f 100644 --- a/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/22_locale/num_get/get/wchar_t/1.cc @@ -45,7 +45,6 @@ void test01() bool b1 = true; bool b0 = false; unsigned long ul1 = 1294967294; - unsigned long ul2 = 0; unsigned long ul; double d1 = 1.02345e+308; double d2 = 3.15e-308; diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/char/12.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/char/12.cc new file mode 100644 index 00000000000..c17ecec8171 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/num_put/put/char/12.cc @@ -0,0 +1,64 @@ +// 2007-11-26 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 22.2.2.2.1 num_put members + +#include <locale> +#include <sstream> +#include <testsuite_hooks.h> + +// http://gcc.gnu.org/ml/libstdc++/2007-11/msg00074.html +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + ostringstream oss1, oss2, oss3; + const num_put<char>& np1 = use_facet<num_put<char> >(oss1.getloc()); + const num_put<char>& np2 = use_facet<num_put<char> >(oss2.getloc()); + const num_put<char>& np3 = use_facet<num_put<char> >(oss3.getloc()); + + string result1, result2, result3; + + long int li1 = 0; + long int li2 = 5; + double d1 = 0.0; + + oss1.setf(ios_base::showpos); + np1.put(oss1.rdbuf(), oss1, '*', li1); + result1 = oss1.str(); + VERIFY( result1 == "+0" ); + + oss2.setf(ios_base::showpos); + np2.put(oss2.rdbuf(), oss2, '*', li2); + result2 = oss2.str(); + VERIFY( result2 == "+5" ); + + oss3.setf(ios_base::showpos); + np3.put(oss3.rdbuf(), oss3, '*', d1); + result3 = oss3.str(); + VERIFY( result3 == "+0" ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/12.cc b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/12.cc new file mode 100644 index 00000000000..1467aa3d4a6 --- /dev/null +++ b/libstdc++-v3/testsuite/22_locale/num_put/put/wchar_t/12.cc @@ -0,0 +1,64 @@ +// 2007-11-26 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 22.2.2.2.1 num_put members + +#include <locale> +#include <sstream> +#include <testsuite_hooks.h> + +// http://gcc.gnu.org/ml/libstdc++/2007-11/msg00074.html +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + wostringstream oss1, oss2, oss3; + const num_put<wchar_t>& np1 = use_facet<num_put<wchar_t> >(oss1.getloc()); + const num_put<wchar_t>& np2 = use_facet<num_put<wchar_t> >(oss2.getloc()); + const num_put<wchar_t>& np3 = use_facet<num_put<wchar_t> >(oss3.getloc()); + + wstring result1, result2, result3; + + long int li1 = 0; + long int li2 = 5; + double d1 = 0.0; + + oss1.setf(ios_base::showpos); + np1.put(oss1.rdbuf(), oss1, L'*', li1); + result1 = oss1.str(); + VERIFY( result1 == L"+0" ); + + oss2.setf(ios_base::showpos); + np2.put(oss2.rdbuf(), oss2, L'*', li2); + result2 = oss2.str(); + VERIFY( result2 == L"+5" ); + + oss3.setf(ios_base::showpos); + np3.put(oss3.rdbuf(), oss3, L'*', d1); + result3 = oss3.str(); + VERIFY( result3 == L"+0" ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc index e7a93f07df6..cf38a79902e 100644 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc +++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/5.cc @@ -1,6 +1,7 @@ // 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 @@ -52,8 +53,9 @@ void test05() date, date + traits::length(date)); string result5 = oss.str(); VERIFY( result5 == "Sunday, the second of April"); - iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); + iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, '*', &time1, + date_ex, + date_ex + traits::length(date_ex)); string result6 = oss.str(); VERIFY( result6 != result5 ); } diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc index 0bb9a2d28db..8ef33f536c6 100644 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc +++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/6.cc @@ -2,7 +2,8 @@ // 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 @@ -55,7 +56,8 @@ void test06() string result7 = oss.str(); VERIFY( result7 == "Sonntag, the second of April"); iterator_type os_it08 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); + date_ex, + date_ex + traits::length(date_ex)); string result8 = oss.str(); VERIFY( result8 != result7 ); } diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc index 7753fe947bc..f17c6b94ce7 100644 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc +++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/7.cc @@ -2,7 +2,8 @@ // 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 @@ -55,7 +56,8 @@ void test07() string result9 = oss.str(); VERIFY( result9 == "Sunday, the second of April"); iterator_type os_it10 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); + date_ex, + date_ex + traits::length(date_ex)); string result10 = oss.str(); VERIFY( result10 != result9 ); } diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc index 3a1d9914277..2da9be0b146 100644 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc +++ b/libstdc++-v3/testsuite/22_locale/time_put/put/char/8.cc @@ -2,7 +2,8 @@ // 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 @@ -54,7 +55,8 @@ void test08() string result11 = oss.str(); VERIFY( result11 == "dimanche, the second of avril"); iterator_type os_it12 = tim_put.put(oss.rdbuf(), oss, '*', &time1, - date_ex, date_ex + traits::length(date)); + date_ex, + date_ex + traits::length(date_ex)); string result12 = oss.str(); VERIFY( result12 != result11 ); } diff --git a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc index aaf3e391e8d..d635968c162 100644 --- a/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc +++ b/libstdc++-v3/testsuite/22_locale/time_put/put/wchar_t/5.cc @@ -1,6 +1,7 @@ // 2001-09-17 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// 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 @@ -54,8 +55,9 @@ void test05() date, date + traits::length(date)); wstring result5 = oss.str(); VERIFY( result5 == L"Sunday, the second of April"); - iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, - date_ex, date_ex + traits::length(date)); + iterator_type os_it06 = tim_put.put(oss.rdbuf(), oss, L'*', &time1, + date_ex, + date_ex + traits::length(date_ex)); wstring result6 = oss.str(); VERIFY( result6 != result5 ); } diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc new file mode 100644 index 00000000000..4e2cccf0181 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <array> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::array<int, 7> a; + VERIFY( a.cbegin() == a.begin() ); + VERIFY( a.cend() == a.end() ); + VERIFY( a.crbegin() == a.rbegin() ); + VERIFY( a.crend() == a.rend() ); + VERIFY( a.cbegin() != a.cend() ); + VERIFY( a.crbegin() != a.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/bitset/all/1.cc b/libstdc++-v3/testsuite/23_containers/bitset/all/1.cc new file mode 100644 index 00000000000..1464510fdbf --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/bitset/all/1.cc @@ -0,0 +1,81 @@ +// 2007-11-23 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 23.3.5.2 bitset members + +#include <bitset> +#include <testsuite_hooks.h> + +// DR 693. std::bitset::all() missing. +void test01() +{ + bool test __attribute__((unused)) = true; + + std::bitset<0> z1; + VERIFY( z1.all() ); + z1.set(); + VERIFY( z1.all() ); + + std::bitset<8> z2; + VERIFY( !z2.all() ); + z2.set(); + VERIFY( z2.all() ); + + std::bitset<16> z3; + VERIFY( !z3.all() ); + z3.set(); + VERIFY( z3.all() ); + + std::bitset<32> z4; + VERIFY( !z4.all() ); + z4.set(); + VERIFY( z4.all() ); + + std::bitset<64> z5; + VERIFY( !z5.all() ); + z5.set(); + VERIFY( z5.all() ); + + std::bitset<96> z6; + VERIFY( !z6.all() ); + z6.set(); + VERIFY( z6.all() ); + + std::bitset<128> z7; + VERIFY( !z7.all() ); + z7.set(); + VERIFY( z7.all() ); + + std::bitset<192> z8; + VERIFY( !z8.all() ); + z8.set(); + VERIFY( z8.all() ); + + std::bitset<1024> z9; + VERIFY( !z9.all() ); + z9.set(); + VERIFY( z9.all() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc b/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc new file mode 100644 index 00000000000..812e0214c89 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/capacity/moveable.cc @@ -0,0 +1,81 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#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() +{ + bool test __attribute__((unused)) = true; + + std::deque<copycounter> a; + copycounter::copycount = 0; + a.resize(10); + a.resize(98); + a.resize(99); + a.resize(100); +#ifndef _GLIBCXX_DEBUG + VERIFY( copycounter::copycount == 100 ); +#else + VERIFY( copycounter::copycount == 100 + 4 ); +#endif + a.resize(99); + a.resize(0); +#ifndef _GLIBCXX_DEBUG + VERIFY( copycounter::copycount == 100 ); +#else + VERIFY( copycounter::copycount == 100 + 6 ); +#endif + a.resize(100); +#ifndef _GLIBCXX_DEBUG + VERIFY( copycounter::copycount == 200 ); +#else + VERIFY( copycounter::copycount == 200 + 7 ); +#endif + a.clear(); +#ifndef _GLIBCXX_DEBUG + VERIFY( copycounter::copycount == 200 ); +#else + VERIFY( copycounter::copycount == 200 + 7 ); +#endif +} + + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/deque/cons/moveable.cc new file mode 100644 index 00000000000..6ec082d3d81 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/cons/moveable.cc @@ -0,0 +1,64 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <deque> +#include <iterator> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using namespace __gnu_test; +typedef std::deque<rvalstruct> test_type; + +// Empty constructor doesn't require a copy constructor +void +test01() +{ test_type d; } + +// Constructing from a range that returns rvalue references doesn't +// require a copy constructor. +void +test02(rvalstruct* begin, rvalstruct* end) +{ + test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +} + +// Constructing from a input iterator range that returns rvalue +// references doesn't require a copy constructor either. +void +test03(input_iterator_wrapper<rvalstruct> begin, + input_iterator_wrapper<rvalstruct> end) +{ + test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +} + +// Neither does destroying one. +void +test04(test_type* d) +{ delete d; } diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/1.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/1.cc index 167f1f2a12b..5fe41db88de 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/1.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/1.cc @@ -1,6 +1,6 @@ // 2005-11-25 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2005 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007 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 @@ -29,12 +29,12 @@ const int A2[] = {0, 2, 3, 4, 10, 11, 12, 13, 14, 15}; const int A3[] = {0, 2, 3, 4, 10, 11}; const int A4[] = {4, 10, 11}; const int A5[] = {4, 10}; -const int N = sizeof(A) / sizeof(int); -const int N1 = sizeof(A1) / sizeof(int); -const int N2 = sizeof(A2) / sizeof(int); -const int N3 = sizeof(A3) / sizeof(int); -const int N4 = sizeof(A4) / sizeof(int); -const int N5 = sizeof(A5) / sizeof(int); +const unsigned N = sizeof(A) / sizeof(int); +const unsigned N1 = sizeof(A1) / sizeof(int); +const unsigned N2 = sizeof(A2) / sizeof(int); +const unsigned N3 = sizeof(A3) / sizeof(int); +const unsigned N4 = sizeof(A4) / sizeof(int); +const unsigned N5 = sizeof(A5) / sizeof(int); void test01() @@ -85,17 +85,17 @@ test02() typedef deque_type::iterator iterator_type; deque_type v, v1, v2, v3, v4, v5; - for (int i = 0; i < N; ++i) + for (unsigned i = 0; i < N; ++i) v.push_back(std::deque<int>(1, A[i])); - for (int i = 0; i < N1; ++i) + for (unsigned i = 0; i < N1; ++i) v1.push_back(std::deque<int>(1, A1[i])); - for (int i = 0; i < N2; ++i) + for (unsigned i = 0; i < N2; ++i) v2.push_back(std::deque<int>(1, A2[i])); - for (int i = 0; i < N3; ++i) + for (unsigned i = 0; i < N3; ++i) v3.push_back(std::deque<int>(1, A3[i])); - for (int i = 0; i < N4; ++i) + for (unsigned i = 0; i < N4; ++i) v4.push_back(std::deque<int>(1, A4[i])); - for (int i = 0; i < N5; ++i) + for (unsigned i = 0; i < N5; ++i) v5.push_back(std::deque<int>(1, A5[i])); iterator_type it1 = v.erase(v.begin() + 1); diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/2.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/2.cc index 19542d3999e..93ced1b9064 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/2.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/2.cc @@ -1,6 +1,6 @@ // 2005-11-25 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2005 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007 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 @@ -32,14 +32,14 @@ const int A3[] = {-5, 0, 1, 2, 8, 9, 10, 11}; const int A4[] = {2, 8, 9, 10, 11}; const int A5[] = {2, 8, 10, 11}; const int A6[] = {2, 8, 10}; -const int N = sizeof(A) / sizeof(int); -const int N0 = sizeof(A0) / sizeof(int); -const int N1 = sizeof(A1) / sizeof(int); -const int N2 = sizeof(A2) / sizeof(int); -const int N3 = sizeof(A3) / sizeof(int); -const int N4 = sizeof(A4) / sizeof(int); -const int N5 = sizeof(A5) / sizeof(int); -const int N6 = sizeof(A6) / sizeof(int); +const unsigned N = sizeof(A) / sizeof(int); +const unsigned N0 = sizeof(A0) / sizeof(int); +const unsigned N1 = sizeof(A1) / sizeof(int); +const unsigned N2 = sizeof(A2) / sizeof(int); +const unsigned N3 = sizeof(A3) / sizeof(int); +const unsigned N4 = sizeof(A4) / sizeof(int); +const unsigned N5 = sizeof(A5) / sizeof(int); +const unsigned N6 = sizeof(A6) / sizeof(int); template<int Size> class My_class diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/moveable.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/moveable.cc new file mode 100644 index 00000000000..879d0c25f98 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/modifiers/erase/moveable.cc @@ -0,0 +1,71 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-28 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <deque> +#include <testsuite_hooks.h> +#include <testsuite_rvalref.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace __gnu_test; + + std::deque<copycounter> a(40); + copycounter::copycount = 0; + + a.erase(a.begin() + 20); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.begin()); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.end() - 1); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.begin() + 10, a.end() - 10); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.begin(), a.begin() + 5); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.end() - 5, a.end()); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.begin(), a.end()); + VERIFY( copycounter::copycount == 0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/modifiers/moveable.cc b/libstdc++-v3/testsuite/23_containers/deque/modifiers/moveable.cc new file mode 100644 index 00000000000..c965a9d2449 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/modifiers/moveable.cc @@ -0,0 +1,143 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <deque> +#include <testsuite_hooks.h> +#include <testsuite_rvalref.h> + +using namespace __gnu_test; + +// Test deque::push_back makes no unneeded copies. +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::deque<copycounter> a; + copycounter c(1); + copycounter::copycount = 0; + for(int i = 0; i < 1000; ++i) + a.push_back(c); + VERIFY(copycounter::copycount == 1000); +} + +// Test deque::push_front makes no unneeded copies. +void +test02() +{ + bool test __attribute__((unused)) = true; + + std::deque<copycounter> a; + copycounter c(1); + copycounter::copycount = 0; + for(int i = 0; i < 1000; ++i) + a.push_front(c); + VERIFY(copycounter::copycount == 1000); +} + +// Test deque::insert makes no unneeded copies. +void +test03() +{ + bool test __attribute__((unused)) = true; + + std::deque<copycounter> a(1000); + copycounter c(1); + copycounter::copycount = 0; + a.insert(a.begin(),c); + a.insert(a.end(),c); + for(int i = 0; i < 500; ++i) + a.insert(a.begin() + i, c); + VERIFY(copycounter::copycount == 502); +} + +// Test deque::insert(iterator, count, value) makes no unneeded copies +// when it has to also reallocate the deque's internal buffer. +void +test04() +{ + bool test __attribute__((unused)) = true; + + copycounter c(1); + std::deque<copycounter> a(10, c); + copycounter::copycount = 0; + a.insert(a.begin(), 20, c); + VERIFY(copycounter::copycount == 20); + a.insert(a.end(), 50, c); + VERIFY(copycounter::copycount == 70); + // NOTE : These values are each one higher than might be expected, as + // deque::insert(iterator, count, value) copies the value it is given + // when it has to move elements in the deque in case that value is + // in the deque. + + // Near the start + a.insert(a.begin() + 10, 100, c); + VERIFY(copycounter::copycount == 170 + 1); + // Near the end + a.insert(a.end() - 10, 1000, c); + VERIFY(copycounter::copycount == 1170 + 2); +} + +// Test deque::insert(iterator, count, value) makes no unneeded copies +// when it doesn't have to reallocate the deque's internal buffer. +void +test05() +{ + bool test __attribute__((unused)) = true; + + copycounter c(1); + std::deque<copycounter> a(10, c); + copycounter::copycount = 0; + //a.reserve(1000); + a.insert(a.begin(), 20, c); + VERIFY(copycounter::copycount == 20 ); + a.insert(a.end(), 50, c); + VERIFY(copycounter::copycount == 70 ); + + // NOTE : These values are each one higher than might be expected, as + // deque::insert(iterator, count, value) copies the value it is given + // when it has to move elements in the deque in case that value is + // in the deque. + // Near the start + a.insert(a.begin() + 10, 100, c); + VERIFY(copycounter::copycount == 170 + 1); + // Near the end + a.insert(a.end() - 10, 200, c); + VERIFY(copycounter::copycount == 370 + 2); +} + +int main() +{ + test01(); + test02(); + test03(); + test04(); + test05(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/moveable.cc b/libstdc++-v3/testsuite/23_containers/deque/moveable.cc new file mode 100644 index 00000000000..ae532de9780 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/moveable.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on deque (via swap). If the implementation changed +// this test may begin to fail. + +#include <deque> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::deque<int> a,b; + a.push_back(1); + b = std::move(a); + VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 ); + + std::deque<int> c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == 1 ); + VERIFY( b.size() == 0 ); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc new file mode 100644 index 00000000000..e869a287cb6 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <deque> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::deque<int> d(7); + VERIFY( d.cbegin() == d.begin() ); + VERIFY( d.cend() == d.end() ); + VERIFY( d.crbegin() == d.rbegin() ); + VERIFY( d.crend() == d.rend() ); + VERIFY( d.cbegin() != d.cend() ); + VERIFY( d.crbegin() != d.crend() ); +} + +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 0c47da04033..3d40c00596b 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1297 } +// { dg-error "no matching" "" { target *-*-* } 1449 } // { 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 fc0beffae3e..fb4c40ef8cc 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 @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1232 } +// { dg-error "no matching" "" { target *-*-* } 1388 } // { 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 403f6473f6b..1f24c98278f 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 Free Software Foundation +// Copyright (C) 2007, 2008 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1232 } +// { dg-error "no matching" "" { target *-*-* } 1388 } // { 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 2e2abc56c4b..522022a856d 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 @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1377 } +// { dg-error "no matching" "" { target *-*-* } 1533 } // { dg-excess-errors "" } #include <deque> diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/explicit_instantiation/2.cc index 6c1b9adb786..697776e973d 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/explicit_instantiation/2.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/explicit_instantiation/2.cc @@ -29,6 +29,7 @@ #include <deque> #include <testsuite_hooks.h> +#include <testsuite_api.h> // { dg-do compile } diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc index 340f336846d..4faaad688cd 100644 --- a/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc +++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc @@ -18,6 +18,8 @@ // 23.2.2.3 list modifiers [lib.list.modifiers] +// { dg-require-time "" } + #include <list> #include <testsuite_hooks.h> #include <ext/throw_allocator.h> diff --git a/libstdc++-v3/testsuite/23_containers/list/moveable.cc b/libstdc++-v3/testsuite/23_containers/list/moveable.cc new file mode 100644 index 00000000000..d3f1031f91f --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/moveable.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on list (via swap). If the implementation changed +// this test may begin to fail. + +#include <list> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::list<int> a,b; + a.push_back(1); + b = std::move(a); + VERIFY( b.size() == 1 && *b.begin() == 1 && a.size() == 0 ); + + std::list<int> c(std::move(b)); + VERIFY( c.size() == 1 && *c.begin() == 1 ); + VERIFY( b.size() == 0 ); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc new file mode 100644 index 00000000000..d9ef7581e60 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <list> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::list<int> l(7); + VERIFY( l.cbegin() == l.begin() ); + VERIFY( l.cend() == l.end() ); + VERIFY( l.crbegin() == l.rbegin() ); + VERIFY( l.crend() == l.rend() ); + VERIFY( l.cbegin() != l.cend() ); + VERIFY( l.crbegin() != l.crend() ); +} + +int main() +{ + test01(); + return 0; +} 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 4ad1127b9e5..1478f3de947 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 @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1138 } +// { dg-error "no matching" "" { target *-*-* } 1317 } // { 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 5df6fc8532c..d5dc3908b7c 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 @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1107 } +// { dg-error "no matching" "" { target *-*-* } 1286 } // { 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 6783727be7a..10f726b9f73 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 @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1107 } +// { dg-error "no matching" "" { target *-*-* } 1286 } // { 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 c8f2026052e..1a97c4b4436 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 @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1107 } +// { dg-error "no matching" "" { target *-*-* } 1286 } // { dg-excess-errors "" } #include <list> diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/2.cc index 8b27d10251b..9c052d8d480 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/2.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/explicit_instantiation/2.cc @@ -29,6 +29,7 @@ #include <list> #include <testsuite_hooks.h> +#include <testsuite_api.h> // { dg-do compile } diff --git a/libstdc++-v3/testsuite/23_containers/map/moveable.cc b/libstdc++-v3/testsuite/23_containers/map/moveable.cc new file mode 100644 index 00000000000..c3ab6b0a69b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/moveable.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on map (via swap). If the implementation changed +// this test may begin to fail. + +#include <map> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::map<int, int> a,b; + a[2]=0; + b[1]=0; + b = std::move(a); + VERIFY(b.find(2) != b.end() && a.find(1) == a.end()); + + std::map<int, int> c(std::move(b)); + VERIFY( c.find(2) != c.end()); + VERIFY( b.find(2) == b.end()); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/map/operations/1.cc b/libstdc++-v3/testsuite/23_containers/map/operations/1.cc index 8f27ab4c06e..35355380461 100644 --- a/libstdc++-v3/testsuite/23_containers/map/operations/1.cc +++ b/libstdc++-v3/testsuite/23_containers/map/operations/1.cc @@ -1,6 +1,6 @@ // 2006-11-25 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007 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 @@ -128,6 +128,7 @@ void test01() VERIFY( pp0.second == irt1.first ); } +int main() { test01(); diff --git a/libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc new file mode 100644 index 00000000000..320d46d2e29 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <map> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::map<int, int> m; + m[1] = 1; + VERIFY( m.cbegin() == m.begin() ); + VERIFY( m.cend() == m.end() ); + VERIFY( m.crbegin() == m.rbegin() ); + VERIFY( m.crend() == m.rend() ); + VERIFY( m.cbegin() != m.cend() ); + VERIFY( m.crbegin() != m.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/2.cc index 433349434c1..5640653b3e1 100644 --- a/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/2.cc +++ b/libstdc++-v3/testsuite/23_containers/map/requirements/explicit_instantiation/2.cc @@ -29,6 +29,7 @@ #include <map> #include <testsuite_hooks.h> +#include <testsuite_api.h> // { dg-do compile } diff --git a/libstdc++-v3/testsuite/23_containers/multimap/moveable.cc b/libstdc++-v3/testsuite/23_containers/multimap/moveable.cc new file mode 100644 index 00000000000..f3921a39bb5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/moveable.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on multimap (via swap). If the implementation changed +// this test may begin to fail. + +#include <map> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::multimap<int, int> a,b; + a.insert(std::make_pair(2,0)); + b.insert(std::make_pair(1,0)); + b = std::move(a); + VERIFY(b.find(2) != b.end() && a.find(1) == a.end()); + + std::multimap<int, int> c(std::move(b)); + VERIFY( c.find(2) != c.end()); + VERIFY( b.find(2) == b.end()); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multimap/operations/1.cc b/libstdc++-v3/testsuite/23_containers/multimap/operations/1.cc index 8ee2f2847d1..b781ca2f947 100644 --- a/libstdc++-v3/testsuite/23_containers/multimap/operations/1.cc +++ b/libstdc++-v3/testsuite/23_containers/multimap/operations/1.cc @@ -1,6 +1,6 @@ // 2006-11-25 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007 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 @@ -127,6 +127,7 @@ void test01() VERIFY( pp0.second == iter1 ); } +int main() { test01(); diff --git a/libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc new file mode 100644 index 00000000000..ec01d38afbf --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc @@ -0,0 +1,55 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <map> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::multimap<int, int> mm_type; + mm_type mm; + mm.insert(mm_type::value_type(1, 1)); + VERIFY( mm.cbegin() == mm.begin() ); + VERIFY( mm.cend() == mm.end() ); + VERIFY( mm.crbegin() == mm.rbegin() ); + VERIFY( mm.crend() == mm.rend() ); + VERIFY( mm.cbegin() != mm.cend() ); + VERIFY( mm.crbegin() != mm.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/2.cc index 86527fd1fb8..2a624a5fce3 100644 --- a/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/2.cc +++ b/libstdc++-v3/testsuite/23_containers/multimap/requirements/explicit_instantiation/2.cc @@ -29,6 +29,7 @@ #include <map> #include <testsuite_hooks.h> +#include <testsuite_api.h> // { dg-do compile } diff --git a/libstdc++-v3/testsuite/23_containers/multiset/moveable.cc b/libstdc++-v3/testsuite/23_containers/multiset/moveable.cc new file mode 100644 index 00000000000..a326cebb157 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/moveable.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on multiset (via swap). If the implementation changed +// this test may begin to fail. + +#include <set> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::multiset<int> a,b; + a.insert(2); + b.insert(1); + b = std::move(a); + VERIFY(b.find(2) != b.end() && a.find(1) == a.end()); + + std::multiset<int> c(std::move(b)); + VERIFY( c.find(2) != c.end()); + VERIFY( b.find(2) == b.end()); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/operations/1.cc b/libstdc++-v3/testsuite/23_containers/multiset/operations/1.cc index ffa386cfeb5..a37a0a1a637 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/operations/1.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/operations/1.cc @@ -1,6 +1,6 @@ // 2006-11-25 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007 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 @@ -126,6 +126,7 @@ void test01() VERIFY( pp0.second == iter1 ); } +int main() { test01(); diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc new file mode 100644 index 00000000000..48e3d49bcb8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <set> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::multiset<int> ms; + ms.insert(1); + VERIFY( ms.cbegin() == ms.begin() ); + VERIFY( ms.cend() == ms.end() ); + VERIFY( ms.crbegin() == ms.rbegin() ); + VERIFY( ms.crend() == ms.rend() ); + VERIFY( ms.cbegin() != ms.cend() ); + VERIFY( ms.crbegin() != ms.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/2.cc index c1e69b76832..043d760acbe 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/2.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/explicit_instantiation/2.cc @@ -29,6 +29,7 @@ #include <set> #include <testsuite_hooks.h> +#include <testsuite_api.h> // { dg-do compile } diff --git a/libstdc++-v3/testsuite/23_containers/priority_queue/moveable.cc b/libstdc++-v3/testsuite/23_containers/priority_queue/moveable.cc new file mode 100644 index 00000000000..bda5a4c1792 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/priority_queue/moveable.cc @@ -0,0 +1,56 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on vector (via swap). If the implementation changed +// this test may begin to fail. + +#include <queue> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::priority_queue<int> a,b; + a.push(1); + b = std::move(a); + VERIFY( b.size() == 1 && b.top() == 1 && a.size() == 0 ); + + std::priority_queue<int> c(std::move(b)); + VERIFY( c.size() == 1 && c.top() == 1 ); + VERIFY( b.size() == 0 ); +} + +int main(void) +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/queue/moveable.cc b/libstdc++-v3/testsuite/23_containers/queue/moveable.cc new file mode 100644 index 00000000000..6827c48795a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/queue/moveable.cc @@ -0,0 +1,56 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on vector (via swap). If the implementation changed +// this test may begin to fail. + +#include <queue> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::queue<int> a,b; + a.push(1); + b = std::move(a); + VERIFY( b.size() == 1 && b.front() == 1 && a.size() == 0 ); + + std::queue<int> c(std::move(b)); + VERIFY( c.size() == 1 && c.front() == 1 ); + VERIFY( b.size() == 0 ); +} + +int main(void) +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/moveable.cc b/libstdc++-v3/testsuite/23_containers/set/moveable.cc new file mode 100644 index 00000000000..8bfc2d27290 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/moveable.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on set (via swap). If the implementation changed +// this test may begin to fail. + +#include <set> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::set<int> a,b; + a.insert(2); + b.insert(1); + b = std::move(a); + VERIFY(b.find(2) != b.end() && a.find(1) == a.end()); + + std::set<int> c(std::move(b)); + VERIFY( c.find(2) != c.end()); + VERIFY( b.find(2) == b.end()); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/operations/1.cc b/libstdc++-v3/testsuite/23_containers/set/operations/1.cc index fcc311381a1..b0e6dc507e0 100644 --- a/libstdc++-v3/testsuite/23_containers/set/operations/1.cc +++ b/libstdc++-v3/testsuite/23_containers/set/operations/1.cc @@ -1,6 +1,6 @@ // 2006-11-25 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007 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 @@ -127,6 +127,7 @@ void test01() VERIFY( pp0.second == irt1.first ); } +int main() { test01(); diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc new file mode 100644 index 00000000000..3fd624b5208 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <set> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::set<int> s; + s.insert(1); + VERIFY( s.cbegin() == s.begin() ); + VERIFY( s.cend() == s.end() ); + VERIFY( s.crbegin() == s.rbegin() ); + VERIFY( s.crend() == s.rend() ); + VERIFY( s.cbegin() != s.cend() ); + VERIFY( s.crbegin() != s.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc index 44bc5debb51..510e0b3d474 100644 --- a/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc +++ b/libstdc++-v3/testsuite/23_containers/set/requirements/explicit_instantiation/2.cc @@ -29,6 +29,7 @@ #include <set> #include <testsuite_hooks.h> +#include <testsuite_api.h> // { dg-do compile } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/moveable.cc new file mode 100644 index 00000000000..4032a74d342 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/moveable.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on map (via swap). If the implementation changed +// this test may begin to fail. + +#include <unordered_map> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::unordered_map<int, int> a,b; + a[2]=0; + b[1]=0; + b = std::move(a); + VERIFY( b.find(2) != b.end() && a.find(1) == a.end() ); + + std::unordered_map<int, int> c(std::move(b)); + VERIFY( c.find(2) != c.end() ); + VERIFY( b.find(2) == b.end() ); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc new file mode 100644 index 00000000000..a14ad0e4bb3 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <unordered_map> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::unordered_map<int, int> um; + um[1] = 1; + VERIFY( um.cbegin() == um.begin() ); + VERIFY( um.cend() == um.end() ); + VERIFY( um.cbegin() != um.cend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug.cc new file mode 100644 index 00000000000..a880bdc57a8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/debug.cc @@ -0,0 +1,39 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <string> +#include <debug/unordered_map> + +using namespace __gnu_debug; + +using std::allocator; +using std::equal_to; +using std::hash; +using std::pair; +using std::string; + +template class unordered_map<string, float>; +template class unordered_map<string, int, + hash<string>, equal_to<string>, + allocator<pair<const string, int> > >; +template class unordered_map<string, float, + hash<string>, equal_to<string>, + allocator<char> >; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/moveable.cc new file mode 100644 index 00000000000..96e420bc5aa --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/moveable.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on multimap (via swap). If the implementation changed +// this test may begin to fail. + +#include <unordered_map> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::unordered_multimap<int, int> a,b; + a.insert(std::make_pair(2,0)); + b.insert(std::make_pair(1,0)); + b = std::move(a); + VERIFY( b.find(2) != b.end() && a.find(1) == a.end() ); + + std::unordered_multimap<int, int> c(std::move(b)); + VERIFY( c.find(2) != c.end() ); + VERIFY( b.find(2) == b.end() ); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc new file mode 100644 index 00000000000..9d480726b38 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <unordered_map> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap<int, int> umm_type; + umm_type umm; + umm.insert(umm_type::value_type(1, 1)); + VERIFY( umm.cbegin() == umm.begin() ); + VERIFY( umm.cend() == umm.end() ); + VERIFY( umm.cbegin() != umm.cend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc new file mode 100644 index 00000000000..fe2b9af4e13 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/debug.cc @@ -0,0 +1,29 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <string> +#include <debug/unordered_map> + +using namespace __gnu_debug; + +using std::string; + +template class unordered_multimap<string, float>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/moveable.cc new file mode 100644 index 00000000000..baa35a9653d --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/moveable.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on set (via swap). If the implementation changed +// this test may begin to fail. + +#include <unordered_set> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::unordered_multiset<int> a,b; + a.insert(2); + b.insert(1); + b = std::move(a); + VERIFY( b.find(2) != b.end() && a.find(1) == a.end() ); + + std::unordered_multiset<int> c(std::move(b)); + VERIFY( c.find(2) != c.end() ); + VERIFY( b.find(2) == b.end() ); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc new file mode 100644 index 00000000000..fd54edc4c95 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <unordered_set> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::unordered_multiset<int> ums; + ums.insert(1); + VERIFY( ums.cbegin() == ums.begin() ); + VERIFY( ums.cend() == ums.end() ); + VERIFY( ums.cbegin() != ums.cend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/debug.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/debug.cc new file mode 100644 index 00000000000..3d09ef6e551 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/debug.cc @@ -0,0 +1,27 @@ +// { dg-options "-std=gnu++0x" } +// { dg-do compile } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <string> +#include <debug/unordered_set> + +using namespace __gnu_debug; + +template class unordered_multiset<int>; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/moveable.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/moveable.cc new file mode 100644 index 00000000000..a67e9420089 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/moveable.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on set (via swap). If the implementation changed +// this test may begin to fail. + +#include <unordered_set> +#include <utility> +#include <testsuite_hooks.h> + +int main() +{ + bool test __attribute__((unused)) = true; + + std::unordered_set<int> a,b; + a.insert(2); + b.insert(1); + b = std::move(a); + VERIFY( b.find(2) != b.end() && a.find(1) == a.end() ); + + std::unordered_set<int> c(std::move(b)); + VERIFY( c.find(2) != c.end() ); + VERIFY( b.find(2) == b.end() ); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc new file mode 100644 index 00000000000..f358a0f3c7b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <unordered_set> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::unordered_set<int> us; + us.insert(1); + VERIFY( us.cbegin() == us.begin() ); + VERIFY( us.cend() == us.end() ); + VERIFY( us.cbegin() != us.cend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/hash/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/debug.cc index 2155ca898bc..2894dff0edb 100644 --- a/libstdc++-v3/testsuite/23_containers/hash/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/debug.cc @@ -19,6 +19,8 @@ // the Free Software Foundation, 51 Franklin Street, Fifth Floor, // Boston, MA 02110-1301, USA. -#include <functional> +#include <debug/unordered_set> -template class std::hash<bool>; +using namespace __gnu_debug; + +template class unordered_set<int>; diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/29134.cc index 7ebec611d72..6d71b23ff30 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/29134.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/capacity/29134.cc @@ -27,13 +27,22 @@ void test01() { bool test __attribute__((unused)) = true; - std::vector<bool> vb; + using std::vector; + using std::numeric_limits; + +#ifndef _GLIBCXX_DEBUG + using std::_S_word_bit; +#else + using std::_GLIBCXX_STD_D::_S_word_bit; +#endif // Actually, vector<bool> is special, see libstdc++/31370. - typedef std::vector<bool>::difference_type difference_type; + vector<bool> vb; + typedef vector<bool>::difference_type difference_type; + typedef vector<bool>::size_type size_type; VERIFY( vb.max_size() - == (std::numeric_limits<difference_type>::max() - - int(std::_S_word_bit) + 1) ); + == size_type(numeric_limits<difference_type>::max() + - int(_S_word_bit) + 1) ); } int main() diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc index 0c4d0a8c1bd..fbbe7b4f586 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/modifiers/insert/31370.cc @@ -24,6 +24,12 @@ #include <stdexcept> #include <testsuite_hooks.h> +#ifndef _GLIBCXX_DEBUG + using std::_S_word_bit; +#else + using std::_GLIBCXX_STD_D::_S_word_bit; +#endif + inline void check_cap_ge_size(const std::vector<bool>& x) { @@ -62,7 +68,7 @@ void test01() { std::vector<bool> x; x.resize(x.max_size() / 2 + 1, false); - for(int i = 0; i < std::_S_word_bit; ++i) + for(int i = 0; i < _S_word_bit; ++i) x.push_back(false); check_cap_ge_size(x); } @@ -75,7 +81,7 @@ void test01() { std::vector<bool> x; x.resize(x.max_size() / 2 + 1, false); - x.insert(x.end(), std::_S_word_bit, false); + x.insert(x.end(), _S_word_bit, false); check_cap_ge_size(x); } catch(std::bad_alloc&) @@ -87,7 +93,7 @@ void test01() { std::vector<bool> x; x.resize(x.max_size() / 2 + 1, false); - std::vector<bool> y(std::_S_word_bit, false); + std::vector<bool> y(_S_word_bit, false); x.insert(x.end(), y.begin(), y.end()); check_cap_ge_size(x); } @@ -101,8 +107,8 @@ void test01() try { std::vector<bool> x; - x.resize(x.max_size() - std::_S_word_bit, false); - for(int i = 0; i < std::_S_word_bit; ++i) + x.resize(x.max_size() - _S_word_bit, false); + for(int i = 0; i < _S_word_bit; ++i) x.push_back(false); check_cap_ge_size(x); } @@ -114,8 +120,8 @@ void test01() try { std::vector<bool> x; - x.resize(x.max_size() - std::_S_word_bit, false); - x.insert(x.end(), std::_S_word_bit, false); + x.resize(x.max_size() - _S_word_bit, false); + x.insert(x.end(), _S_word_bit, false); check_cap_ge_size(x); } catch(std::bad_alloc&) @@ -126,8 +132,8 @@ void test01() try { std::vector<bool> x; - x.resize(x.max_size() - std::_S_word_bit, false); - std::vector<bool> y(std::_S_word_bit, false); + x.resize(x.max_size() - _S_word_bit, false); + std::vector<bool> y(_S_word_bit, false); x.insert(x.end(), y.begin(), y.end()); check_cap_ge_size(x); } @@ -141,8 +147,8 @@ void test01() try { std::vector<bool> x; - x.resize(x.max_size() - std::_S_word_bit, false); - for(int i = 0; i < std::_S_word_bit + 1; ++i) + x.resize(x.max_size() - _S_word_bit, false); + for(int i = 0; i < _S_word_bit + 1; ++i) x.push_back(false); ++myexit; } @@ -156,8 +162,8 @@ void test01() try { std::vector<bool> x; - x.resize(x.max_size() - std::_S_word_bit, false); - x.insert(x.end(), std::_S_word_bit + 1, false); + x.resize(x.max_size() - _S_word_bit, false); + x.insert(x.end(), _S_word_bit + 1, false); ++myexit; } catch(std::bad_alloc) @@ -170,8 +176,8 @@ void test01() try { std::vector<bool> x; - x.resize(x.max_size() - std::_S_word_bit, false); - std::vector<bool> y(std::_S_word_bit + 1, false); + x.resize(x.max_size() - _S_word_bit, false); + std::vector<bool> y(_S_word_bit + 1, false); x.insert(x.end(), y.begin(), y.end()); ++myexit; } diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc new file mode 100644 index 00000000000..a6ebd177a03 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <vector> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector<bool> vb(7); + VERIFY( vb.cbegin() == vb.begin() ); + VERIFY( vb.cend() == vb.end() ); + VERIFY( vb.crbegin() == vb.rbegin() ); + VERIFY( vb.crend() == vb.rend() ); + VERIFY( vb.cbegin() != vb.cend() ); + VERIFY( vb.crbegin() != vb.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/reserve/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/reserve/moveable.cc new file mode 100644 index 00000000000..481247f38f7 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/reserve/moveable.cc @@ -0,0 +1,56 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-28 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <vector> +#include <testsuite_hooks.h> +#include <testsuite_rvalref.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace __gnu_test; + + std::vector<copycounter> a(40); + copycounter::copycount = 0; + + a.reserve(50); + VERIFY( copycounter::copycount == 0 ); + + a.reserve(200); + VERIFY( copycounter::copycount == 0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc new file mode 100644 index 00000000000..688423e39b3 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/cons/moveable.cc @@ -0,0 +1,64 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <vector> +#include <iterator> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using namespace __gnu_test; +typedef std::vector<rvalstruct> test_type; + +// Empty constructor doesn't require a copy constructor +void +test01() +{ test_type d; } + +// Constructing from a range that returns rvalue references doesn't +// require a copy constructor. +void +test02(rvalstruct* begin, rvalstruct* end) +{ + test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +} + +// Constructing from a input iterator range that returns rvalue +// references doesn't require a copy constructor either. +void +test03(input_iterator_wrapper<rvalstruct> begin, + input_iterator_wrapper<rvalstruct> end) +{ + test_type d(std::make_move_iterator(begin), std::make_move_iterator(end)); +} + +// Neither does destroying one. +void +test04(test_type* d) +{ delete d; } diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/moveable.cc new file mode 100644 index 00000000000..39e1ea26219 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/erase/moveable.cc @@ -0,0 +1,71 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-28 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <vector> +#include <testsuite_hooks.h> +#include <testsuite_rvalref.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + using namespace __gnu_test; + + std::vector<copycounter> a(40); + copycounter::copycount = 0; + + a.erase(a.begin() + 20); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.begin()); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.end() - 1); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.begin() + 10, a.end() - 10); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.begin(), a.begin() + 5); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.end() - 5, a.end()); + VERIFY( copycounter::copycount == 0 ); + + a.erase(a.begin(), a.end()); + VERIFY( copycounter::copycount == 0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/modifiers/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/modifiers/moveable.cc new file mode 100644 index 00000000000..15adafc2671 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/modifiers/moveable.cc @@ -0,0 +1,146 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <vector> +#include <testsuite_hooks.h> +#include <testsuite_rvalref.h> + +using namespace __gnu_test; + +// Test vector::push_back makes no unneeded copies. +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector<copycounter> a; + copycounter c(1); + copycounter::copycount = 0; + for(int i = 0; i < 10; ++i) + a.push_back(c); + VERIFY(copycounter::copycount == 10); + + for(int i = 0; i < 100; ++i) + a.insert(a.begin() + i, c); + VERIFY(copycounter::copycount == 110); + + for(int i = 0; i < 1000; ++i) + a.insert(a.end(), c); + VERIFY(copycounter::copycount == 1110); +} + +// Test vector::insert(iterator, iterator, iterator) makes no unneeded copies +// when it has to also reallocate the vector's internal buffer. +void +test02() +{ + bool test __attribute__((unused)) = true; + + copycounter c(1); + std::vector<copycounter> a(10, c), b(100, c); + copycounter::copycount = 0; + a.insert(a.begin(), b.begin(), b.begin() + 20); + VERIFY(copycounter::copycount == 20); + a.insert(a.end(), b.begin(), b.begin() + 50); + VERIFY(copycounter::copycount == 70); + a.insert(a.begin() + 50, b.begin(), b.end()); + VERIFY(copycounter::copycount == 170); +} + +// Test vector::insert(iterator, iterator, iterator) makes no unneeded copies +// when it doesn't have to reallocate the vector's internal buffer. +void +test03() +{ + bool test __attribute__((unused)) = true; + + copycounter c(1); + std::vector<copycounter> a(10, c), b(100, c); + copycounter::copycount = 0; + a.reserve(1000); + VERIFY(copycounter::copycount == 0); + a.insert(a.begin(), b.begin(), b.begin() + 20); + VERIFY(copycounter::copycount == 20); + a.insert(a.end(), b.begin(), b.begin() + 50); + VERIFY(copycounter::copycount == 70); + a.insert(a.begin() + 50, b.begin(), b.end()); + VERIFY(copycounter::copycount == 170); +} + +// Test vector::insert(iterator, count, value) makes no unneeded copies +// when it has to also reallocate the vector's internal buffer. +void +test04() +{ + bool test __attribute__((unused)) = true; + + copycounter c(1); + std::vector<copycounter> a(10, c); + copycounter::copycount = 0; + a.insert(a.begin(), 20, c); + VERIFY(copycounter::copycount == 20 + 1); + a.insert(a.end(), 50, c); + VERIFY(copycounter::copycount == 70 + 2); + a.insert(a.begin() + 50, 100, c); + VERIFY(copycounter::copycount == 170 + 3); +} + +// Test vector::insert(iterator, count, value) makes no unneeded copies +// when it doesn't have to reallocate the vector's internal buffer. +void +test05() +{ + bool test __attribute__((unused)) = true; + + copycounter c(1); + std::vector<copycounter> a(10, c); + copycounter::copycount = 0; + a.reserve(1000); + a.insert(a.begin(), 20, c); + // NOTE : These values are each one higher than might be expected, as + // vector::insert(iterator, count, value) copies the value it is given + // when it doesn't reallocate the buffer. + VERIFY(copycounter::copycount == 20 + 1); + a.insert(a.end(), 50, c); + VERIFY(copycounter::copycount == 70 + 2); + a.insert(a.begin() + 50, 100, c); + VERIFY(copycounter::copycount == 170 + 3); +} + + + +int main() +{ + test01(); + test02(); + test03(); + test04(); + test05(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/moveable.cc new file mode 100644 index 00000000000..df825f3d007 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/moveable.cc @@ -0,0 +1,71 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on vector (via swap). If the implementation changed +// this test may begin to fail. + +#include <vector> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::vector<int> a,b; + a.push_back(1); + b = std::move(a); + VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 ); + + std::vector<int> c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == 1 ); + VERIFY( b.size() == 0 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + + std::vector<bool> a,b; + a.push_back(1); + b = std::move(a); + VERIFY( b.size() == 1 && b[0] == 1 && a.size() == 0 ); + + std::vector<bool> c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == 1 ); + VERIFY( b.size() == 0 ); +} + +int main(void) +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc new file mode 100644 index 00000000000..99753389c29 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <vector> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector<int> v(7); + VERIFY( v.cbegin() == v.begin() ); + VERIFY( v.cend() == v.end() ); + VERIFY( v.crbegin() == v.rbegin() ); + VERIFY( v.crend() == v.rend() ); + VERIFY( v.cbegin() != v.cend() ); + VERIFY( v.crbegin() != v.crend() ); +} + +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 609511f07ce..eb6aa1f0b6b 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 @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 847 } +// { dg-error "no matching" "" { target *-*-* } 992 } // { 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 12aa0aea695..6e65a5e8092 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 @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 787 } +// { dg-error "no matching" "" { target *-*-* } 932 } // { 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 1dd8d305e2e..dce05ed2cf9 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 @@ -1,6 +1,6 @@ // 2007-04-27 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2007 Free Software Foundation +// Copyright (C) 2007, 2008 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 787 } +// { dg-error "no matching" "" { target *-*-* } 932 } // { 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 707776debc9..3df2fc8b745 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 @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 888 } +// { dg-error "no matching" "" { target *-*-* } 1033 } // { dg-excess-errors "" } #include <vector> diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/2.cc index 0a48971380e..4bc1c79c066 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/2.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/explicit_instantiation/2.cc @@ -29,6 +29,7 @@ #include <vector> #include <testsuite_hooks.h> +#include <testsuite_api.h> // { dg-do compile } diff --git a/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc new file mode 100644 index 00000000000..f4dbc19da41 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc @@ -0,0 +1,84 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2006, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#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() +{ + bool test __attribute__((unused)) = true; + + std::vector<copycounter> a; + copycounter::copycount = 0; + a.resize(10); + a.resize(98); + a.resize(99); + a.resize(100); +#ifndef _GLIBCXX_DEBUG + VERIFY( copycounter::copycount == 100 + 4 ); +#else + VERIFY( copycounter::copycount == 100 + 4 + 4 ); +#endif + a.resize(99); + a.resize(0); +#ifndef _GLIBCXX_DEBUG + VERIFY( copycounter::copycount == 100 + 4 ); +#else + VERIFY( copycounter::copycount == 100 + 4 + 6 ); +#endif + a.resize(100); +#ifndef _GLIBCXX_DEBUG + VERIFY( copycounter::copycount == 200 + 5 ); +#else + VERIFY( copycounter::copycount == 200 + 5 + 7 ); +#endif + a.clear(); +#ifndef _GLIBCXX_DEBUG + VERIFY( copycounter::copycount == 200 + 5 ); +#else + VERIFY( copycounter::copycount == 200 + 5 + 7 ); +#endif +} + + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc b/libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc new file mode 100644 index 00000000000..2b312673555 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc @@ -0,0 +1,77 @@ +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. +// +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <vector> +#include <cstdlib> +#include <testsuite_hooks.h> + +unsigned int zero_sized_news = 0; + +void *operator new(size_t size) throw (std::bad_alloc) +{ + /* malloc(0) is unpredictable; avoid it. */ + if (size == 0) + { + size = 1; + ++zero_sized_news; + } + + void *p = std::malloc(size); + + if (p == 0) + throw std::bad_alloc(); + + return p; +} + +void operator delete(void *ptr) throw() +{ + if (ptr != 0) + std::free(ptr); +} + +// http://gcc.gnu.org/ml/libstdc++/2007-09/msg00006.html +void test01() +{ + bool test __attribute__((unused)) = true; + + std::vector<std::vector<int> > *v; + VERIFY( zero_sized_news == 0 ); + + v = new std::vector<std::vector<int> >; + VERIFY( zero_sized_news == 0 ); + + v->resize(10); + delete(v); + VERIFY( zero_sized_news == 0 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/adjacent_find/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/adjacent_find/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..e90c083d801 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/adjacent_find/requirements/explicit_instantiation/2.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type adjacent_find(iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/adjacent_find/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/adjacent_find/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..5612b7e30a5 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/adjacent_find/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type adjacent_find(iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/binary_search/2.cc b/libstdc++-v3/testsuite/25_algorithms/binary_search/2.cc new file mode 100644 index 00000000000..24c1d876245 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/binary_search/2.cc @@ -0,0 +1,64 @@ +// Copyright (C) 2001, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.3 [lib.alg.binary.search] Binary search algorithms. + +#include <algorithm> +#include <testsuite_hooks.h> + +bool test __attribute__((unused)) = true; + +const int A[] = {1, 2, 3, 3, 3, 5, 8}; +const int C[] = {8, 5, 3, 3, 3, 2, 1}; +const int N = sizeof(A) / sizeof(int); + +// A comparison, equalivalent to std::greater<int> without the +// dependency on <functional>. +struct gt +{ + bool + operator()(const int& x, const int& y) const + { return x > y; } +}; + +// 25.3.3.4 binary_search, with and without comparison predicate +void +test04() +{ + using std::binary_search; + + const int first = A[0]; + const int last = A[N - 1]; + + VERIFY(binary_search(A, A + N, 5)); + VERIFY(binary_search(A, A + N, first)); + VERIFY(binary_search(A, A + N, last)); + VERIFY(!binary_search(A, A + N, 4)); + + VERIFY(binary_search(C, C + N, 5, gt())); + VERIFY(binary_search(C, C + N, first, gt())); + VERIFY(binary_search(C, C + N, last, gt())); + VERIFY(!binary_search(C, C + N, 4, gt())); +} + +int +main() +{ + test04(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/binary_search/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/binary_search/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..0c9b5db1987 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/binary_search/requirements/explicit_instantiation/2.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool binary_search(iterator_type, iterator_type, const value_type&); + + template bool binary_search(iterator_type, iterator_type, + const value_type&, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/binary_search/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/binary_search/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..d8a40b68f22 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/binary_search/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool binary_search(iterator_type, iterator_type, const value_type&); + + template bool binary_search(iterator_type, iterator_type, + const value_type&, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/34595.cc b/libstdc++-v3/testsuite/25_algorithms/copy/34595.cc new file mode 100644 index 00000000000..85bef554dd9 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy/34595.cc @@ -0,0 +1,55 @@ +// Copyright (C) 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.2.1 [lib.alg.copy] Copy. + +#include <algorithm> +#include <testsuite_hooks.h> + +class Counting_output_iterator +: public std::iterator< std::output_iterator_tag, void, void, void, void > +{ + std::size_t c; +public: + Counting_output_iterator() : c(0) {} + Counting_output_iterator& operator++() { return *this; } + Counting_output_iterator& operator*() { return *this; } + + template <typename T> + void operator=(const T&) { ++c; } + + std::size_t current_counter() const { return c; } +}; + +// libstdc++/34595 +void test01() +{ + bool test __attribute__((unused)) = true; + + int t[10] = {0,}; + Counting_output_iterator cnt; + std::size_t res = std::copy(t+0, t+5, cnt).current_counter(); + + VERIFY( res == 5 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/1.cc b/libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/1.cc new file mode 100644 index 00000000000..c8f349435cb --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy/move_iterators/1.cc @@ -0,0 +1,66 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#undef _GLIBCXX_CONCEPT_CHECKS +#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + +#include <algorithm> +#include <iterator> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::input_iterator_wrapper; +using __gnu_test::output_iterator_wrapper; +using __gnu_test::rvalstruct; +using std::copy; + +typedef test_container<rvalstruct, input_iterator_wrapper> container_in; +typedef test_container<rvalstruct, output_iterator_wrapper> container_out; + +void test01() +{ + bool test __attribute__((unused)) = true; + + int inarray[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + const int size = sizeof(inarray) / sizeof(int); + + rvalstruct in[size], out[size]; + std::copy(inarray, inarray + size, in); + + container_in incon(in, in + size); + container_out outcon(out, out + size); + + copy(std::move_iterator<input_iterator_wrapper<rvalstruct> >(incon.begin()), + std::move_iterator<input_iterator_wrapper<rvalstruct> >(incon.end()), + outcon.begin()); + VERIFY( std::equal(out, out + size, inarray) ); + for (int z = 0; z < size; ++z) + VERIFY( out[z].valid ); + for (int z = 0; z < size; ++z) + VERIFY( !in[z].valid ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/copy/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..e4dc282e577 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy/requirements/explicit_instantiation/2.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type copy(iterator_type, iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/copy/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..f5dda9e3bfd --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type copy(iterator_type, iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc b/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc index 378583ac83c..5e838f324e1 100644 --- a/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc +++ b/libstdc++-v3/testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc @@ -24,6 +24,8 @@ #include <cstring> #include <testsuite_hooks.h> +// { dg-require-fileio "" } + // In the occasion of libstdc++/25482 void test01() { diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/1.cc b/libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/1.cc new file mode 100644 index 00000000000..e99b9e78f0e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_backward/move_iterators/1.cc @@ -0,0 +1,68 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#undef _GLIBCXX_CONCEPT_CHECKS +#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + +#include <algorithm> +#include <iterator> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::bidirectional_iterator_wrapper; +using __gnu_test::rvalstruct; +using std::copy_backward; + +typedef test_container<rvalstruct, + bidirectional_iterator_wrapper> container_in; +typedef test_container<rvalstruct, + bidirectional_iterator_wrapper> container_out; + +void test01() +{ + bool test __attribute__((unused)) = true; + + int inarray[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + const int size = sizeof(inarray) / sizeof(int); + + rvalstruct in[size], out[size]; + std::copy(inarray, inarray + size, in); + std::fill(out, out + size, 0); + + container_in incon(in, in + size); + container_out outcon(out, out + size); + + copy_backward(std::move_iterator<bidirectional_iterator_wrapper<rvalstruct> >(incon.begin()), + std::move_iterator<bidirectional_iterator_wrapper<rvalstruct> >(incon.end()), + outcon.end()); + VERIFY( std::equal(out, out + size, inarray) ); + for (int z = 0; z < size; ++z) + VERIFY( out[z].valid ); + for (int z = 0; z < size; ++z) + VERIFY( !in[z].valid ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_backward/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/copy_backward/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..d569a07dc1c --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_backward/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef unsigned short size_type; + + template iterator_type copy_backward(iterator_type, iterator_type, + iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_backward/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/copy_backward/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..593bf46c147 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_backward/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef unsigned short size_type; + + template iterator_type copy_backward(iterator_type, iterator_type, + iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/count/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/count/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..604ab5341bf --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/count/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef iterator_traits<iterator_type>::difference_type difference_type; + + template difference_type count(iterator_type, iterator_type, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/count/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/count/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..90a0133f3b7 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/count/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef iterator_traits<iterator_type>::difference_type difference_type; + + template difference_type count(iterator_type, iterator_type, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/count_if/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/count_if/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..434a3e822f6 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/count_if/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::iterator_traits<iterator_type>::difference_type difference_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template difference_type count_if(iterator_type, iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/count_if/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/count_if/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..9d9ae79745f --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/count_if/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::iterator_traits<iterator_type>::difference_type difference_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template difference_type count_if(iterator_type, iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/equal/equal.cc b/libstdc++-v3/testsuite/25_algorithms/equal/no_operator_ne.cc index 285baa6e211..285baa6e211 100644 --- a/libstdc++-v3/testsuite/25_algorithms/equal/equal.cc +++ b/libstdc++-v3/testsuite/25_algorithms/equal/no_operator_ne.cc diff --git a/libstdc++-v3/testsuite/25_algorithms/equal/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/equal/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..ec35b44d69d --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/equal/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef unsigned short size_type; + + // template void fill_n(iterator_type, size_type, const value_type&); + template iterator_type fill_n(iterator_type, size_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/equal/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/equal/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..bbadf7e9a32 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/equal/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef unsigned short size_type; + + // template void fill_n(iterator_type, size_type, const value_type&); + template iterator_type fill_n(iterator_type, size_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/binary_search.cc b/libstdc++-v3/testsuite/25_algorithms/equal_range/2.cc index 5854f195065..12f2b4e499b 100644 --- a/libstdc++-v3/testsuite/25_algorithms/binary_search.cc +++ b/libstdc++-v3/testsuite/25_algorithms/equal_range/2.cc @@ -29,7 +29,6 @@ const int N = sizeof(A) / sizeof(int); // A comparison, equalivalent to std::greater<int> without the // dependency on <functional>. - struct gt { bool @@ -40,74 +39,6 @@ struct gt // Each test performs general-case, bookend, not-found condition, // and predicate functional checks. -// 25.3.3.1 lower_bound, with and without comparison predicate -void -test01() -{ - using std::lower_bound; - - const int first = A[0]; - const int last = A[N - 1]; - - const int* p = lower_bound(A, A + N, 3); - VERIFY(p == A + 2); - - const int* q = lower_bound(A, A + N, first); - VERIFY(q == A + 0); - - const int* r = lower_bound(A, A + N, last); - VERIFY(r == A + N - 1); - - const int* s = lower_bound(A, A + N, 4); - VERIFY(s == A + 5); - - const int* t = lower_bound(C, C + N, 3, gt()); - VERIFY(t == C + 2); - - const int* u = lower_bound(C, C + N, first, gt()); - VERIFY(u == C + N - 1); - - const int* v = lower_bound(C, C + N, last, gt()); - VERIFY(v == C + 0); - - const int* w = lower_bound(C, C + N, 4, gt()); - VERIFY(w == C + 2); -} - -// 25.3.3.2 upper_bound, with and without comparison predicate -void -test02() -{ - using std::upper_bound; - - const int first = A[0]; - const int last = A[N - 1]; - - const int* p = upper_bound(A, A + N, 3); - VERIFY(p == A + 5); - - const int* q = upper_bound(A, A + N, first); - VERIFY(q == A + 1); - - const int* r = upper_bound(A, A + N, last); - VERIFY(r == A + N); - - const int* s = upper_bound(A, A + N, 4); - VERIFY(s == A + 5); - - const int* t = upper_bound(C, C + N, 3, gt()); - VERIFY(t == C + 5); - - const int* u = upper_bound(C, C + N, first, gt()); - VERIFY(u == C + N); - - const int* v = upper_bound(C, C + N, last, gt()); - VERIFY(v == C + 1); - - const int* w = upper_bound(C, C + N, 4, gt()); - VERIFY(w == C + 2); -} - // 25.3.3.3 equal_range, with and without comparison predicate void test03() @@ -151,33 +82,9 @@ test03() VERIFY(w.second == C + 2); } -// 25.3.3.4 binary_search, with and without comparison predicate -void -test04() -{ - using std::binary_search; - - const int first = A[0]; - const int last = A[N - 1]; - - VERIFY(binary_search(A, A + N, 5)); - VERIFY(binary_search(A, A + N, first)); - VERIFY(binary_search(A, A + N, last)); - VERIFY(!binary_search(A, A + N, 4)); - - VERIFY(binary_search(C, C + N, 5, gt())); - VERIFY(binary_search(C, C + N, first, gt())); - VERIFY(binary_search(C, C + N, last, gt())); - VERIFY(!binary_search(C, C + N, 4, gt())); -} - int main() { - test01(); - test02(); test03(); - test04(); - return 0; } diff --git a/libstdc++-v3/testsuite/25_algorithms/equal_range/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/equal_range/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..88cd1811a56 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/equal_range/requirements/explicit_instantiation/2.cc @@ -0,0 +1,51 @@ + +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pair<iterator_type, iterator_type> pair_type; + typedef std::less<value_type> compare_type; + + template pair_type equal_range(iterator_type, iterator_type, + const value_type&); + + template pair_type equal_range(iterator_type, iterator_type, + const value_type&, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/equal_range/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/equal_range/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..709b3125669 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/equal_range/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,50 @@ + +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pair<iterator_type, iterator_type> pair_type; + typedef std::less<value_type> compare_type; + + template pair_type equal_range(iterator_type, iterator_type, + const value_type&); + + template pair_type equal_range(iterator_type, iterator_type, + const value_type&, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/fill/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/fill/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..4b5b8725680 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/fill/requirements/explicit_instantiation/2.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template void fill(iterator_type, iterator_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/fill/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/fill/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..c3650b94354 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/fill/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template void fill(iterator_type, iterator_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/fill_n/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/fill_n/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..ec35b44d69d --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/fill_n/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef unsigned short size_type; + + // template void fill_n(iterator_type, size_type, const value_type&); + template iterator_type fill_n(iterator_type, size_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/fill_n/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/fill_n/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..bbadf7e9a32 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/fill_n/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef unsigned short size_type; + + // template void fill_n(iterator_type, size_type, const value_type&); + template iterator_type fill_n(iterator_type, size_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc b/libstdc++-v3/testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc index 682c515683e..4e815426c3c 100644 --- a/libstdc++-v3/testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc +++ b/libstdc++-v3/testsuite/25_algorithms/find/istreambuf_iterators/char/2.cc @@ -23,6 +23,8 @@ #include <algorithm> #include <testsuite_hooks.h> +// { dg-require-fileio "" } + // In the occasion of libstdc++/25482 void test01() { diff --git a/libstdc++-v3/testsuite/25_algorithms/find/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/find/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..b7d7e65645f --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/find/requirements/explicit_instantiation/2.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type find(iterator_type, iterator_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/find/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/find/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..07d8069efdc --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/find/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type find(iterator_type, iterator_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/find_end/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/find_end/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..8e4c3e6dc70 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/find_end/requirements/explicit_instantiation/2.cc @@ -0,0 +1,50 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type; + + template iterator_type find_end(iterator_type, iterator_type, + iterator_type, iterator_type); + + template iterator_type find_end(iterator_type, iterator_type, + iterator_type, iterator_type, + predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/find_end/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/find_end/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..ed7ea1760af --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/find_end/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type; + + template iterator_type find_end(iterator_type, iterator_type, + iterator_type, iterator_type); + + template iterator_type find_end(iterator_type, iterator_type, + iterator_type, iterator_type, + predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/find_first_of/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/find_first_of/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..c675764085e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/find_first_of/requirements/explicit_instantiation/2.cc @@ -0,0 +1,50 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type; + + template iterator_type find_first_of(iterator_type, iterator_type, + iterator_type, iterator_type); + + template iterator_type find_first_of(iterator_type, iterator_type, + iterator_type, iterator_type, + predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/find_first_of/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/find_first_of/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..bdaaeff1470 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/find_first_of/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type; + + template iterator_type find_first_of(iterator_type, iterator_type, + iterator_type, iterator_type); + + template iterator_type find_first_of(iterator_type, iterator_type, + iterator_type, iterator_type, + predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/find_if/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/find_if/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..5ad6189c573 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/find_if/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type find_if(iterator_type, iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/find_if/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/find_if/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..ed4aa30707d --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/find_if/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type find_if(iterator_type, iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/for_each/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/for_each/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..803074ceda0 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/for_each/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, void> function_type; + + template function_type for_each(iterator_type, iterator_type, + function_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/for_each/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/for_each/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..b38dc0bca83 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/for_each/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, void> function_type; + + template function_type for_each(iterator_type, iterator_type, + function_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/generate/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/generate/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..0fb3707f139 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/generate/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + using __gnu_test::void_function; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef void_function<value_type> generator_type; + + template void generate(iterator_type, iterator_type, generator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/generate/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/generate/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..62d2a511c26 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/generate/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::pod_int; + using __gnu_test::void_function; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef void_function<value_type> generator_type; + + template void generate(iterator_type, iterator_type, generator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/generate_n/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/generate_n/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..2cc64b72fdd --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/generate_n/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + using __gnu_test::void_function; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef unsigned short size_type; + typedef void_function<value_type> generator_type; + + template iterator_type generate_n(iterator_type, size_type, generator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/generate_n/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/generate_n/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..b8da1e9306a --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/generate_n/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::pod_int; + using __gnu_test::void_function; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef unsigned short size_type; + typedef void_function<value_type> generator_type; + + template iterator_type generate_n(iterator_type, size_type, generator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/algorithm_parallel_mode.cc b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/algorithm_parallel_mode.cc new file mode 100644 index 00000000000..c2e56c2bd35 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/algorithm_parallel_mode.cc @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-D_GLIBCXX_PARALLEL -fopenmp" { target *-*-* } } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> diff --git a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm.cc b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm.cc new file mode 100644 index 00000000000..90e02796263 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm.cc @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-fopenmp" { target *-*-* } } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <parallel/algorithm> diff --git a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm_mixed1.cc b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm_mixed1.cc new file mode 100644 index 00000000000..c6c4ce2ff43 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm_mixed1.cc @@ -0,0 +1,37 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-fopenmp" { target *-*-* } } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <parallel/algorithm> +#include <vector> +#include <algorithm> + +void test() +{ + typedef unsigned short value_type; + typedef std::vector<value_type> vector_type; + + const value_type c(0); + + vector_type v(10); + std::find(v.begin(), v.end(), c); + __gnu_parallel::find(v.begin(), v.end(), c); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm_mixed2.cc b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm_mixed2.cc new file mode 100644 index 00000000000..94794d46c9f --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/parallel_algorithm_mixed2.cc @@ -0,0 +1,42 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-fopenmp" { target *-*-* } } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Make sure to test without _GLIBCXX_PARALLEL +#ifdef _GLIBCXX_PARALLEL +# undef _GLIBCXX_PARALLEL +#endif + +#include <parallel/algorithm> +#include <vector> +#include <algorithm> + +void test() +{ + typedef unsigned short value_type; + typedef std::vector<value_type> vector_type; + + const value_type c(0); + + vector_type v(10); + std::find(v.begin(), v.end(), c); + __gnu_parallel::find(v.begin(), v.end(), c); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc index 032fa31efec..4939ebf0bd1 100644 --- a/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc +++ b/libstdc++-v3/testsuite/25_algorithms/headers/algorithm/synopsis.cc @@ -20,385 +20,494 @@ #include <algorithm> -namespace std { +namespace std + { // 25.1, non-modifying sequence operations: - template<class InputIterator, class Function> - Function for_each(InputIterator first, InputIterator last, Function f); - template<class InputIterator, class T> - InputIterator find(InputIterator first, InputIterator last, - const T& value); - template<class InputIterator, class Predicate> - InputIterator find_if(InputIterator first, InputIterator last, - Predicate pred); - template<class ForwardIterator1, class ForwardIterator2> - ForwardIterator1 - find_end(ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2); - template<class ForwardIterator1, class ForwardIterator2, - class BinaryPredicate> - ForwardIterator1 - find_end(ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - BinaryPredicate pred); - template<class ForwardIterator1, class ForwardIterator2> - ForwardIterator1 - find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2); - template<class ForwardIterator1, class ForwardIterator2, - class BinaryPredicate> - ForwardIterator1 - find_first_of(ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - BinaryPredicate pred); - -template<class ForwardIterator> - ForwardIterator adjacent_find(ForwardIterator first, - ForwardIterator last); - -template<class ForwardIterator, class BinaryPredicate> - ForwardIterator adjacent_find(ForwardIterator first, - ForwardIterator last, BinaryPredicate pred); - -template<class InputIterator, class T> - typename iterator_traits<InputIterator>::difference_type - count(InputIterator first, InputIterator last, const T& value); - -template<class InputIterator, class Predicate> - typename iterator_traits<InputIterator>::difference_type - count_if(InputIterator first, InputIterator last, Predicate pred); -template<class InputIterator1, class InputIterator2> - pair<InputIterator1, InputIterator2> - mismatch(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2); -template - <class InputIterator1, class InputIterator2, class BinaryPredicate> - pair<InputIterator1, InputIterator2> - mismatch(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, BinaryPredicate pred); -template<class InputIterator1, class InputIterator2> - bool equal(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2); -template - <class InputIterator1, class InputIterator2, class BinaryPredicate> - bool equal(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, BinaryPredicate pred); - -template<class ForwardIterator1, class ForwardIterator2> - ForwardIterator1 search - (ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2); - -template<class ForwardIterator1, class ForwardIterator2, - class BinaryPredicate> - ForwardIterator1 search - (ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - BinaryPredicate pred); - -template<class ForwardIterator, class Size, class T> - ForwardIterator search_n(ForwardIterator first, ForwardIterator last, - Size count, const T& value); - -template <class ForwardIterator, class Size, class T, class BinaryPredicate> - ForwardIterator search_n(ForwardIterator first, ForwardIterator last, - Size count, const T& value, - BinaryPredicate pred); - -// 25.2, modifying sequence operations: -// 25.2.1, copy: -template<class InputIterator, class OutputIterator> - OutputIterator copy(InputIterator first, InputIterator last, - OutputIterator result); -template<class BidirectionalIterator1, class BidirectionalIterator2> - BidirectionalIterator2 - copy_backward - (BidirectionalIterator1 first, BidirectionalIterator1 last, - BidirectionalIterator2 result); -// 25.2.2, swap: -template<class T> void swap(T& a, T& b); -template<class ForwardIterator1, class ForwardIterator2> - ForwardIterator2 swap_ranges(ForwardIterator1 first1, - ForwardIterator1 last1, ForwardIterator2 first2); -template<class ForwardIterator1, class ForwardIterator2> - void iter_swap(ForwardIterator1 a, ForwardIterator2 b); -template<class InputIterator, class OutputIterator, class UnaryOperation> - OutputIterator transform(InputIterator first, InputIterator last, - OutputIterator result, UnaryOperation op); -template<class InputIterator1, class InputIterator2, class OutputIterator, - class BinaryOperation> - OutputIterator transform(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, OutputIterator result, - BinaryOperation binary_op); -template<class ForwardIterator, class T> - void replace(ForwardIterator first, ForwardIterator last, - const T& old_value, const T& new_value); -template<class ForwardIterator, class Predicate, class T> - void replace_if(ForwardIterator first, ForwardIterator last, - Predicate pred, const T& new_value); -template<class InputIterator, class OutputIterator, class T> - OutputIterator replace_copy(InputIterator first, InputIterator last, - OutputIterator result, - const T& old_value, const T& new_value); -template<class Iterator, class OutputIterator, class Predicate, class T> - OutputIterator replace_copy_if(Iterator first, Iterator last, - OutputIterator result, - Predicate pred, const T& new_value); -template<class ForwardIterator, class T> - void fill(ForwardIterator first, ForwardIterator last, const T& value); -template<class OutputIterator, class Size, class T> - void fill_n(OutputIterator first, Size n, const T& value); -template<class ForwardIterator, class Generator> - void generate(ForwardIterator first, ForwardIterator last, - Generator gen); -template<class OutputIterator, class Size, class Generator> - void generate_n(OutputIterator first, Size n, Generator gen); - -template<class ForwardIterator, class T> - ForwardIterator remove(ForwardIterator first, ForwardIterator last, - const T& value); -template<class ForwardIterator, class Predicate> - ForwardIterator remove_if(ForwardIterator first, ForwardIterator last, - Predicate pred); -template<class InputIterator, class OutputIterator, class T> - OutputIterator remove_copy(InputIterator first, InputIterator last, - OutputIterator result, const T& value); -template<class InputIterator, class OutputIterator, class Predicate> - OutputIterator remove_copy_if(InputIterator first, InputIterator last, - OutputIterator result, Predicate pred); -template<class ForwardIterator> - ForwardIterator unique(ForwardIterator first, ForwardIterator last); -template<class ForwardIterator, class BinaryPredicate> - ForwardIterator unique(ForwardIterator first, ForwardIterator last, - BinaryPredicate pred); -template<class InputIterator, class OutputIterator> - OutputIterator unique_copy(InputIterator first, InputIterator last, - OutputIterator result); -template<class InputIterator, class OutputIterator, class BinaryPredicate> - OutputIterator unique_copy(InputIterator first, InputIterator last, - OutputIterator result, BinaryPredicate pred); -template<class BidirectionalIterator> - void reverse(BidirectionalIterator first, BidirectionalIterator last); -template<class BidirectionalIterator, class OutputIterator> - OutputIterator reverse_copy(BidirectionalIterator first, - BidirectionalIterator last, - OutputIterator result); -template<class ForwardIterator> - void rotate(ForwardIterator first, ForwardIterator middle, - ForwardIterator last); -template<class ForwardIterator, class OutputIterator> - OutputIterator rotate_copy - (ForwardIterator first, ForwardIterator middle, - ForwardIterator last, OutputIterator result); -template<class RandomAccessIterator> - void random_shuffle(RandomAccessIterator first, - RandomAccessIterator last); -template<class RandomAccessIterator, class RandomNumberGenerator> - void random_shuffle(RandomAccessIterator first, - RandomAccessIterator last, - RandomNumberGenerator& rand); -// 25.2.12, partitions: -template<class BidirectionalIterator, class Predicate> - BidirectionalIterator partition(BidirectionalIterator first, - BidirectionalIterator last, - Predicate pred); -template<class BidirectionalIterator, class Predicate> - BidirectionalIterator stable_partition(BidirectionalIterator first, - BidirectionalIterator last, - Predicate pred); -// 25.3, sorting and related operations: -// 25.3.1, sorting: -template<class RandomAccessIterator> - void sort(RandomAccessIterator first, RandomAccessIterator last); -template<class RandomAccessIterator, class Compare> - void sort(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); -template<class RandomAccessIterator> - void stable_sort(RandomAccessIterator first, RandomAccessIterator last); -template<class RandomAccessIterator, class Compare> - void stable_sort(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); -template<class RandomAccessIterator> - void partial_sort(RandomAccessIterator first, - RandomAccessIterator middle, - RandomAccessIterator last); -template<class RandomAccessIterator, class Compare> - void partial_sort(RandomAccessIterator first, - RandomAccessIterator middle, - RandomAccessIterator last, Compare comp); -template<class InputIterator, class RandomAccessIterator> - RandomAccessIterator - partial_sort_copy(InputIterator first, InputIterator last, - RandomAccessIterator result_first, - RandomAccessIterator result_last); -template<class InputIterator, class RandomAccessIterator, class Compare> - RandomAccessIterator - partial_sort_copy(InputIterator first, InputIterator last, - RandomAccessIterator result_first, - RandomAccessIterator result_last, - Compare comp); -template<class RandomAccessIterator> - void nth_element(RandomAccessIterator first, RandomAccessIterator nth, - RandomAccessIterator last); -template<class RandomAccessIterator, class Compare> - void nth_element(RandomAccessIterator first, RandomAccessIterator nth, - RandomAccessIterator last, Compare comp); -// 25.3.3, binary search: -template<class ForwardIterator, class T> - ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, - const T& value); -template<class ForwardIterator, class T, class Compare> - ForwardIterator lower_bound(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp); -template<class ForwardIterator, class T> - ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, - const T& value); -template<class ForwardIterator, class T, class Compare> - ForwardIterator upper_bound(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp); -template<class ForwardIterator, class T> - pair<ForwardIterator, ForwardIterator> - equal_range(ForwardIterator first, ForwardIterator last, - const T& value); -template<class ForwardIterator, class T, class Compare> - pair<ForwardIterator, ForwardIterator> - equal_range(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp); -template<class ForwardIterator, class T> - bool binary_search(ForwardIterator first, ForwardIterator last, - const T& value); -template<class ForwardIterator, class T, class Compare> - bool binary_search(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp); -// 25.3.4, merge: -template<class InputIterator1, class InputIterator2, class OutputIterator> - OutputIterator merge(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); -template<class InputIterator1, class InputIterator2, class OutputIterator, - class Compare> - OutputIterator merge(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp); -template<class BidirectionalIterator> - void inplace_merge(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last); -template<class BidirectionalIterator, class Compare> - void inplace_merge(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, Compare comp); -// 25.3.5, set operations: -template<class InputIterator1, class InputIterator2> - bool includes(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); -template<class InputIterator1, class InputIterator2, class Compare> - bool includes - (InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, Compare comp); -template<class InputIterator1, class InputIterator2, class OutputIterator> - OutputIterator set_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); -template<class InputIterator1, class InputIterator2, class OutputIterator, - class Compare> - OutputIterator set_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp); -template<class InputIterator1, class InputIterator2, class OutputIterator> - OutputIterator set_intersection - (InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); -template<class InputIterator1, class InputIterator2, class OutputIterator, - class Compare> - OutputIterator set_intersection - (InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp); -template<class InputIterator1, class InputIterator2, class OutputIterator> - OutputIterator set_difference - (InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); -template<class InputIterator1, class InputIterator2, class OutputIterator, - class Compare> - OutputIterator set_difference - (InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp); -template<class InputIterator1, class InputIterator2, class OutputIterator> - OutputIterator - set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); -template<class InputIterator1, class InputIterator2, class OutputIterator, - class Compare> - OutputIterator - set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp); -// 25.3.6, heap operations: -template<class RandomAccessIterator> - void push_heap(RandomAccessIterator first, RandomAccessIterator last); -template<class RandomAccessIterator, class Compare> - void push_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); -template<class RandomAccessIterator> - void pop_heap(RandomAccessIterator first, RandomAccessIterator last); -template<class RandomAccessIterator, class Compare> - void pop_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); -template<class RandomAccessIterator> - void make_heap(RandomAccessIterator first, RandomAccessIterator last); -template<class RandomAccessIterator, class Compare> - void make_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); -template<class RandomAccessIterator> - void sort_heap(RandomAccessIterator first, RandomAccessIterator last); -template<class RandomAccessIterator, class Compare> - void sort_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); + template<typename _IIter, typename _Funct> + _Funct + for_each(_IIter, _IIter, _Funct); + + template<typename _IIter, typename _Tp> + _IIter + find(_IIter, _IIter, const _Tp&); + + template<typename _IIter, typename _Predicate> + _IIter + find_if(_IIter, _IIter, _Predicate); + + template<typename _FIter1, typename _FIter2> + _FIter1 + find_end(_FIter1, _FIter1, _FIter2, _FIter2); + + template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> + _FIter1 + find_end(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); + + template<typename _FIter1, typename _FIter2> + _FIter1 + find_first_of(_FIter1, _FIter1, _FIter2, _FIter2); + + template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> + _FIter1 + find_first_of(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); + + template<typename _FIter> + _FIter + adjacent_find(_FIter, _FIter); + + template<typename _FIter, typename _BinaryPredicate> + _FIter + adjacent_find(_FIter, _FIter, _BinaryPredicate); + + template<typename _IIter, typename _Tp> + typename iterator_traits<_IIter>::difference_type + count(_IIter, _IIter, const _Tp&); + + template<typename _IIter, typename _Predicate> + typename iterator_traits<_IIter>::difference_type + count_if(_IIter, _IIter, _Predicate); + + template<typename _IIter1, typename _IIter2> + pair<_IIter1, _IIter2> + mismatch(_IIter1, _IIter1, _IIter2); + + template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> + pair<_IIter1, _IIter2> + mismatch(_IIter1, _IIter1, _IIter2, _BinaryPredicate); + + template<typename _IIter1, typename _IIter2> + bool + equal(_IIter1, _IIter1, _IIter2); + + template<typename _IIter1, typename _IIter2, typename _BinaryPredicate> + bool + equal(_IIter1, _IIter1, _IIter2, _BinaryPredicate); + + template<typename _FIter1, typename _FIter2> + _FIter1 + search(_FIter1, _FIter1, _FIter2, _FIter2); + + template<typename _FIter1, typename _FIter2, typename _BinaryPredicate> + _FIter1 + search(_FIter1, _FIter1, _FIter2, _FIter2, _BinaryPredicate); + + template<typename _FIter, typename _Size, typename _Tp> + _FIter + search_n(_FIter, _FIter, _Size, const _Tp&); + + template<typename _FIter, typename _Size, typename _Tp, + typename _BinaryPredicate> + _FIter + search_n(_FIter, _FIter, _Size, const _Tp&, _BinaryPredicate); + + // 25.2, modifying sequence operations: + // 25.2.1, copy: + template<typename _IIter, typename _OIter> + _OIter + copy(_IIter, _IIter, _OIter); + + template<typename _BIter1, typename _BIter2> + _BIter2 + copy_backward (_BIter1, _BIter1, _BIter2); + + // 25.2.2, swap: + template<typename _Tp> + void + swap(_Tp&, _Tp& b); + + template<typename _FIter1, typename _FIter2> + _FIter2 + swap_ranges(_FIter1 first1, _FIter1, _FIter2); + + template<typename _FIter1, typename _FIter2> + void + iter_swap(_FIter1, _FIter2 b); + + template<typename _IIter, typename _OIter, typename _UnaryOperation> + _OIter + transform(_IIter, _IIter, _OIter, _UnaryOperation op); + + template<typename _IIter1, typename _IIter2, typename _OIter, + typename _BinaryOperation> + _OIter + transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation); + + template<typename _FIter, typename _Tp> + void + replace(_FIter, _FIter, const _Tp&, const _Tp&); + + template<typename _FIter, typename _Predicate, typename _Tp> + void + replace_if(_FIter, _FIter, _Predicate, const _Tp&); + + template<typename _IIter, typename _OIter, typename _Tp> + _OIter + replace_copy(_IIter, _IIter, _OIter, const _Tp&, const _Tp&); + + template<typename _Iter, typename _OIter, typename _Predicate, typename _Tp> + _OIter + replace_copy_if(_Iter, _Iter, _OIter, _Predicate, const _Tp&); + + template<typename _FIter, typename _Tp> + void + fill(_FIter, _FIter, const _Tp&); + + template<typename _OIter, typename _Size, typename _Tp> + void + fill_n(_OIter, _Size n, const _Tp&); + + template<typename _FIter, typename _Generator> + void + generate(_FIter, _FIter, _Generator); + + template<typename _OIter, typename _Size, typename _Generator> + void + generate_n(_OIter, _Size, _Generator); + + template<typename _FIter, typename _Tp> + _FIter + remove(_FIter, _FIter, const _Tp&); + + template<typename _FIter, typename _Predicate> + _FIter + remove_if(_FIter, _FIter, _Predicate); + + template<typename _IIter, typename _OIter, typename _Tp> + _OIter + remove_copy(_IIter, _IIter, _OIter, const _Tp&); + + template<typename _IIter, typename _OIter, typename _Predicate> + _OIter + remove_copy_if(_IIter, _IIter, _OIter, _Predicate); + + template<typename _FIter> + _FIter + unique(_FIter, _FIter); + + template<typename _FIter, typename _BinaryPredicate> + _FIter + unique(_FIter, _FIter, _BinaryPredicate); + + template<typename _IIter, typename _OIter> + _OIter + unique_copy(_IIter, _IIter, _OIter); + + template<typename _IIter, typename _OIter, typename _BinaryPredicate> + _OIter + unique_copy(_IIter, _IIter, _OIter, _BinaryPredicate); + + template<typename _BIter> + void + reverse(_BIter, _BIter); + + template<typename _BIter, typename _OIter> + _OIter + reverse_copy(_BIter, _BIter, _OIter); + + template<typename _FIter> + void + rotate(_FIter, _FIter, _FIter); + + template<typename _FIter, typename _OIter> + _OIter + rotate_copy (_FIter, _FIter, _FIter, _OIter); + + template<typename _RAIter> + void + random_shuffle(_RAIter, _RAIter); + + template<typename _RAIter, typename _Generator> + void + random_shuffle(_RAIter, _RAIter, _Generator&); + + // 25.2.12, partitions: + template<typename _BIter, typename _Predicate> + _BIter + partition(_BIter, _BIter, _Predicate); + + template<typename _BIter, typename _Predicate> + _BIter + stable_partition(_BIter, _BIter, _Predicate); + + // 25.3, sorting and related operations: + // 25.3.1, sorting: + template<typename _RAIter> + void + sort(_RAIter, _RAIter); + + template<typename _RAIter, typename _Compare> + void + sort(_RAIter, _RAIter, _Compare); + + template<typename _RAIter> + void + stable_sort(_RAIter, _RAIter); + + template<typename _RAIter, typename _Compare> + void + stable_sort(_RAIter, _RAIter, _Compare); + + template<typename _RAIter> + void + partial_sort(_RAIter, _RAIter, _RAIter); + + template<typename _RAIter, typename _Compare> + void + partial_sort(_RAIter, _RAIter, _RAIter, _Compare); + + template<typename _IIter, typename _RAIter> + _RAIter + partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter); + + template<typename _IIter, typename _RAIter, typename _Compare> + _RAIter + partial_sort_copy(_IIter, _IIter, _RAIter, _RAIter, _Compare); + + template<typename _RAIter> + void + nth_element(_RAIter, _RAIter, _RAIter); + + template<typename _RAIter, typename _Compare> + void + nth_element(_RAIter, _RAIter, _RAIter, _Compare); + + // 25.3.3, binary search: + template<typename _FIter, typename _Tp> + _FIter + lower_bound(_FIter, _FIter, const _Tp&); + + template<typename _FIter, typename _Tp, typename _Compare> + _FIter + lower_bound(_FIter, _FIter, const _Tp&, _Compare); + + template<typename _FIter, typename _Tp> + _FIter + upper_bound(_FIter, _FIter, const _Tp&); + + template<typename _FIter, typename _Tp, typename _Compare> + _FIter + upper_bound(_FIter, _FIter, const _Tp&, _Compare); + + template<typename _FIter, typename _Tp> + pair<_FIter, _FIter> + equal_range(_FIter, _FIter, const _Tp&); + + template<typename _FIter, typename _Tp, typename _Compare> + pair<_FIter, _FIter> + equal_range(_FIter, _FIter, const _Tp&, _Compare); + + template<typename _FIter, typename _Tp> + bool + binary_search(_FIter, _FIter, const _Tp&); + + template<typename _FIter, typename _Tp, typename _Compare> + bool + binary_search(_FIter, _FIter, const _Tp&, _Compare); + + // 25.3.4, merge: + template<typename _IIter1, typename _IIter2, typename _OIter> + _OIter + merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); + + template<typename _IIter1, typename _IIter2, typename _OIter, + typename _Compare> + _OIter + merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); + + template<typename _BIter> + void + inplace_merge(_BIter, _BIter, _BIter); + + template<typename _BIter, typename _Compare> + void + inplace_merge(_BIter, _BIter, _BIter, _Compare); + + // 25.3.5, set operations: + template<typename _IIter1, typename _IIter2> + bool + includes(_IIter1, _IIter1, _IIter2, _IIter2); + + template<typename _IIter1, typename _IIter2, typename _Compare> + bool + includes(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); + + template<typename _IIter1, typename _IIter2, typename _OIter> + _OIter + set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); + + template<typename _IIter1, typename _IIter2, typename _OIter, + typename _Compare> + _OIter + set_union(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); + + template<typename _IIter1, typename _IIter2, typename _OIter> + _OIter + set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); + + template<typename _IIter1, typename _IIter2, typename _OIter, + typename _Compare> + _OIter + set_intersection(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); + + template<typename _IIter1, typename _IIter2, typename _OIter> + _OIter + set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); + + template<typename _IIter1, typename _IIter2, typename _OIter, + typename _Compare> + _OIter + set_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare); + + template<typename _IIter1, typename _IIter2, typename _OIter> + _OIter + set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, _OIter); + + template<typename _IIter1, typename _IIter2, typename _OIter, + typename _Compare> + _OIter + set_symmetric_difference(_IIter1, _IIter1, _IIter2, _IIter2, + _OIter, _Compare); + + // 25.3.6, heap operations: + template<typename _RAIter> + void + push_heap(_RAIter, _RAIter); + + template<typename _RAIter, typename _Compare> + void + push_heap(_RAIter, _RAIter, _Compare); + + template<typename _RAIter> + void + pop_heap(_RAIter, _RAIter); + + template<typename _RAIter, typename _Compare> + void + pop_heap(_RAIter, _RAIter, _Compare); + + template<typename _RAIter> + void + make_heap(_RAIter, _RAIter); + + template<typename _RAIter, typename _Compare> + void + make_heap(_RAIter, _RAIter, _Compare); + + template<typename _RAIter> + void + sort_heap(_RAIter, _RAIter); + + template<typename _RAIter, typename _Compare> + void + sort_heap(_RAIter, _RAIter, _Compare); + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _RAIter> + bool + is_heap(_RAIter, _RAIter); + + template<typename _RAIter, typename _Compare> + bool + is_heap(_RAIter, _RAIter, _Compare); + + template<typename _RAIter> + _RAIter + is_heap_until(_RAIter, _RAIter); + + template<typename _RAIter, typename _Compare> + _RAIter + is_heap_until(_RAIter, _RAIter, _Compare); + + template<typename _FIter> + bool + is_sorted(_FIter, _FIter); + + template<typename _FIter, typename _Compare> + bool + is_sorted(_FIter, _FIter, _Compare); + + template<typename _FIter> + _FIter + is_sorted_until(_FIter, _FIter); + + template<typename _FIter, typename _Compare> + _FIter + is_sorted_until(_FIter, _FIter, _Compare); +#endif // 25.3.7, minimum and maximum: - template<class T> const T& min(const T& a, const T& b); - template<class T, class Compare> - const T& min(const T& a, const T& b, Compare comp); - template<class T> const T& max(const T& a, const T& b); - template<class T, class Compare> - const T& max(const T& a, const T& b, Compare comp); - template<class ForwardIterator> - ForwardIterator min_element - (ForwardIterator first, ForwardIterator last); - template<class ForwardIterator, class Compare> - ForwardIterator min_element(ForwardIterator first, ForwardIterator last, - Compare comp); - template<class ForwardIterator> - ForwardIterator max_element - (ForwardIterator first, ForwardIterator last); - template<class ForwardIterator, class Compare> - ForwardIterator max_element(ForwardIterator first, ForwardIterator last, - Compare comp); - template<class InputIterator1, class InputIterator2> - bool lexicographical_compare - (InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); - template<class InputIterator1, class InputIterator2, class Compare> - bool lexicographical_compare - (InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - Compare comp); + template<typename _Tp> + const _Tp& + min(const _Tp&, const _Tp&); + + template<typename _Tp, typename _Compare> + const _Tp& + min(const _Tp&, const _Tp&, _Compare); + + template<typename _Tp> + const _Tp& + max(const _Tp&, const _Tp&); + + template<typename _Tp, typename _Compare> + const _Tp& + max(const _Tp&, const _Tp&, _Compare); + + template<typename _FIter> + _FIter + min_element(_FIter, _FIter); + + template<typename _FIter, typename _Compare> + _FIter + min_element(_FIter, _FIter, _Compare); + + template<typename _FIter> + _FIter + max_element(_FIter, _FIter); + + template<typename _FIter, typename _Compare> + _FIter + max_element(_FIter, _FIter, _Compare); + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename _Tp> + pair<const _Tp&, const _Tp&> + minmax(const _Tp&, const _Tp&); + + template<typename _Tp, typename _Compare> + pair<const _Tp&, const _Tp&> + minmax(const _Tp&, const _Tp&, _Compare); + + template<typename _FIter> + pair<_FIter, _FIter> + minmax_element(_FIter, _FIter); + + template<typename _FIter, typename _Compare> + pair<_FIter, _FIter> + minmax_element(_FIter, _FIter, _Compare); +#endif + + template<typename _IIter1, typename _IIter2> + bool + lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2); + + template<typename _IIter1, typename _IIter2, typename _Compare> + bool + lexicographical_compare(_IIter1, _IIter1, _IIter2, _IIter2, _Compare); // 25.3.9, permutations - template<class BidirectionalIterator> - bool next_permutation(BidirectionalIterator first, - BidirectionalIterator last); - template<class BidirectionalIterator, class Compare> - bool next_permutation(BidirectionalIterator first, - BidirectionalIterator last, Compare comp); - template<class BidirectionalIterator> - bool prev_permutation(BidirectionalIterator first, - BidirectionalIterator last); - template<class BidirectionalIterator, class Compare> - bool prev_permutation(BidirectionalIterator first, - BidirectionalIterator last, Compare comp); + template<typename _BIter> + bool + next_permutation(_BIter, _BIter); + + template<typename _BIter, typename _Compare> + bool + next_permutation(_BIter, _BIter, _Compare); + + template<typename _BIter> + bool + prev_permutation(_BIter, _BIter); + + template<typename _BIter, typename _Compare> + bool + prev_permutation(_BIter, _BIter, _Compare); } diff --git a/libstdc++-v3/testsuite/25_algorithms/heap/heap.cc b/libstdc++-v3/testsuite/25_algorithms/heap/1.cc index 571a2936ed2..571a2936ed2 100644 --- a/libstdc++-v3/testsuite/25_algorithms/heap/heap.cc +++ b/libstdc++-v3/testsuite/25_algorithms/heap/1.cc diff --git a/libstdc++-v3/testsuite/25_algorithms/heap/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/heap/moveable.cc new file mode 100644 index 00000000000..ee04793e66e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/heap/moveable.cc @@ -0,0 +1,141 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.3.6 Heap operations [lib.alg.heap.operations] + +#undef _GLIBCXX_CONCEPT_CHECKS +#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + +#include <algorithm> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::random_access_iterator_wrapper; +using __gnu_test::rvalstruct; + +typedef test_container<rvalstruct, random_access_iterator_wrapper> container; +typedef test_container<int, random_access_iterator_wrapper> container_ref; + +bool test __attribute__((unused)) = true; + +void +check_make(int* array, int length) +{ + rvalstruct makeheap[9]; + int makeheap_ref[9]; + std::copy(array, array + length, makeheap); + std::copy(array, array + length, makeheap_ref); + container makecon(makeheap, makeheap + length); + container_ref makecon_ref(makeheap_ref, makeheap_ref + length); + std::make_heap(makecon.begin(), makecon.end()); + std::make_heap(makecon_ref.begin(), makecon_ref.end()); + for (int z = 0; z < length; ++z) + VERIFY( makeheap[z] == makeheap_ref[z] ); + VERIFY( std::__is_heap(makecon.begin(), makecon.end()) ); + for (int z = 0; z < length; ++z) + VERIFY( makeheap[z].valid ); +} + +void +check_pop(int* array, int length) +{ + rvalstruct popheap[9]; + int popheap_ref[9]; + std::copy(array, array + length, popheap); + std::copy(array, array + length, popheap_ref); + container popcon(popheap, popheap + length); + container_ref popcon_ref(popheap_ref, popheap_ref + length); + std::pop_heap(popcon.begin(), popcon.end()); + std::pop_heap(popcon_ref.begin(), popcon_ref.end()); + for (int z = 0; z < length; ++z) + VERIFY( popheap[z] == popheap_ref[z] ); + VERIFY( (std::__is_heap(popheap, popheap + length - 1)) ); + for (int z = 0; z < length; ++z) + VERIFY( popheap[z].val <= popheap[length-1].val && popheap[z].valid ); +} + +void +check_sort(int* array, int length) +{ + rvalstruct sortheap[9]; + int sortheap_ref[9]; + std::copy(array, array + length, sortheap); + std::copy(array, array + length, sortheap_ref); + container sortcon(sortheap, sortheap + length); + container_ref sortcon_ref(sortheap_ref, sortheap_ref + length); + std::sort_heap(sortcon.begin(), sortcon.end()); + std::sort_heap(sortcon_ref.begin(), sortcon_ref.end()); + for (int z = 0; z < length; ++z) + VERIFY( sortheap[z] == sortheap_ref[z] ); + for (int z = 0; z < length - 1; ++z) + VERIFY( sortheap[z].val <= sortheap[z + 1].val && sortheap[z].valid ); + VERIFY( sortheap[length - 1].valid ); +} + +void +check_push(int* array, int pushval, int length) +{ + rvalstruct pushheap[10]; + int pushheap_ref[10]; + std::copy(array, array + length, pushheap); + std::copy(array, array + length, pushheap_ref); + pushheap[length] = pushval; + pushheap_ref[length] = pushval; + container pushcon(pushheap, pushheap + length + 1); + container_ref pushcon_ref(pushheap_ref, pushheap_ref + length + 1); + std::push_heap(pushcon.begin(), pushcon.end()); + std::push_heap(pushcon_ref.begin(), pushcon_ref.end()); + for (int z = 0; z < length + 1; ++z) + VERIFY( pushheap[z] == pushheap_ref[z] ); + VERIFY( std::__is_heap(pushheap, pushheap + length + 1) ); + for (int z = 0; z < length + 1; ++z) + VERIFY( pushheap[z].valid ); +} + +void +test01() +{ + int array[9]; + for (int i = 1; i < 9; ++i) + { + for(int z = 0; z < i; ++z) + array[z] = z; + while (std::next_permutation(array, array + i)) + { + check_make(array, i); + if (std::__is_heap(array, array + i)) + { + check_pop(array, i); + check_sort(array, i); + for (int pushval = -1; pushval <= i; ++pushval) + check_push(array, pushval, i); + } + } + } +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/includes/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/includes/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..e4dbe43aa8c --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/includes/requirements/explicit_instantiation/2.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool includes(iterator_type, iterator_type, iterator_type, + iterator_type); + + template bool includes(iterator_type, iterator_type, iterator_type, + iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/includes/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/includes/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..1319637850e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/includes/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool includes(iterator_type, iterator_type, iterator_type, + iterator_type); + + template bool includes(iterator_type, iterator_type, iterator_type, + iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/inplace_merge/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/inplace_merge/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..c71c3e221b5 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/inplace_merge/requirements/explicit_instantiation/2.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void inplace_merge(iterator_type, iterator_type, iterator_type); + + template void inplace_merge(iterator_type, iterator_type, + iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/inplace_merge/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/inplace_merge/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..305f448ae22 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/inplace_merge/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void inplace_merge(iterator_type, iterator_type, iterator_type); + + template void inplace_merge(iterator_type, iterator_type, + iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_heap/1.cc b/libstdc++-v3/testsuite/25_algorithms/is_heap/1.cc new file mode 100644 index 00000000000..da4f529af96 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_heap/1.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-12 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.6 Heap operations [lib.alg.heap.operations] + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> + +int A[] = {9, 8, 6, 7, 7, 5, 5, 3, 6, 4, 1, 2, 3, 4}; +int B[] = {1, 3, 2, 4, 4, 6, 3, 5, 5, 7, 7, 6, 8, 9}; +const int N = sizeof(A) / sizeof(int); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + for (int i = 0; i <= N; ++i) + { + VERIFY( std::is_heap(A, A + i) ); + VERIFY( std::is_heap(A, A + i, std::less<int>()) ); + VERIFY( std::is_heap(B, B + i, std::greater<int>()) ); + VERIFY( (i < 2) || !std::is_heap(B, B + i) ); + } +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_heap/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/is_heap/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..8e4b42f6152 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_heap/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-12 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool is_heap(iterator_type, iterator_type); + template bool is_heap(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_heap/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/is_heap/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..04f5c7dc62e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_heap/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-12 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool is_heap(iterator_type, iterator_type); + template bool is_heap(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_heap_until/1.cc b/libstdc++-v3/testsuite/25_algorithms/is_heap_until/1.cc new file mode 100644 index 00000000000..3b821cfb332 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_heap_until/1.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-12 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.6 Heap operations [lib.alg.heap.operations] + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> + +int A[] = {9, 8, 6, 7, 7, 5, 5, 3, 6, 4, 1, 2, 3, 4}; +int B[] = {1, 3, 2, 4, 4, 6, 3, 5, 5, 7, 7, 6, 8, 9}; +const int N = sizeof(A) / sizeof(int); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + for (int i = 0; i <= N; ++i) + { + VERIFY( A + i == std::is_heap_until(A, A + i) ); + VERIFY( A + i == std::is_heap_until(A, A + i, std::less<int>()) ); + VERIFY( B + i == std::is_heap_until(B, B + i, std::greater<int>()) ); + VERIFY( B + (i < 2 ? i : 1) == std::is_heap_until(B, B + i) ); + } +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_heap_until/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/is_heap_until/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..c96e766cd40 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_heap_until/requirements/explicit_instantiation/2.cc @@ -0,0 +1,48 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-12 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type is_heap_until(iterator_type, iterator_type); + template iterator_type is_heap_until(iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_heap_until/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/is_heap_until/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..326f89a1ee4 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_heap_until/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,47 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-12 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type is_heap_until(iterator_type, iterator_type); + template iterator_type is_heap_until(iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted/1.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted/1.cc new file mode 100644 index 00000000000..840597ba318 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_sorted/1.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-14 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.6 Heap operations [lib.alg.heap.operations] + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> + +int A[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +int B[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; +const int N = sizeof(A) / sizeof(int); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + for (int i = 0; i <= N; ++i) + { + VERIFY( std::is_sorted(A, A + i) ); + VERIFY( std::is_sorted(A, A + i, std::less<int>()) ); + VERIFY( std::is_sorted(B, B + i, std::greater<int>()) ); + VERIFY( (i < 2) || !std::is_sorted(B, B + i) ); + } +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..40052015db5 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-14 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool is_sorted(iterator_type, iterator_type); + template bool is_sorted(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..9a2e5560790 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_sorted/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-14 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool is_sorted(iterator_type, iterator_type); + template bool is_sorted(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/1.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/1.cc new file mode 100644 index 00000000000..7be31eedecd --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/1.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-14 Paolo Carlini <pcarlini@suse.de> +// +// Copyright (C) 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.6 Heap operations [lib.alg.heap.operations] + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> + +int A[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; +int B[] = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; +const int N = sizeof(A) / sizeof(int); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + for (int i = 0; i <= N; ++i) + { + VERIFY( A + i == std::is_sorted_until(A, A + i) ); + VERIFY( A + i == std::is_sorted_until(A, A + i, std::less<int>()) ); + VERIFY( B + i == std::is_sorted_until(B, B + i, std::greater<int>()) ); + VERIFY( B + (i < 2 ? i : 1) == std::is_sorted_until(B, B + i) ); + } +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..f13f7b008b0 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/2.cc @@ -0,0 +1,48 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-14 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type is_sorted_until(iterator_type, iterator_type); + template iterator_type is_sorted_until(iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..d6a473f34fc --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/is_sorted_until/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,47 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-14 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type is_sorted_until(iterator_type, iterator_type); + template iterator_type is_sorted_until(iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/iter_swap/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/iter_swap/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..9f8f9829e54 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/iter_swap/requirements/explicit_instantiation/2.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template void iter_swap(iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/iter_swap/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/iter_swap/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..070df5142ab --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/iter_swap/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template void iter_swap(iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/lexicographical_compare/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/lexicographical_compare/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..c2c4deed40d --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/lexicographical_compare/requirements/explicit_instantiation/2.cc @@ -0,0 +1,50 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool lexicographical_compare(iterator_type, iterator_type, + iterator_type, iterator_type); + + template bool lexicographical_compare(iterator_type, iterator_type, + iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/lexicographical_compare/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/lexicographical_compare/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..69598b807fe --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/lexicographical_compare/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool lexicographical_compare(iterator_type, iterator_type, + iterator_type, iterator_type); + + template bool lexicographical_compare(iterator_type, iterator_type, + iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound/2.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound/2.cc new file mode 100644 index 00000000000..2d1c911d472 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound/2.cc @@ -0,0 +1,81 @@ +// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.3 [lib.alg.binary.search] Binary search algorithms. + +#include <algorithm> +#include <testsuite_hooks.h> + +bool test __attribute__((unused)) = true; + +const int A[] = {1, 2, 3, 3, 3, 5, 8}; +const int C[] = {8, 5, 3, 3, 3, 2, 1}; +const int N = sizeof(A) / sizeof(int); + +// A comparison, equalivalent to std::greater<int> without the +// dependency on <functional>. +struct gt +{ + bool + operator()(const int& x, const int& y) const + { return x > y; } +}; + +// Each test performs general-case, bookend, not-found condition, +// and predicate functional checks. + +// 25.3.3.1 lower_bound, with and without comparison predicate +void +test01() +{ + using std::lower_bound; + + const int first = A[0]; + const int last = A[N - 1]; + + const int* p = lower_bound(A, A + N, 3); + VERIFY(p == A + 2); + + const int* q = lower_bound(A, A + N, first); + VERIFY(q == A + 0); + + const int* r = lower_bound(A, A + N, last); + VERIFY(r == A + N - 1); + + const int* s = lower_bound(A, A + N, 4); + VERIFY(s == A + 5); + + const int* t = lower_bound(C, C + N, 3, gt()); + VERIFY(t == C + 2); + + const int* u = lower_bound(C, C + N, first, gt()); + VERIFY(u == C + N - 1); + + const int* v = lower_bound(C, C + N, last, gt()); + VERIFY(v == C + 0); + + const int* w = lower_bound(C, C + N, 4, gt()); + VERIFY(w == C + 2); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound/33613.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound/33613.cc new file mode 100644 index 00000000000..189464cb8d4 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound/33613.cc @@ -0,0 +1,36 @@ +// 2007-10-02 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile } + +// libstdc++/33613 + +#include <algorithm> + +struct A { }; +struct B { }; + +bool ab(A, B); + +void test01(A* a, B b) +{ + std::lower_bound(a, a, b, ab); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound/lower_bound.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound/no_operator_ne.cc index b132cddfe76..b132cddfe76 100644 --- a/libstdc++-v3/testsuite/25_algorithms/lower_bound/lower_bound.cc +++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound/no_operator_ne.cc diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..b4ba007c58c --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound/requirements/explicit_instantiation/2.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type lower_bound(iterator_type, iterator_type, + const value_type&); + + template iterator_type lower_bound(iterator_type, iterator_type, + const value_type&, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/lower_bound/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/lower_bound/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..a3b68072740 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/lower_bound/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type lower_bound(iterator_type, iterator_type, + const value_type&); + + template iterator_type lower_bound(iterator_type, iterator_type, + const value_type&, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/make_heap/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/make_heap/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..6cec88af906 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/make_heap/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void make_heap(iterator_type, iterator_type); + template void make_heap(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/make_heap/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/make_heap/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..db682dee28e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/make_heap/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void make_heap(iterator_type, iterator_type); + template void make_heap(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/max/1.cc b/libstdc++-v3/testsuite/25_algorithms/max/1.cc new file mode 100644 index 00000000000..78db439ae36 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/max/1.cc @@ -0,0 +1,44 @@ +// 2000-03-29 sss/bkoz + +// Copyright (C) 2000, 2003, 2004, 2005 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + const int& x = std::max(1, 2); + const int& y = std::max(4, 3); + VERIFY( x == 2 ); + VERIFY( y == 4 ); + + const int& xc = std::max(1, 2, std::greater<int>()); + const int& yc = std::max(4, 3, std::greater<int>()); + VERIFY( xc == 1 ); + VERIFY( yc == 3 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/max/2.cc b/libstdc++-v3/testsuite/25_algorithms/max/2.cc new file mode 100644 index 00000000000..2be6b8f6f86 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/max/2.cc @@ -0,0 +1,78 @@ +// 2000-03-29 sss/bkoz + +// Copyright (C) 2000, 2003, 2004, 2005 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> + +template<typename T> + struct A { static const T a; }; + +template<typename T> +const T A<T>::a = T(3); + +void test02() +{ + bool test __attribute__((unused)) = true; + + VERIFY( 3 == std::max(A<int>::a, 2) ); + VERIFY( 4 == std::max(A<int>::a, 4) ); + + VERIFY( 3u == std::max(A<unsigned int>::a, 2u) ); + VERIFY( 4u == std::max(A<unsigned int>::a, 4u) ); + + VERIFY( 3l == std::max(A<long>::a, 2l) ); + VERIFY( 4l == std::max(A<long>::a, 4l) ); + + VERIFY( 3ul == std::max(A<unsigned long>::a, 2ul) ); + VERIFY( 4ul == std::max(A<unsigned long>::a, 4ul) ); + +#ifdef _GLIBCXX_USE_LONG_LONG + VERIFY( 3ll == std::max(A<long long>::a, 2ll) ); + VERIFY( 4ll == std::max(A<long long>::a, 4ll) ); + + VERIFY( 3ull == std::max(A<unsigned long long>::a, 2ull) ); + VERIFY( 4ull == std::max(A<unsigned long long>::a, 4ull) ); +#endif + + VERIFY( short(3) == std::max(A<short>::a, short(2)) ); + VERIFY( short(4) == std::max(A<short>::a, short(4)) ); + + VERIFY( (unsigned short)3 == std::max(A<unsigned short>::a, (unsigned short)2) ); + VERIFY( (unsigned short)4 == std::max(A<unsigned short>::a, (unsigned short)4) ); + + VERIFY( (char)3 == std::max(A<char>::a, (char)2) ); + VERIFY( (char)4 == std::max(A<char>::a, (char)4) ); + + VERIFY( (signed char)3 == std::max(A<signed char>::a, (signed char)2) ); + VERIFY( (signed char)4 == std::max(A<signed char>::a, (signed char)4) ); + + VERIFY( (unsigned char)3 == std::max(A<unsigned char>::a, (unsigned char)2) ); + VERIFY( (unsigned char)4 == std::max(A<unsigned char>::a, (unsigned char)4) ); + + VERIFY( (wchar_t)3 == std::max(A<wchar_t>::a, (wchar_t)2) ); + VERIFY( (wchar_t)4 == std::max(A<wchar_t>::a, (wchar_t)4) ); +} + +int main() +{ + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/max/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/max/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..c25b091c6e0 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/max/requirements/explicit_instantiation/2.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template const value_type& max(const value_type&, const value_type&); + + template const value_type& max(const value_type&, const value_type&, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/max/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/max/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..60b39b97cd6 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/max/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template const value_type& max(const value_type&, const value_type&); + + template const value_type& max(const value_type&, const value_type&, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/max_element/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/max_element/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..8bc4458142b --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/max_element/requirements/explicit_instantiation/2.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type max_element(iterator_type, iterator_type); + + template iterator_type max_element(iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/max_element/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/max_element/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..75a7d481d65 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/max_element/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type max_element(iterator_type, iterator_type); + + template iterator_type max_element(iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/merge/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/merge/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..0ef0ca1a81c --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/merge/requirements/explicit_instantiation/2.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type merge(iterator_type, iterator_type, + iterator_type, iterator_type, iterator_type); + + template iterator_type merge(iterator_type, iterator_type, iterator_type, + iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/merge/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/merge/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..4338cf1acd9 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/merge/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type merge(iterator_type, iterator_type, + iterator_type, iterator_type, iterator_type); + + template iterator_type merge(iterator_type, iterator_type, iterator_type, + iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/min/1.cc b/libstdc++-v3/testsuite/25_algorithms/min/1.cc new file mode 100644 index 00000000000..7ff539dc124 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/min/1.cc @@ -0,0 +1,44 @@ +// 2000-03-29 sss/bkoz + +// Copyright (C) 2000, 2003, 2004, 2005 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + const int& z = std::min(1, 2); + const int& w = std::min(4, 3); + VERIFY( z == 1 ); + VERIFY( w == 3 ); + + const int& zc = std::min(1, 2, std::greater<int>()); + const int& wc = std::min(4, 3, std::greater<int>()); + VERIFY( zc == 2 ); + VERIFY( wc == 4 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/min_max.cc b/libstdc++-v3/testsuite/25_algorithms/min/2.cc index 8c9bbaa9dcc..864462d0825 100644 --- a/libstdc++-v3/testsuite/25_algorithms/min_max.cc +++ b/libstdc++-v3/testsuite/25_algorithms/min/2.cc @@ -22,31 +22,6 @@ #include <functional> #include <testsuite_hooks.h> -void test01() -{ - bool test __attribute__((unused)) = true; - - const int& x = std::max(1, 2); - const int& y = std::max(4, 3); - VERIFY( x == 2 ); - VERIFY( y == 4 ); - - const int& xc = std::max(1, 2, std::greater<int>()); - const int& yc = std::max(4, 3, std::greater<int>()); - VERIFY( xc == 1 ); - VERIFY( yc == 3 ); - - const int& z = std::min(1, 2); - const int& w = std::min(4, 3); - VERIFY( z == 1 ); - VERIFY( w == 3 ); - - const int& zc = std::min(1, 2, std::greater<int>()); - const int& wc = std::min(4, 3, std::greater<int>()); - VERIFY( zc == 2 ); - VERIFY( wc == 4 ); -} - template<typename T> struct A { static const T a; }; @@ -103,50 +78,10 @@ void test02() VERIFY( (long double)2 == std::min(A<long double>::a, (long double)2) ); VERIFY( (long double)3 == std::min(A<long double>::a, (long double)4) ); - - - VERIFY( 3 == std::max(A<int>::a, 2) ); - VERIFY( 4 == std::max(A<int>::a, 4) ); - - VERIFY( 3u == std::max(A<unsigned int>::a, 2u) ); - VERIFY( 4u == std::max(A<unsigned int>::a, 4u) ); - - VERIFY( 3l == std::max(A<long>::a, 2l) ); - VERIFY( 4l == std::max(A<long>::a, 4l) ); - - VERIFY( 3ul == std::max(A<unsigned long>::a, 2ul) ); - VERIFY( 4ul == std::max(A<unsigned long>::a, 4ul) ); - -#ifdef _GLIBCXX_USE_LONG_LONG - VERIFY( 3ll == std::max(A<long long>::a, 2ll) ); - VERIFY( 4ll == std::max(A<long long>::a, 4ll) ); - - VERIFY( 3ull == std::max(A<unsigned long long>::a, 2ull) ); - VERIFY( 4ull == std::max(A<unsigned long long>::a, 4ull) ); -#endif - - VERIFY( short(3) == std::max(A<short>::a, short(2)) ); - VERIFY( short(4) == std::max(A<short>::a, short(4)) ); - - VERIFY( (unsigned short)3 == std::max(A<unsigned short>::a, (unsigned short)2) ); - VERIFY( (unsigned short)4 == std::max(A<unsigned short>::a, (unsigned short)4) ); - - VERIFY( (char)3 == std::max(A<char>::a, (char)2) ); - VERIFY( (char)4 == std::max(A<char>::a, (char)4) ); - - VERIFY( (signed char)3 == std::max(A<signed char>::a, (signed char)2) ); - VERIFY( (signed char)4 == std::max(A<signed char>::a, (signed char)4) ); - - VERIFY( (unsigned char)3 == std::max(A<unsigned char>::a, (unsigned char)2) ); - VERIFY( (unsigned char)4 == std::max(A<unsigned char>::a, (unsigned char)4) ); - - VERIFY( (wchar_t)3 == std::max(A<wchar_t>::a, (wchar_t)2) ); - VERIFY( (wchar_t)4 == std::max(A<wchar_t>::a, (wchar_t)4) ); } int main() { - test01(); test02(); return 0; } diff --git a/libstdc++-v3/testsuite/25_algorithms/min/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/min/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..da30edb8827 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/min/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template const value_type& min(const value_type&, const value_type&); + template const value_type& min(const value_type&, const value_type&, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/min/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/min/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..1f5b1f07747 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/min/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template const value_type& min(const value_type&, const value_type&); + template const value_type& min(const value_type&, const value_type&, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/min_element/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/min_element/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..6c53c046b33 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/min_element/requirements/explicit_instantiation/2.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type min_element(iterator_type, iterator_type); + + template iterator_type min_element(iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/min_element/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/min_element/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..cab39f13c29 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/min_element/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type min_element(iterator_type, iterator_type); + + template iterator_type min_element(iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/minmax/1.cc b/libstdc++-v3/testsuite/25_algorithms/minmax/1.cc new file mode 100644 index 00000000000..480d7f95831 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/minmax/1.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-11-01 Paolo Carlini <pcarlini@suse.de + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + std::pair<const int&, const int&> z = std::minmax(1, 2); + std::pair<const int&, const int&> w = std::minmax(4, 3); + VERIFY( z.first == 1 ); + VERIFY( z.second == 2 ); + VERIFY( w.first == 3 ); + VERIFY( w.second == 4 ); + + std::pair<const int&, const int&> zc = std::minmax(1, 2, std::greater<int>()); + std::pair<const int&, const int&> wc = std::minmax(4, 3, std::greater<int>()); + VERIFY( zc.first == 2 ); + VERIFY( zc.second == 1 ); + VERIFY( wc.first == 4 ); + VERIFY( wc.second == 3 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/minmax/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/minmax/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..17d8e0b0088 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/minmax/requirements/explicit_instantiation/2.cc @@ -0,0 +1,50 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-11-01 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template pair<const value_type&, const value_type&> + minmax(const value_type&, const value_type&); + template pair<const value_type&, const value_type&> + minmax(const value_type&, const value_type&, compare_type); +} + diff --git a/libstdc++-v3/testsuite/25_algorithms/minmax/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/minmax/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..887ee47c7c1 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/minmax/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,49 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-11-01 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template pair<const value_type&, const value_type&> + minmax(const value_type&, const value_type&); + template pair<const value_type&, const value_type&> + minmax(const value_type&, const value_type&, compare_type); +} + diff --git a/libstdc++-v3/testsuite/25_algorithms/minmax_element/1.cc b/libstdc++-v3/testsuite/25_algorithms/minmax_element/1.cc new file mode 100644 index 00000000000..3ba5e6cf417 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/minmax_element/1.cc @@ -0,0 +1,139 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <algorithm> +#include <testsuite_iterators.h> +#include <testsuite_hooks.h> + +using __gnu_test::test_container; +using __gnu_test::forward_iterator_wrapper; +using std::minmax_element; + +typedef test_container<int, forward_iterator_wrapper> Container; +typedef std::pair<forward_iterator_wrapper<int>, forward_iterator_wrapper<int> > pair_type; + +void +test1() +{ + bool test __attribute__((unused)) = true; + + int array[] = {0}; + Container con(array, array); + pair_type p1 = minmax_element(con.begin(), con.end()); + VERIFY( p1.first.ptr == array ); + VERIFY( p1.second.ptr == array ); +} + +void +test2() +{ + bool test __attribute__((unused)) = true; + + int array[] = {0}; + Container con(array, array + 1); + pair_type p1 = minmax_element(con.begin(), con.end()); + VERIFY( p1.first.ptr == array ); + VERIFY( p1.second.ptr == array ); +} + +void +test3() +{ + bool test __attribute__((unused)) = true; + + int array[] = {0, 3}; + Container con(array, array + 2); + pair_type p1 = minmax_element(con.begin(), con.end()); + VERIFY( p1.first.ptr == array ); + VERIFY( p1.second.ptr == array + 1 ); +} + +void +test4() +{ + bool test __attribute__((unused)) = true; + + int array[] = {3, 0}; + Container con(array, array + 2); + pair_type p1 = minmax_element(con.begin(), con.end()); + VERIFY( p1.first.ptr == array + 1 ); + VERIFY( p1.second.ptr == array ); +} + +void +test5() +{ + bool test __attribute__((unused)) = true; + + int array[] = {3, 3}; + Container con(array, array + 2); + pair_type p1 = minmax_element(con.begin(), con.end()); + VERIFY( p1.first.ptr == array ); + VERIFY( p1.second.ptr == array + 1 ); +} + +void +test6() +{ + bool test __attribute__((unused)) = true; + + int array[] = {6, 3, 0, 2, 6, 4, 0}; + Container con(array, array + 7); + pair_type p1 = minmax_element(con.begin(), con.end()); + VERIFY( p1.first.ptr == array + 2 ); + VERIFY( p1.second.ptr == array + 4 ); +} + +void +test7() +{ + bool test __attribute__((unused)) = true; + + int array[] = {4, 4, 4, 6, 6, 6, 1, 1, 0, 0, 0, 2, 2}; + Container con(array, array + 13); + pair_type p1 = minmax_element(con.begin(), con.end()); + VERIFY( p1.first.ptr == array + 8 ); + VERIFY( p1.second.ptr == array + 5 ); +} + +void +test8() +{ + bool test __attribute__((unused)) = true; + + int array[] = {1, 7, 5, 5, 10, 1, 0, 0, 8, 4, 4, 0, 10, 10, 10, 1}; + Container con(array, array + 16); + pair_type p1 = minmax_element(con.begin(), con.end()); + VERIFY( p1.first.ptr == array + 6 ); + VERIFY( p1.second.ptr == array + 14 ); +} + +int main() +{ + test1(); + test2(); + test3(); + test4(); + test5(); + test6(); + test7(); + test8(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/minmax_element/check_type.cc b/libstdc++-v3/testsuite/25_algorithms/minmax_element/check_type.cc new file mode 100644 index 00000000000..0067f39019f --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/minmax_element/check_type.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-do compile } + +#include <algorithm> +#include <testsuite_iterators.h> + +using __gnu_test::forward_iterator_wrapper; + +struct S { }; + +bool +operator<(const S&, const S&) {return true;} + +struct X { }; + +bool +predicate(const X&, const X&) {return true;} + +std::pair<forward_iterator_wrapper<S>, forward_iterator_wrapper<S> > +test1(forward_iterator_wrapper<S>& s) +{ return std::minmax_element(s,s); } + +std::pair<forward_iterator_wrapper<X>, forward_iterator_wrapper<X> > +test2(forward_iterator_wrapper<X>& x) +{ return std::minmax_element(x,x,predicate); } diff --git a/libstdc++-v3/testsuite/25_algorithms/minmax_element/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/minmax_element/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..5f50b68cd46 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/minmax_element/requirements/explicit_instantiation/2.cc @@ -0,0 +1,49 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-11-01 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template pair<iterator_type, iterator_type> + minmax_element(iterator_type, iterator_type); + template pair<iterator_type, iterator_type> + minmax_element(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/minmax_element/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/minmax_element/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..5ef0cc7482b --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/minmax_element/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,49 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-11-01 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template pair<iterator_type, iterator_type> + minmax_element(iterator_type, iterator_type); + template pair<iterator_type, iterator_type> + minmax_element(iterator_type, iterator_type, compare_type); +} + diff --git a/libstdc++-v3/testsuite/25_algorithms/move/1.cc b/libstdc++-v3/testsuite/25_algorithms/move/1.cc new file mode 100644 index 00000000000..7fa0f784054 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/move/1.cc @@ -0,0 +1,64 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#undef _GLIBCXX_CONCEPT_CHECKS +#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + +#include <algorithm> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::input_iterator_wrapper; +using __gnu_test::output_iterator_wrapper; +using __gnu_test::rvalstruct; +using std::move; + +typedef test_container<rvalstruct, input_iterator_wrapper> container_in; +typedef test_container<rvalstruct, output_iterator_wrapper> container_out; + +void test01() +{ + bool test __attribute__((unused)) = true; + + int inarray[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + const int size = sizeof(inarray) / sizeof(int); + + rvalstruct in[size], out[size]; + std::copy(inarray, inarray + size, in); + std::fill(out, out + size, 0); + + container_in incon(in, in + size); + container_out outcon(out, out + size); + + move(incon.begin(), incon.end(), outcon.begin()); + VERIFY( std::equal(out, out + size, inarray) ); + for (int z = 0; z < size; ++z) + VERIFY( out[z].valid ); + for (int z = 0; z < size; ++z) + VERIFY( !in[z].valid ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/move/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/move/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..532c290f9dd --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/move/requirements/explicit_instantiation/2.cc @@ -0,0 +1,44 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-19 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type move(iterator_type, iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/move/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/move/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..37aa958670d --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/move/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,44 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-19 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type move(iterator_type, iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/move_backward/1.cc b/libstdc++-v3/testsuite/25_algorithms/move_backward/1.cc new file mode 100644 index 00000000000..ed742f30ffe --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/move_backward/1.cc @@ -0,0 +1,66 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +#undef _GLIBCXX_CONCEPT_CHECKS +#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + +#include <algorithm> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::bidirectional_iterator_wrapper; +using __gnu_test::rvalstruct; +using std::move_backward; + +typedef test_container<rvalstruct, + bidirectional_iterator_wrapper> container_in; +typedef test_container<rvalstruct, + bidirectional_iterator_wrapper> container_out; + +void test01() +{ + bool test __attribute__((unused)) = true; + + int inarray[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + const int size = sizeof(inarray) / sizeof(int); + + rvalstruct in[size], out[size]; + std::copy(inarray, inarray + size, in); + std::fill(out, out + size, 0); + + container_in incon(in, in + size); + container_out outcon(out, out + size); + + move_backward(incon.begin(), incon.end(), outcon.end()); + VERIFY( std::equal(out, out + size, inarray) ); + for (int z = 0; z < size; ++z) + VERIFY( out[z].valid ); + for (int z = 0; z < size; ++z) + VERIFY( !in[z].valid ); +} + + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/move_backward/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/move_backward/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..430ac7af827 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/move_backward/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-19 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type move_backward(iterator_type, iterator_type, + iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/move_backward/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/move_backward/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..a1c32417719 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/move_backward/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// 2007-10-19 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type move_backward(iterator_type, iterator_type, + iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/next_permutation/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/next_permutation/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..fd6b3a92dac --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/next_permutation/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool next_permutation(iterator_type, iterator_type); + template bool next_permutation(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/next_permutation/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/next_permutation/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..f46999a1bfc --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/next_permutation/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool next_permutation(iterator_type, iterator_type); + template bool next_permutation(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/1.cc b/libstdc++-v3/testsuite/25_algorithms/nth_element/1.cc index 80b4776d23b..2304d3634b9 100644 --- a/libstdc++-v3/testsuite/25_algorithms/nth_element/1.cc +++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/1.cc @@ -25,6 +25,7 @@ using __gnu_test::test_container; using __gnu_test::random_access_iterator_wrapper; using std::nth_element; +using std::partial_sort; typedef test_container<int, random_access_iterator_wrapper> Container; @@ -48,6 +49,7 @@ test2() void test3() { + bool test __attribute__((unused)) = true; int array[] = {6, 5, 4, 3, 2, 1, 0}; Container con(array, array + 7); nth_element(con.begin(), con.it(3), con.end()); @@ -60,6 +62,7 @@ test3() void test4() { + bool test __attribute__((unused)) = true; int array[] = {0, 6, 1, 5, 2, 4, 3}; Container con(array,array + 7); nth_element(con.begin(), con.it(3), con.end()); diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/2.cc b/libstdc++-v3/testsuite/25_algorithms/nth_element/2.cc index ed8635033b8..84f959ae9a2 100644 --- a/libstdc++-v3/testsuite/25_algorithms/nth_element/2.cc +++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/2.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007 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 @@ -23,27 +23,27 @@ #include <testsuite_hooks.h> void -test_set(std::vector<int>& v, int size) +test_set(std::vector<unsigned>& v, unsigned size) { v.clear(); - for (int i = 0; i < size; i += 4) + for (unsigned i = 0; i < size; i += 4) { v.push_back(i / 2); v.push_back((size - 2) - (i / 2)); } - for (int i = 1; i < size; i += 2) + for (unsigned i = 1; i < size; i += 2) v.push_back(i); } void -do_test01(int size) +do_test01(unsigned size) { bool test __attribute__((unused)) = true; - std::vector<int> v, s; + std::vector<unsigned> v, s; - for (int j = 0; j < size; ++j) + for (unsigned j = 0; j < size; ++j) { test_set(v, size); s = v; @@ -53,10 +53,10 @@ do_test01(int size) VERIFY( v[j] == s[j] ); - for (int i = 0; i < j; ++i) + for (unsigned i = 0; i < j; ++i) VERIFY( !(v[j] < v[i]) ); - for (int i = j; i < v.size(); ++i) + for (unsigned i = j; i < v.size(); ++i) VERIFY( !(v[i] < v[j]) ); } } @@ -64,7 +64,7 @@ do_test01(int size) void test01() { - for (int size = 4; size <= 1 << 10; size <<= 1) + for (unsigned size = 4; size <= 1 << 10; size <<= 1) do_test01(size); } diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc b/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc new file mode 100644 index 00000000000..f1f94bb3c5a --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc @@ -0,0 +1,87 @@ +// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.1 algorithms, sort() + +#include <algorithm> +#include <testsuite_hooks.h> + +bool test __attribute__((unused)) = true; + +const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; +const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19}; +const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; +const int N = sizeof(A) / sizeof(int); +const int logN = 3; // ln(N) rounded up +const int P = 7; + +// comparison predicate for stable_sort: order by rightmost digit +struct CompLast +{ + bool + operator()(const int x, const int y) + { return x % 10 < y % 10; } +}; + +// This functor has the equivalent functionality of std::geater<>, +// but there is no dependency on <functional> and it also tracks the +// number of invocations since creation. +class Gt +{ +public: + static int count() { return itsCount; } + static void reset() { itsCount = 0; } + + bool + operator()(const int& x, const int& y) + { + ++itsCount; + return x > y; + } + +private: + static int itsCount; +}; + +int Gt::itsCount = 0; + +// 25.3.2 nth_element() +void +test05() +{ + using std::nth_element; + + int s1[N]; + std::copy(B, B + N, s1); + VERIFY(std::equal(s1, s1 + N, B)); + + int* pn = s1 + (N / 2) - 1; + nth_element(s1, pn, s1 + N); + for (const int* i = pn; i < s1 + N; ++i) VERIFY(!(*i < *pn)); + + CompLast pred; + nth_element(s1, pn, s1 + N, pred); + for (const int* i = pn; i < s1 + N; ++i) VERIFY(!pred(*i, *pn)); +} + +int +main() +{ + test05(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/nth_element/moveable.cc new file mode 100644 index 00000000000..c521d382b2f --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/moveable.cc @@ -0,0 +1,76 @@ +// { dg-require-rvalref "" } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.3.2 [lib.alg.nth.element] + +#undef _GLIBCXX_CONCEPT_CHECKS + +#include <algorithm> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::random_access_iterator_wrapper; +using std::nth_element; +using __gnu_test::rvalstruct; + +typedef test_container<rvalstruct, random_access_iterator_wrapper> Container; + +void +test1() +{ + int intarray[] = {6, 5, 4, 3, 2, 1, 0}; + rvalstruct array[7]; + std::copy(intarray, intarray + 7, array); + Container con(array, array + 7); + nth_element(con.begin(), con.it(3), con.end()); + for(int i = 0; i < 3; ++i) + VERIFY(array[i].val < 3); + for(int i = 4; i < 7; ++i) + VERIFY(array[i].val > 3); + for(int i = 0; i < 7; ++i) + VERIFY(array[i].valid); +} + +void +test2() +{ + int intarray[] = {0, 6, 1, 5, 2, 4, 3}; + rvalstruct array[7]; + std::copy(intarray, intarray + 7, array); + Container con(array,array + 7); + nth_element(con.begin(), con.it(3), con.end()); + for(int i = 0; i < 3; ++i) + VERIFY(array[i].val < 3); + for(int i = 4; i < 7; ++i) + VERIFY(array[i].val > 3); + for(int i = 0; i < 7; ++i) + VERIFY(array[i].valid); +} + +int +main() +{ + test1(); + test2(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/nth_element/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..b40f0036c1c --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void nth_element(iterator_type, iterator_type, iterator_type); + template void nth_element(iterator_type, iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/nth_element/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..5a98b8936fe --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void nth_element(iterator_type, iterator_type, iterator_type); + template void nth_element(iterator_type, iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc new file mode 100644 index 00000000000..b60a03e7fdd --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc @@ -0,0 +1,85 @@ +// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.1 algorithms, sort() + +#include <algorithm> +#include <testsuite_hooks.h> + +bool test __attribute__((unused)) = true; + +const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; +const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19}; +const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; +const int N = sizeof(A) / sizeof(int); +const int logN = 3; // ln(N) rounded up +const int P = 7; + +// comparison predicate for stable_sort: order by rightmost digit +struct CompLast +{ + bool + operator()(const int x, const int y) + { return x % 10 < y % 10; } +}; + +// This functor has the equivalent functionality of std::geater<>, +// but there is no dependency on <functional> and it also tracks the +// number of invocations since creation. +class Gt +{ +public: + static int count() { return itsCount; } + static void reset() { itsCount = 0; } + + bool + operator()(const int& x, const int& y) + { + ++itsCount; + return x > y; + } + +private: + static int itsCount; +}; + +int Gt::itsCount = 0; + +// 25.3.1.3 partial_sort() +void +test03() +{ + int s1[N]; + std::copy(B, B + N, s1); + VERIFY(std::equal(s1, s1 + N, B)); + + std::partial_sort(s1, s1 + P, s1 + N); + VERIFY(std::equal(s1, s1 + P, A)); + + Gt gt; + gt.reset(); + std::partial_sort(s1, s1 + P, s1 + N, gt); + VERIFY(std::equal(s1, s1 + P, C)); +} + +int +main() +{ + test03(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort/moveable.cc new file mode 100644 index 00000000000..74a95d9e1a8 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort/moveable.cc @@ -0,0 +1,69 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.3.1.3 [lib.partial.sort] + +#undef _GLIBCXX_CONCEPT_CHECKS +#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + +#include <algorithm> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::random_access_iterator_wrapper; +using __gnu_test::rvalstruct; +using std::partial_sort; + +typedef test_container<rvalstruct, random_access_iterator_wrapper> Container; + +void +test1() +{ + int intarray[] = {6, 5, 4, 3, 2, 1, 0}; + rvalstruct array[7]; + std::copy(intarray, intarray + 7, array); + Container con(array, array + 7); + partial_sort(con.begin(), con.it(3), con.end()); + VERIFY(array[0].val == 0 && array[1].val == 1 && array[2].val == 2); + for(int i = 0; i < 7; ++i) + VERIFY(array[i].valid); +} + +void +test2() +{ + int intarray[] = {0, 6, 1, 5, 2, 4, 3}; + rvalstruct array[7]; + std::copy(intarray, intarray + 7, array); + Container con(array,array + 7); + partial_sort(con.begin(), con.it(3), con.end()); + VERIFY(array[0].val == 0 && array[1].val == 1 && array[2].val == 2); + for(int i = 0; i < 7; ++i) + VERIFY(array[i].valid); +} + +int +main() +{ + test1(); + test2(); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..b53a9db081c --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void partial_sort(iterator_type, iterator_type, iterator_type); + template void partial_sort(iterator_type, iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..fbc92766f2a --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void partial_sort(iterator_type, iterator_type, iterator_type); + template void partial_sort(iterator_type, iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/sort.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/2.cc index 6ca01ef7415..e21ace07ee2 100644 --- a/libstdc++-v3/testsuite/25_algorithms/sort.cc +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/2.cc @@ -33,9 +33,9 @@ const int P = 7; // comparison predicate for stable_sort: order by rightmost digit struct CompLast { - bool - operator()(const int x, const int y) - { return x % 10 < y % 10; } + bool + operator()(const int x, const int y) + { return x % 10 < y % 10; } }; // This functor has the equivalent functionality of std::geater<>, @@ -44,15 +44,15 @@ struct CompLast class Gt { public: - static int count() { return itsCount; } - static void reset() { itsCount = 0; } - - bool - operator()(const int& x, const int& y) - { - ++itsCount; - return x > y; - } + static int count() { return itsCount; } + static void reset() { itsCount = 0; } + + bool + operator()(const int& x, const int& y) + { + ++itsCount; + return x > y; + } private: static int itsCount; @@ -61,61 +61,6 @@ private: int Gt::itsCount = 0; -// 25.3.1.1 sort() -void -test01() -{ - int s1[N]; - std::copy(B, B + N, s1); - VERIFY(std::equal(s1, s1 + N, B)); - - std::sort(s1, s1 + N); - VERIFY(std::equal(s1, s1 + N, A)); - - Gt gt; - gt.reset(); - std::sort(s1, s1 + N, gt); - VERIFY(std::equal(s1, s1 + N, C)); -} - -// 25.3.1.2 stable_sort() -void -test02() -{ - int s1[N]; - std::copy(A, A + N, s1); - VERIFY(std::equal(s1, s1 + N, A)); - - std::stable_sort(s1, s1 + N, CompLast()); - VERIFY(std::equal(s1, s1 + N, B)); - - std::stable_sort(s1, s1 + N); - VERIFY(std::equal(s1, s1 + N, A)); - - Gt gt; - gt.reset(); - std::stable_sort(s1, s1 + N, gt); - VERIFY(std::equal(s1, s1 + N, C)); - VERIFY(gt.count() <= N * logN * logN); -} - -// 25.3.1.3 partial_sort() -void -test03() -{ - int s1[N]; - std::copy(B, B + N, s1); - VERIFY(std::equal(s1, s1 + N, B)); - - std::partial_sort(s1, s1 + P, s1 + N); - VERIFY(std::equal(s1, s1 + P, A)); - - Gt gt; - gt.reset(); - std::partial_sort(s1, s1 + P, s1 + N, gt); - VERIFY(std::equal(s1, s1 + P, C)); -} - // 25.3.1.4 partial_sort_copy() void test04() @@ -139,33 +84,9 @@ test04() VERIFY(std::equal(s2, partial_sort_copy(s1, s1 + N, s2, s2 + 2*N), A)); } -// 25.3.2 nth_element() -void -test05() -{ - using std::nth_element; - - int s1[N]; - std::copy(B, B + N, s1); - VERIFY(std::equal(s1, s1 + N, B)); - - int* pn = s1 + (N / 2) - 1; - nth_element(s1, pn, s1 + N); - for (const int* i = pn; i < s1 + N; ++i) VERIFY(!(*i < *pn)); - - CompLast pred; - nth_element(s1, pn, s1 + N, pred); - for (const int* i = pn; i < s1 + N; ++i) VERIFY(!pred(*i, *pn)); -} - int main() { - test01(); - test02(); - test03(); test04(); - test05(); - return 0; } diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..7f7628fa5b9 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/requirements/explicit_instantiation/2.cc @@ -0,0 +1,50 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type partial_sort_copy(iterator_type, iterator_type, + iterator_type, iterator_type); + + template iterator_type partial_sort_copy(iterator_type, iterator_type, + iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..d8d45093f05 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type partial_sort_copy(iterator_type, iterator_type, + iterator_type, iterator_type); + + template iterator_type partial_sort_copy(iterator_type, iterator_type, + iterator_type, iterator_type, + compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/partition/partition.cc b/libstdc++-v3/testsuite/25_algorithms/partition/1.cc index 66edb6f4748..b71ec23fbf0 100644 --- a/libstdc++-v3/testsuite/25_algorithms/partition/partition.cc +++ b/libstdc++-v3/testsuite/25_algorithms/partition/1.cc @@ -50,24 +50,9 @@ test01() for (const int* i = m; i < s1 + N; ++i) VERIFY(!pred(*i)); } -// 25.2.12 stable_partition() -void -test02() -{ - using std::stable_partition; - - int s1[N]; - std::copy(A, A + N, s1); - - stable_partition(s1, s1 + N, Pred()); - VERIFY(std::equal(s1, s1 + N, B)); -} - int main() { test01(); - test02(); - return 0; } diff --git a/libstdc++-v3/testsuite/25_algorithms/partition/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/partition/moveable.cc new file mode 100644 index 00000000000..a31e5277bfa --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/partition/moveable.cc @@ -0,0 +1,89 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.2.12 [lib.alg.partitions] Partitions. + +#undef _GLIBCXX_CONCEPT_CHECKS + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> +#include <testsuite_rvalref.h> +#include <testsuite_iterators.h> + +using __gnu_test::test_container; +using __gnu_test::forward_iterator_wrapper; +using __gnu_test::bidirectional_iterator_wrapper; +using __gnu_test::rvalstruct; + +typedef test_container<rvalstruct, forward_iterator_wrapper> Fcontainer; +typedef test_container<rvalstruct, bidirectional_iterator_wrapper> Bcontainer; + +bool test __attribute__((unused)) = true; + +const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; +const int B[] = {2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17}; +const int N = sizeof(A) / sizeof(int); + +struct Pred +{ + bool + operator()(const rvalstruct& x) const + { return (x.val % 2) == 0; } +}; + +// 25.2.12 partition() +void +test01() +{ + using std::partition; + + rvalstruct farray[N]; + rvalstruct barray[N]; + + std::copy(A, A + N, farray); + std::copy(A, A + N, barray); + + Fcontainer fcon(farray, farray + N); + Bcontainer bcon(barray, barray + N); + + Pred pred; + + VERIFY(partition(fcon.begin(), fcon.end(), pred).ptr - farray == N/2); + for (const rvalstruct* i = farray; i < farray+N/2; ++i) + VERIFY(pred(*i)); + + for (const rvalstruct* i = farray+N/2; i < farray + N; ++i) + VERIFY(!pred(*i)); + + VERIFY(partition(bcon.begin(), bcon.end(), pred).ptr - barray == N/2); + + for (const rvalstruct* i = barray; i < barray+N/2; ++i) + VERIFY(pred(*i)); + for (const rvalstruct* i = barray+N/2; i < barray + N; ++i) + VERIFY(!pred(*i)); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/partition/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/partition/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..84fe246122e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/partition/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type partition(iterator_type, iterator_type, + predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/partition/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/partition/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..e07c763e318 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/partition/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type partition(iterator_type, iterator_type, + predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/pop_heap/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/pop_heap/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..4517c55f28c --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/pop_heap/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void pop_heap(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/pop_heap/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/pop_heap/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..28ca9f3cfe8 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/pop_heap/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void pop_heap(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/prev_permutation/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/prev_permutation/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..d4dd5864bca --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/prev_permutation/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool prev_permutation(iterator_type, iterator_type); + template bool prev_permutation(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/prev_permutation/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/prev_permutation/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..6f0dcec2e10 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/prev_permutation/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template bool prev_permutation(iterator_type, iterator_type); + template bool prev_permutation(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/push_heap/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/push_heap/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..aaa4e77618a --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/push_heap/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void push_heap(iterator_type, iterator_type); + template void push_heap(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/push_heap/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/push_heap/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..2dbec8c4216 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/push_heap/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void push_heap(iterator_type, iterator_type); + template void push_heap(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..55cc05d3514 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<int, int> generator_type; + + template void random_shuffle(iterator_type, iterator_type); + template void random_shuffle(iterator_type, iterator_type, + generator_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..f49204456cd --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/random_shuffle/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<int, int> generator_type; + + template void random_shuffle(iterator_type, iterator_type); + template void random_shuffle(iterator_type, iterator_type, + generator_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/remove/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/remove/moveable.cc new file mode 100644 index 00000000000..5a0e77e2e89 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/remove/moveable.cc @@ -0,0 +1,67 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.2.4 remove + +#undef _GLIBCXX_CONCEPT_CHECKS + +#include <algorithm> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::forward_iterator_wrapper; +using __gnu_test::rvalstruct; + +typedef test_container<rvalstruct, forward_iterator_wrapper> Container; + +void +test1() +{ + int intarray[] = {1}; + rvalstruct array[1]; + std::copy(intarray, intarray + 1, array); + Container con(array, array + 1); + rvalstruct remove_val0(0); + rvalstruct remove_val1(1); + VERIFY(std::remove(con.begin(), con.end(), remove_val0).ptr == array + 1); + VERIFY(std::remove(con.begin(), con.end(), remove_val1).ptr == array); +} + +void +test2() +{ + int intarray[] = {0, 1, 0, 1, 0, 0, 1, 1}; + rvalstruct array[8]; + std::copy(intarray, intarray + 8, array); + Container con(array, array + 8); + rvalstruct remove_val(1); + VERIFY(std::remove(con.begin(), con.end(), remove_val).ptr == array + 4); + VERIFY(array[0].val == 0 && array[1].val == 0 && array[2].val == 0 && + array[3].val == 0); +} + +int +main() +{ + test1(); + test2(); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/remove/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/remove/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..b6e4a04ee67 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/remove/requirements/explicit_instantiation/2.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type remove(iterator_type, iterator_type, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/remove/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/remove/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..ca538192dec --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/remove/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type remove<iterator_type, value_type>(iterator_type, iterator_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/remove_copy/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/remove_copy/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..214c80dfa92 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/remove_copy/requirements/explicit_instantiation/2.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type remove_copy(iterator_type, iterator_type, + iterator_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/remove_copy/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/remove_copy/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..bd060dab0f5 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/remove_copy/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type remove_copy(iterator_type, iterator_type, + iterator_type, const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/remove_copy_if/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/remove_copy_if/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..af0426f7604 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/remove_copy_if/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type remove_copy_if(iterator_type, iterator_type, + iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/remove_copy_if/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/remove_copy_if/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..5bf77c72e13 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/remove_copy_if/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type remove_copy_if(iterator_type, iterator_type, + iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/remove_if/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/remove_if/moveable.cc new file mode 100644 index 00000000000..db49433452f --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/remove_if/moveable.cc @@ -0,0 +1,67 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.2.4 remove + +#undef _GLIBCXX_CONCEPT_CHECKS + +#include <algorithm> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::forward_iterator_wrapper; +using __gnu_test::rvalstruct; + +typedef test_container<rvalstruct, forward_iterator_wrapper> Container; + +bool equal1(rvalstruct& in) { return in.val == 1; } +bool equal0(rvalstruct& in) { return in.val == 0; } + +void +test1() +{ + int intarray[] = {1}; + rvalstruct array[1]; + std::copy(intarray, intarray + 1, array); + Container con(array, array + 1); + VERIFY(std::remove_if(con.begin(), con.end(), equal0).ptr == array + 1); + VERIFY(std::remove_if(con.begin(), con.end(), equal1).ptr == array); +} + +void +test2() +{ + int intarray[] = {0, 1, 0, 1, 0, 0, 1, 1}; + rvalstruct array[8]; + std::copy(intarray, intarray + 8, array); + Container con(array, array + 8); + VERIFY(std::remove_if(con.begin(), con.end(), equal1).ptr == array + 4); + VERIFY(array[0] == 0 && array[1] == 0 && array[2] == 0 && + array[3] == 0); +} + +int +main() +{ + test1(); + test2(); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/remove_if/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/remove_if/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..654717fca32 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/remove_if/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type remove_if(iterator_type, iterator_type, + predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/remove_if/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/remove_if/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..61c08fe89b4 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/remove_if/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type remove_if(iterator_type, iterator_type, + predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/replace/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/replace/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..834211ee7e9 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/replace/requirements/explicit_instantiation/2.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template void replace(iterator_type, iterator_type, const value_type&, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/replace/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/replace/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..15c4f4ab1a4 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/replace/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template void replace(iterator_type, iterator_type, const value_type&, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/replace_copy/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/replace_copy/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..8a8ef3dc185 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/replace_copy/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type replace_copy(iterator_type, iterator_type, + iterator_type, const value_type&, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/replace_copy/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/replace_copy/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..869659c095d --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/replace_copy/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type replace_copy(iterator_type, iterator_type, + iterator_type, const value_type&, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/replace_copy_if/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/replace_copy_if/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..8647bcec6c5 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/replace_copy_if/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type replace_copy_if(iterator_type, iterator_type, + iterator_type, predicate_type, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/replace_copy_if/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/replace_copy_if/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..6cb64619e3b --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/replace_copy_if/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type replace_copy_if(iterator_type, iterator_type, + iterator_type, predicate_type, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/replace_if/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/replace_if/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..b13fda1a9ff --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/replace_if/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template void replace_if(iterator_type, iterator_type, predicate_type, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/replace_if/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/replace_if/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..7e95210e222 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/replace_if/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template void replace_if(iterator_type, iterator_type, predicate_type, + const value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/reverse/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/reverse/moveable.cc new file mode 100644 index 00000000000..c01bf71339e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/reverse/moveable.cc @@ -0,0 +1,44 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.2.9 Reverse + +#undef _GLIBCXX_CONCEPT_CHECKS + +#include <algorithm> +#include <testsuite_iterators.h> + +using __gnu_test::bidirectional_iterator_wrapper; + +class X +{ + X(); + X(const X&); + void operator=(const X&); +}; + +void +swap(X&, X&) { } + +void +test1(bidirectional_iterator_wrapper<X>& begin, + bidirectional_iterator_wrapper<X>& end) +{ std::reverse(begin, end); } diff --git a/libstdc++-v3/testsuite/25_algorithms/reverse/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/reverse/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..8f774a81366 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/reverse/requirements/explicit_instantiation/2.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template void reverse(iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/reverse/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/reverse/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..94b6eadde24 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/reverse/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template void reverse(iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/reverse_copy/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/reverse_copy/explicit_instantiation/2.cc new file mode 100644 index 00000000000..0b88c90bdbe --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/reverse_copy/explicit_instantiation/2.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type reverse_copy(iterator_type, iterator_type, + iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/reverse_copy/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/reverse_copy/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..5887ca93a21 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/reverse_copy/explicit_instantiation/pod.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type reverse_copy(iterator_type, iterator_type, + iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/rotate/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/rotate/moveable.cc new file mode 100644 index 00000000000..6d132cf02bc --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/rotate/moveable.cc @@ -0,0 +1,78 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.2.10 rotate + +// Tests rotate when an moveable class is used + +#undef _GLIBCXX_CONCEPT_CHECKS + +#include <algorithm> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::forward_iterator_wrapper; +using __gnu_test::bidirectional_iterator_wrapper; +using __gnu_test::random_access_iterator_wrapper; +using __gnu_test::rvalstruct; + +typedef test_container<rvalstruct, forward_iterator_wrapper> Fcontainer; +typedef test_container<rvalstruct, bidirectional_iterator_wrapper> Bcontainer; +typedef test_container<rvalstruct, random_access_iterator_wrapper> Rcontainer; + + + +void +test1() +{ + bool test __attribute__((unused)) = true; + int data[] = {1, 2, 3, 4, 5}; + rvalstruct array[5]; + std::copy(data, data + 5, array); + Fcontainer fcon(array, array + 5); + Bcontainer bcon(array, array + 5); + Rcontainer rcon(array, array + 5); + + std::rotate(fcon.begin(), fcon.it(2), fcon.end()); + VERIFY(array[0].val == 3 && array[1].val == 4 && array[2].val == 5 && + array[3].val == 1 && array[4].val == 2); + for(int i=0;i<5;i++) + VERIFY(array[i].valid == true); + + std::rotate(bcon.begin(), bcon.it(2), bcon.end()); + VERIFY(array[0].val == 5 && array[1].val == 1 && array[2].val == 2 && + array[3].val == 3 && array[4].val == 4); + for(int i=0;i<5;i++) + VERIFY(array[i].valid); + + std::rotate(rcon.begin(), rcon.it(2), rcon.end()); + VERIFY(array[0].val == 2 && array[1].val == 3 && array[2].val == 4 && + array[3].val == 5 && array[4].val == 1); + for(int i=0;i<5;i++) + VERIFY(array[i].valid); +} + +int +main() +{ + test1(); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/rotate/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/rotate/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..ef94a5a905b --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/rotate/requirements/explicit_instantiation/2.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template void rotate(iterator_type, iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/rotate/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/rotate/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..2994f93b565 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/rotate/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template void rotate(iterator_type, iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/rotate_copy/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/rotate_copy/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..716b52b5db9 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/rotate_copy/requirements/explicit_instantiation/2.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type rotate_copy(iterator_type, iterator_type, + iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/rotate_copy/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/rotate_copy/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..2d73426fe63 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/rotate_copy/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type rotate_copy(iterator_type, iterator_type, + iterator_type, iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/search/1.cc b/libstdc++-v3/testsuite/25_algorithms/search/1.cc index ec0763d6f06..ef00b58d010 100644 --- a/libstdc++-v3/testsuite/25_algorithms/search/1.cc +++ b/libstdc++-v3/testsuite/25_algorithms/search/1.cc @@ -24,9 +24,11 @@ using __gnu_test::test_container; using __gnu_test::forward_iterator_wrapper; +using __gnu_test::random_access_iterator_wrapper; using std::search; typedef test_container<int, forward_iterator_wrapper> Container; +typedef test_container<int, random_access_iterator_wrapper> RAcontainer; int array1[] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}; int array2[] = {0, 0, 0}; @@ -101,6 +103,53 @@ test6() == array3 + 6); } +bool +lexstep(int* start, int length) +{ + int i = 0; + int carry = 1; + while(i < length && carry) + { + if(start[i] == 1) + start[i] = 0; + else + { + start[i] = 1; + carry = 0; + } + i++; + } + return !carry; +} + +void test7() +{ + int array1[6]; + int array2[6]; + for(int length1 = 0; length1 < 6; length1++) + { + for(int length2 = 0; length2 < 6; length2++) + { + std::fill_n(array1, length1, 0); + while(lexstep(array1, length1)) + { + std::fill_n(array2, length2, 0); + while(lexstep(array2, length2)) + { + Container con1(array1, array1 + length1); + Container con2(array2, array2 + length2); + RAcontainer rcon1(array1, array1 + length1); + RAcontainer rcon2(array2, array2 + length2); + VERIFY(search(con1.begin(), con1.end(), con2.begin(), + con2.end()).ptr == + search(rcon1.begin(), rcon1.end(), rcon2.begin(), + rcon2.end()).ptr); + } + } + } + } +} + int main() { @@ -110,4 +159,5 @@ main() test4(); test5(); test6(); + test7(); } diff --git a/libstdc++-v3/testsuite/25_algorithms/search/check_type.cc b/libstdc++-v3/testsuite/25_algorithms/search/check_type.cc index 4aaa87bea50..4762abdb0e3 100644 --- a/libstdc++-v3/testsuite/25_algorithms/search/check_type.cc +++ b/libstdc++-v3/testsuite/25_algorithms/search/check_type.cc @@ -25,14 +25,33 @@ using __gnu_test::forward_iterator_wrapper; -struct S1 { }; -struct S2 { }; +struct T1 { }; +struct T2 { }; + +struct S1 +{ + S1(T1) { } +}; + +struct S2 { + S2(T2) { } +}; bool operator==(const S1&, const S2&) {return true;} -struct X1 { }; -struct X2 { }; +struct V1 { }; +struct V2 { }; + +struct X1 +{ + X1(V1) { }; +}; + +struct X2 +{ + X2(V2) { }; +}; bool predicate(const X1&, const X2&) {return true;} @@ -41,6 +60,14 @@ forward_iterator_wrapper<S1> test1(forward_iterator_wrapper<S1>& s1, forward_iterator_wrapper<S2>& s2) { return std::search(s1, s1, s2, s2); } +forward_iterator_wrapper<T1> +test2(forward_iterator_wrapper<T1>& s1, forward_iterator_wrapper<T2>& s2) +{ return std::search(s1, s1, s2, s2); } + forward_iterator_wrapper<X1> -test2(forward_iterator_wrapper<X1>& x1, forward_iterator_wrapper<X2>& x2) +test3(forward_iterator_wrapper<X1>& x1, forward_iterator_wrapper<X2>& x2) +{ return std::search(x1, x1, x2, x2, predicate); } + +forward_iterator_wrapper<V1> +test4(forward_iterator_wrapper<V1>& x1, forward_iterator_wrapper<V2>& x2) { return std::search(x1, x1, x2, x2, predicate); } diff --git a/libstdc++-v3/testsuite/25_algorithms/search/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/search/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..062f3e56233 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/search/requirements/explicit_instantiation/2.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type; + + template iterator_type search(iterator_type, iterator_type, + iterator_type, iterator_type); + + template iterator_type search(iterator_type, iterator_type, + iterator_type, iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/search/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/search/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..431cfc1fec9 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/search/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type; + + template iterator_type search(iterator_type, iterator_type, + iterator_type, iterator_type); + + template iterator_type search(iterator_type, iterator_type, + iterator_type, iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc b/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc index 7aeaac34b0b..2a9b0f42a09 100644 --- a/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc +++ b/libstdc++-v3/testsuite/25_algorithms/search_n/iterator.cc @@ -52,12 +52,15 @@ lexstep(int* start, int length) return !carry; } -using __gnu_test::test_container; -using __gnu_test::random_access_iterator_wrapper; -using __gnu_test::bidirectional_iterator_wrapper; -using __gnu_test::forward_iterator_wrapper; +int main() +{ + using __gnu_test::test_container; + using __gnu_test::random_access_iterator_wrapper; + using __gnu_test::bidirectional_iterator_wrapper; + using __gnu_test::forward_iterator_wrapper; + + using std::search_n; -int main() { test_container<int,forward_iterator_wrapper> con(array1,array1 + 10); VERIFY(search_n(con.end(), con.end(), 0, 1) == con.end()); VERIFY(search_n(con.end(), con.end(), 1, 1) == con.end()); diff --git a/libstdc++-v3/testsuite/25_algorithms/search_n/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/search_n/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..8ff2badc157 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/search_n/requirements/explicit_instantiation/2.cc @@ -0,0 +1,50 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::size_t size_type; + typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type; + + template iterator_type search_n(iterator_type, iterator_type, + size_type, const value_type&); + + template iterator_type search_n(iterator_type, iterator_type, + size_type, const value_type&, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/search_n/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/search_n/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..93c31798a81 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/search_n/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::size_t size_type; + typedef std::pointer_to_binary_function<value_type, value_type, bool> predicate_type; + + template iterator_type search_n(iterator_type, iterator_type, + size_type, const value_type&); + + template iterator_type search_n(iterator_type, iterator_type, + size_type, const value_type&, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/set_difference/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/set_difference/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..0ed15900273 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/set_difference/requirements/explicit_instantiation/2.cc @@ -0,0 +1,51 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type set_difference(iterator_type, iterator_type, + iterator_type, + iterator_type, iterator_type); + + template iterator_type set_difference(iterator_type, iterator_type, + iterator_type, iterator_type, + iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/set_difference/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/set_difference/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..96ee6805fcf --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/set_difference/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,50 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type set_difference(iterator_type, iterator_type, + iterator_type, + iterator_type, iterator_type); + + template iterator_type set_difference(iterator_type, iterator_type, + iterator_type, iterator_type, + iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/set_intersection/34730.cc b/libstdc++-v3/testsuite/25_algorithms/set_intersection/34730.cc new file mode 100644 index 00000000000..66aef0f99df --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/set_intersection/34730.cc @@ -0,0 +1,51 @@ +// Copyright (C) 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile } + +// libstdc++/34730 + +#include <string> +#include <vector> +#include <algorithm> + +using namespace std; + +typedef pair<int, string> intstring; + +struct intstrcmp +{ + bool + operator()(const string& x, const intstring& y) const + { return x < y.second; } + + bool + operator()(const intstring& x, const string& y) const + { return x.second < y; } +}; + +void test01() +{ + vector<string> vec1; + vector<intstring> vec2; + vector<intstring> vec3; + set_intersection(vec2.begin(), vec2.end(), + vec1.begin(), vec1.end(), + back_inserter(vec3), intstrcmp()); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/set_intersection/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/set_intersection/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..812daaa02d1 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/set_intersection/requirements/explicit_instantiation/2.cc @@ -0,0 +1,51 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type set_intersection(iterator_type, iterator_type, + iterator_type, + iterator_type, iterator_type); + + template iterator_type set_intersection(iterator_type, iterator_type, + iterator_type, iterator_type, + iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/set_intersection/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/set_intersection/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..f877b65d9ff --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/set_intersection/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,50 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type set_intersection(iterator_type, iterator_type, + iterator_type, + iterator_type, iterator_type); + + template iterator_type set_intersection(iterator_type, iterator_type, + iterator_type, iterator_type, + iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/set_symmetric_difference/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/set_symmetric_difference/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..8f753edafc1 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/set_symmetric_difference/requirements/explicit_instantiation/2.cc @@ -0,0 +1,51 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type set_symmetric_difference(iterator_type, iterator_type, + iterator_type, iterator_type, + iterator_type); + + template iterator_type set_symmetric_difference(iterator_type, iterator_type, + iterator_type, iterator_type, + iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/set_symmetric_difference/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/set_symmetric_difference/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..c2298592d44 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/set_symmetric_difference/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,50 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type set_symmetric_difference(iterator_type, iterator_type, + iterator_type, iterator_type, + iterator_type); + + template iterator_type set_symmetric_difference(iterator_type, iterator_type, + iterator_type, iterator_type, + iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/set_union/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/set_union/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..56fdda16b9c --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/set_union/requirements/explicit_instantiation/2.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type set_union(iterator_type, iterator_type, iterator_type, + iterator_type, iterator_type); + + template iterator_type set_union(iterator_type, iterator_type, iterator_type, + iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/set_union/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/set_union/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..815943c3541 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/set_union/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type set_union(iterator_type, iterator_type, iterator_type, + iterator_type, iterator_type); + + template iterator_type set_union(iterator_type, iterator_type, iterator_type, + iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/sort/1.cc b/libstdc++-v3/testsuite/25_algorithms/sort/1.cc new file mode 100644 index 00000000000..c28db2b87b4 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/sort/1.cc @@ -0,0 +1,86 @@ +// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.1 algorithms, sort() + +#include <algorithm> +#include <testsuite_hooks.h> + +bool test __attribute__((unused)) = true; + +const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; +const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19}; +const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; +const int N = sizeof(A) / sizeof(int); +const int logN = 3; // ln(N) rounded up +const int P = 7; + +// comparison predicate for stable_sort: order by rightmost digit +struct CompLast +{ + bool + operator()(const int x, const int y) + { return x % 10 < y % 10; } +}; + +// This functor has the equivalent functionality of std::geater<>, +// but there is no dependency on <functional> and it also tracks the +// number of invocations since creation. +class Gt +{ +public: + static int count() { return itsCount; } + static void reset() { itsCount = 0; } + + bool + operator()(const int& x, const int& y) + { + ++itsCount; + return x > y; + } + +private: + static int itsCount; +}; + +int Gt::itsCount = 0; + + +// 25.3.1.1 sort() +void +test01() +{ + int s1[N]; + std::copy(B, B + N, s1); + VERIFY(std::equal(s1, s1 + N, B)); + + std::sort(s1, s1 + N); + VERIFY(std::equal(s1, s1 + N, A)); + + Gt gt; + gt.reset(); + std::sort(s1, s1 + N, gt); + VERIFY(std::equal(s1, s1 + N, C)); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/backward/header_rope_h.cc b/libstdc++-v3/testsuite/25_algorithms/sort/34095.cc index 19edfbbffca..46e906b5bc5 100644 --- a/libstdc++-v3/testsuite/backward/header_rope_h.cc +++ b/libstdc++-v3/testsuite/25_algorithms/sort/34095.cc @@ -1,6 +1,4 @@ -// 2002-03-15 Philipp Thomas <pthomas@suse.de> - -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2008 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 @@ -18,14 +16,18 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. -// backward header rope.h - -#include <rope.h> -#include <testsuite_hooks.h> +#include <vector> +#include <algorithm> -// { dg-options "-Wno-deprecated" } +// libstdc++/34095 +void test01() +{ + std::vector<std::vector<int> > v(20000); + std::sort(v.begin(), v.end()); +} -int main(void) +int main() { + test01(); return 0; } diff --git a/libstdc++-v3/testsuite/backward/header_slist_h.cc b/libstdc++-v3/testsuite/25_algorithms/sort/34636.cc index 3a59789061f..9523775300d 100644 --- a/libstdc++-v3/testsuite/backward/header_slist_h.cc +++ b/libstdc++-v3/testsuite/25_algorithms/sort/34636.cc @@ -1,6 +1,4 @@ -// 2002-03-15 Philipp Thomas <pthomas@suse.de> - -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2008 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 @@ -18,14 +16,18 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. -// backward header slist.h - -#include <slist.h> -#include <testsuite_hooks.h> +#include <vector> +#include <algorithm> -// { dg-options "-Wno-deprecated" } +// libstdc++/34636 +void test01() +{ + std::vector<std::vector<int> > v(2); + std::sort(v.begin(), v.end()); +} -int main(void) +int main() { + test01(); return 0; } diff --git a/libstdc++-v3/testsuite/25_algorithms/sort/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/sort/moveable.cc new file mode 100644 index 00000000000..168374fa658 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/sort/moveable.cc @@ -0,0 +1,64 @@ +// { dg-require-rvalref "" } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.3.1 algorithms, sort() + +#undef _GLIBCXX_CONCEPT_CHECKS +#define _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + +#include <algorithm> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +bool test __attribute__((unused)) = true; + +using __gnu_test::test_container; +using __gnu_test::random_access_iterator_wrapper; +using __gnu_test::rvalstruct; +using std::partial_sort; + +typedef test_container<rvalstruct, random_access_iterator_wrapper> Container; + + +const int A[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, + 17, 8, 18, 9, 19}; +const int N = sizeof(A) / sizeof(int); + +// 25.3.1.1 sort() +void +test01() +{ + rvalstruct s1[N]; + std::copy(A, A + N, s1); + Container con(s1, s1 + N); + std::sort(con.begin(), con.end()); + VERIFY(s1[0].valid); + for(int i = 1; i < N; ++i) + VERIFY(s1[i].val>s1[i-1].val && s1[i].valid); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/sort/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/sort/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..7b417325187 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/sort/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void sort(iterator_type, iterator_type); + template void sort(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/sort/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/sort/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..ab354d000e8 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/sort/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void sort(iterator_type, iterator_type); + template void sort(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/sort/vectorbool.cc b/libstdc++-v3/testsuite/25_algorithms/sort/vectorbool.cc new file mode 100644 index 00000000000..04d69f02f3e --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/sort/vectorbool.cc @@ -0,0 +1,44 @@ +// Copyright (C) 2005 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.3.1 algorithms, sort() + +#include <algorithm> +#include <vector> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector<bool> b; + b.push_back(false); + b.push_back(true); + b.push_back(false); + b.push_back(true); + std::sort(b.begin(), b.end()); + VERIFY( b[0] == false && b[1] == false && b[2] == true && b[3] == true ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/sort_heap/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/sort_heap/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..2b68d9444a5 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/sort_heap/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ + +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void sort_heap(iterator_type, iterator_type); + template void sort_heap(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/sort_heap/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/sort_heap/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..62a1f285000 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/sort_heap/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ + +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void sort_heap(iterator_type, iterator_type); + template void sort_heap(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/stable_partition/1.cc b/libstdc++-v3/testsuite/25_algorithms/stable_partition/1.cc new file mode 100644 index 00000000000..29188f882ed --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/stable_partition/1.cc @@ -0,0 +1,56 @@ +// Copyright (C) 2001 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 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without Pred 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.2.12 [lib.alg.partitions] Partitions. + +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> + +bool test __attribute__((unused)) = true; + +const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; +const int B[] = {2, 4, 6, 8, 10, 12, 14, 16, 1, 3, 5, 7, 9, 11, 13, 15, 17}; +const int N = sizeof(A) / sizeof(int); + +struct Pred +{ + bool + operator()(const int& x) const + { return (x % 2) == 0; } +}; + +// 25.2.12 stable_partition() +void +test02() +{ + using std::stable_partition; + + int s1[N]; + std::copy(A, A + N, s1); + + stable_partition(s1, s1 + N, Pred()); + VERIFY(std::equal(s1, s1 + N, B)); +} + +int +main() +{ + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..fafcf50cd68 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type stable_partition(iterator_type, iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..c72b74ecfda --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/stable_partition/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, bool> predicate_type; + + template iterator_type stable_partition(iterator_type, iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/stable_sort/2.cc b/libstdc++-v3/testsuite/25_algorithms/stable_sort/2.cc new file mode 100644 index 00000000000..3d8299a75a1 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/stable_sort/2.cc @@ -0,0 +1,89 @@ +// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.1 algorithms, sort() + +#include <algorithm> +#include <testsuite_hooks.h> + +bool test __attribute__((unused)) = true; + +const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; +const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19}; +const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; +const int N = sizeof(A) / sizeof(int); +const int logN = 3; // ln(N) rounded up +const int P = 7; + +// comparison predicate for stable_sort: order by rightmost digit +struct CompLast +{ + bool + operator()(const int x, const int y) + { return x % 10 < y % 10; } +}; + +// This functor has the equivalent functionality of std::geater<>, +// but there is no dependency on <functional> and it also tracks the +// number of invocations since creation. +class Gt +{ +public: + static int count() { return itsCount; } + static void reset() { itsCount = 0; } + + bool + operator()(const int& x, const int& y) + { + ++itsCount; + return x > y; + } + +private: + static int itsCount; +}; + +int Gt::itsCount = 0; + +// 25.3.1.2 stable_sort() +void +test02() +{ + int s1[N]; + std::copy(A, A + N, s1); + VERIFY(std::equal(s1, s1 + N, A)); + + std::stable_sort(s1, s1 + N, CompLast()); + VERIFY(std::equal(s1, s1 + N, B)); + + std::stable_sort(s1, s1 + N); + VERIFY(std::equal(s1, s1 + N, A)); + + Gt gt; + gt.reset(); + std::stable_sort(s1, s1 + N, gt); + VERIFY(std::equal(s1, s1 + N, C)); + VERIFY(gt.count() <= N * logN * logN); +} + +int +main() +{ + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/stable_sort/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/stable_sort/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..e5235f278e5 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/stable_sort/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ + +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void stable_sort(iterator_type, iterator_type); + template void stable_sort(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/stable_sort/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/stable_sort/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..0e79ea26c10 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/stable_sort/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ + +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template void stable_sort(iterator_type, iterator_type); + template void stable_sort(iterator_type, iterator_type, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/swap/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/swap/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..1a2ae902fe3 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/swap/requirements/explicit_instantiation/2.cc @@ -0,0 +1,43 @@ + +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + + template void swap(value_type&, value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/swap/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/swap/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..6bd282bdc6f --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/swap/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,43 @@ + +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + + template void swap(value_type&, value_type&); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/swap_ranges/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/swap_ranges/moveable.cc new file mode 100644 index 00000000000..f1d842441a9 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/swap_ranges/moveable.cc @@ -0,0 +1,44 @@ +// { dg-do compile } +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.2.4 Swap Ranges + +#undef _GLIBCXX_CONCEPT_CHECKS + +#include <algorithm> +#include <testsuite_iterators.h> + +using __gnu_test::forward_iterator_wrapper; + +class X +{ + X(); + X(const X&); + void operator=(const X&); +}; + +void +swap(X&, X&) { } + +void +test1(forward_iterator_wrapper<X>& begin, forward_iterator_wrapper<X>& end, + forward_iterator_wrapper<X>& begin2) +{ std::swap_ranges(begin, end, begin2); } diff --git a/libstdc++-v3/testsuite/25_algorithms/swap_ranges/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/swap_ranges/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..4ead40aeb7a --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/swap_ranges/requirements/explicit_instantiation/2.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template iterator_type swap_ranges(iterator_type, iterator_type, + iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/swap_ranges/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/swap_ranges/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..f4ca2fa8327 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/swap_ranges/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template iterator_type swap_ranges(iterator_type, iterator_type, + iterator_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/transform/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/transform/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..730b8fa898b --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/transform/requirements/explicit_instantiation/2.cc @@ -0,0 +1,49 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, value_type> operator1_type; + typedef std::pointer_to_binary_function<value_type, value_type, value_type> operator2_type; + + template iterator_type transform(iterator_type, iterator_type, iterator_type, + operator1_type); + template iterator_type transform(iterator_type, iterator_type, iterator_type, + iterator_type, operator2_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/transform/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/transform/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..d8ec04317bf --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/transform/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::pointer_to_unary_function<value_type, value_type> operator1_type; + typedef std::pointer_to_binary_function<value_type, value_type, value_type> operator2_type; + + template iterator_type transform(iterator_type, iterator_type, iterator_type, + operator1_type); + template iterator_type transform(iterator_type, iterator_type, iterator_type, + iterator_type, operator2_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/unique/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/unique/moveable.cc new file mode 100644 index 00000000000..13bcc1b22fd --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique/moveable.cc @@ -0,0 +1,73 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// 25.2.8 [lib.alg.unique] Unique + +#undef _GLIBCXX_CONCEPT_CHECKS + +#include <vector> +#include <algorithm> +#include <functional> +#include <testsuite_hooks.h> +#include <testsuite_iterators.h> +#include <testsuite_rvalref.h> + +using __gnu_test::test_container; +using __gnu_test::forward_iterator_wrapper; +using __gnu_test::rvalstruct; + +typedef test_container<rvalstruct, forward_iterator_wrapper> Container; + +void test01() +{ + bool test __attribute__((unused)) = true; + + int intarray1[] = {1, 4, 4, 6, 1, 2, 2, 3, 1, 6, 6, 6, 5, 7, 5, 4, 4}; + int intarray2[] = {1, 1, 1, 2, 2, 1, 1, 7, 6, 6, 7, 8, 8, 8, 8, 9, 9}; + + const int N = sizeof(intarray1) / sizeof(int); + + rvalstruct T1[N]; + rvalstruct T2[N]; + + std::copy(intarray1,intarray1 + N, T1); + std::copy(intarray2,intarray2 + N, T2); + + const int A1[] = {1, 4, 6, 1, 2, 3, 1, 6, 5, 7, 5, 4}; + const int B1[] = {1, 2, 1, 7, 6, 7, 8, 9}; + + Container con(T1, T1 + N); + + VERIFY(std::unique(con.begin(), con.end()).ptr - T1 == 12); + for(int i = 0; i < 12; ++i) + VERIFY(T1[i].val == A1[i]); + + Container con2(T2, T2 + N); + VERIFY(std::unique(con2.begin(), con2.end()).ptr - T2 == 8); + for(int i = 0; i < 8; ++i) + VERIFY(T2[i].val == B1[i]); +} + + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/unique/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/unique/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..7c1eeebbdba --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique/requirements/explicit_instantiation/2.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> predicate_type; + + template iterator_type unique(iterator_type, iterator_type); + template iterator_type unique(iterator_type, iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/unique/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/unique/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..2eb368a6a59 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> predicate_type; + + template iterator_type unique(iterator_type, iterator_type); + template iterator_type unique(iterator_type, iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..dbed82a0013 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/2.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* in_iterator_type; + typedef value_type* out_iterator_type; + typedef std::less<value_type> predicate_type; + + template out_iterator_type unique_copy(in_iterator_type, in_iterator_type, out_iterator_type); + template out_iterator_type unique_copy(in_iterator_type, in_iterator_type, out_iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..ef1e41ff058 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/unique_copy/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,46 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* in_iterator_type; + typedef value_type* out_iterator_type; + typedef std::less<value_type> predicate_type; + + template out_iterator_type unique_copy(in_iterator_type, in_iterator_type, out_iterator_type); + template out_iterator_type unique_copy(in_iterator_type, in_iterator_type, out_iterator_type, predicate_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/upper_bound/2.cc b/libstdc++-v3/testsuite/25_algorithms/upper_bound/2.cc new file mode 100644 index 00000000000..1fac53cd730 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/upper_bound/2.cc @@ -0,0 +1,81 @@ +// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 25.3.3 [lib.alg.binary.search] Binary search algorithms. + +#include <algorithm> +#include <testsuite_hooks.h> + +bool test __attribute__((unused)) = true; + +const int A[] = {1, 2, 3, 3, 3, 5, 8}; +const int C[] = {8, 5, 3, 3, 3, 2, 1}; +const int N = sizeof(A) / sizeof(int); + +// A comparison, equalivalent to std::greater<int> without the +// dependency on <functional>. +struct gt +{ + bool + operator()(const int& x, const int& y) const + { return x > y; } +}; + +// Each test performs general-case, bookend, not-found condition, +// and predicate functional checks. + +// 25.3.3.2 upper_bound, with and without comparison predicate +void +test02() +{ + using std::upper_bound; + + const int first = A[0]; + const int last = A[N - 1]; + + const int* p = upper_bound(A, A + N, 3); + VERIFY(p == A + 5); + + const int* q = upper_bound(A, A + N, first); + VERIFY(q == A + 1); + + const int* r = upper_bound(A, A + N, last); + VERIFY(r == A + N); + + const int* s = upper_bound(A, A + N, 4); + VERIFY(s == A + 5); + + const int* t = upper_bound(C, C + N, 3, gt()); + VERIFY(t == C + 5); + + const int* u = upper_bound(C, C + N, first, gt()); + VERIFY(u == C + N); + + const int* v = upper_bound(C, C + N, last, gt()); + VERIFY(v == C + 1); + + const int* w = upper_bound(C, C + N, 4, gt()); + VERIFY(w == C + 2); +} + +int +main() +{ + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/25_algorithms/upper_bound/33613.cc b/libstdc++-v3/testsuite/25_algorithms/upper_bound/33613.cc new file mode 100644 index 00000000000..a178428d363 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/upper_bound/33613.cc @@ -0,0 +1,36 @@ +// 2007-10-02 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do compile } + +// libstdc++/33613 + +#include <algorithm> + +struct A { }; +struct B { }; + +bool ba(B, A); + +void test01(A* a, B b) +{ + std::upper_bound(a, a, b, ba); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/upper_bound/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/25_algorithms/upper_bound/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..66f80924471 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/upper_bound/requirements/explicit_instantiation/2.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <functional> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type upper_bound(iterator_type, iterator_type, + const value_type&); + template iterator_type upper_bound(iterator_type, iterator_type, + const value_type&, compare_type); +} diff --git a/libstdc++-v3/testsuite/25_algorithms/upper_bound/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/25_algorithms/upper_bound/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..fa155862460 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/upper_bound/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,47 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <algorithm> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + typedef std::less<value_type> compare_type; + + template iterator_type upper_bound(iterator_type, iterator_type, + const value_type&); + template iterator_type upper_bound(iterator_type, iterator_type, + const value_type&, compare_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/accumulate/1.cc b/libstdc++-v3/testsuite/26_numerics/accumulate/1.cc new file mode 100644 index 00000000000..046532debef --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/accumulate/1.cc @@ -0,0 +1,54 @@ +// Copyright (C) 2001, 2004 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 26.4.1 [lib.accumulate] + +#include <numeric> +#include <testsuite_hooks.h> + +int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; +const int NA = sizeof(A) / sizeof(int); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + int res = std::accumulate(A, A + NA, 11); + VERIFY( res == 66 ); +} + +bool B[] = {true, false, true, true, false, true, false, true, true, false}; +const int NB = sizeof(B) / sizeof(bool); + +void +test02() +{ + bool test __attribute__((unused)) = true; + + int res = std::accumulate(B, B + NB, 100); + VERIFY( res == 106 ); +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..58438b7d261 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/2.cc @@ -0,0 +1,41 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <numeric> +#include <testsuite_api.h> + +namespace std +{ + typedef __gnu_test::NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template value_type accumulate(iterator_type, iterator_type, value_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..da7e0d9046e --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/accumulate/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,41 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <numeric> +#include <testsuite_character.h> + +namespace std +{ + typedef __gnu_test::pod_int value_type; + typedef value_type* iterator_type; + + template value_type accumulate(iterator_type, iterator_type, value_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_operations/sum_diff.cc b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/1.cc index e5af462da01..5501f3f9fa6 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_operations/sum_diff.cc +++ b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/1.cc @@ -36,9 +36,6 @@ test01() std::adjacent_difference(A, A + N, D); VERIFY( std::equal(D, D + N, B) ); - - std::partial_sum(D, D + N, D); - VERIFY( std::equal(D, D + N, A) ); } int diff --git a/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..d304e49e257 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/2.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <numeric> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* input_iterator; + typedef value_type* output_iterator; + + template + output_iterator adjacent_difference(input_iterator, input_iterator, output_iterator); +} diff --git a/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..914afcda992 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/adjacent_difference/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,45 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <numeric> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* input_iterator; + typedef value_type* output_iterator; + + template + output_iterator adjacent_difference(input_iterator, input_iterator, output_iterator); +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc new file mode 100644 index 00000000000..c034f3a151f --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/25913.cc @@ -0,0 +1,47 @@ +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// { dg-do compile } + +#include <cmath> +#include <string> + +struct employee +: private std::string { }; + +struct manager +: public employee { }; + +bool isnormal(const employee&) +{ return false; } + +// libstdc++/25913 +void test01() +{ + manager m; + isnormal(m); +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc index f7b714fbcfa..dca23e73f6a 100644 --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc @@ -27,7 +27,8 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -// { dg-do compile { xfail { { *-*-linux* *-*-darwin* } || { uclibc || newlib } } } } +// { dg-do compile } +// { dg-xfail-if "" { { *-*-linux* *-*-darwin* } || { uclibc || newlib } } { "*" } { "" } } // { dg-excess-errors "" { target { { *-*-linux* *-*-darwin* } || { uclibc || newlib } } } } #include <math.h> diff --git a/libstdc++-v3/testsuite/26_numerics/headers/numeric/numeric_parallel_mode.cc b/libstdc++-v3/testsuite/26_numerics/headers/numeric/numeric_parallel_mode.cc new file mode 100644 index 00000000000..3e3b3de15dd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/numeric/numeric_parallel_mode.cc @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-D_GLIBCXX_PARALLEL -fopenmp" { target *-*-* } } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <numeric> diff --git a/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric.cc b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric.cc new file mode 100644 index 00000000000..d2d531e9ab6 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric.cc @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-fopenmp" { target *-*-* } } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <parallel/numeric> diff --git a/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed1.cc b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed1.cc new file mode 100644 index 00000000000..425fd59c34b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed1.cc @@ -0,0 +1,38 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-fopenmp" { target *-*-* } } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <parallel/numeric> +#include <numeric> +#include <vector> +#include <numeric> + +void test() +{ + typedef unsigned short value_type; + typedef std::vector<value_type> vector_type; + + const value_type c(0); + + vector_type v(10); + std::accumulate(v.begin(), v.end(), value_type(1)); + __gnu_parallel::accumulate(v.begin(), v.end(), value_type(1)); +} diff --git a/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed2.cc b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed2.cc new file mode 100644 index 00000000000..d7bdfc1a511 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/headers/numeric/parallel_numeric_mixed2.cc @@ -0,0 +1,43 @@ +// { dg-do compile } +// { dg-require-parallel-mode "" } +// { dg-options "-fopenmp" { target *-*-* } } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Make sure to test without _GLIBCXX_PARALLEL +#ifdef _GLIBCXX_PARALLEL +# undef _GLIBCXX_PARALLEL +#endif + +#include <parallel/numeric> +#include <numeric> +#include <vector> +#include <numeric> + +void test() +{ + typedef unsigned short value_type; + typedef std::vector<value_type> vector_type; + + const value_type c(0); + + vector_type v(10); + std::accumulate(v.begin(), v.end(), value_type(1)); + __gnu_parallel::accumulate(v.begin(), v.end(), value_type(1)); +} diff --git a/libstdc++-v3/testsuite/26_numerics/inner_product/1.cc b/libstdc++-v3/testsuite/26_numerics/inner_product/1.cc new file mode 100644 index 00000000000..d63c1d91099 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/inner_product/1.cc @@ -0,0 +1,56 @@ +// Copyright (C) 2001, 2004 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 26.4.2 [lib.inner_product] + +#include <numeric> +#include <testsuite_hooks.h> + +int A1[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; +int A2[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}; +const int NA = sizeof(A1) / sizeof(int); + +bool B1[] = {false, true, true, false, true, false, true, true, false, true}; +bool B2[] = {true, false, true, true, false, true, false, true, true, false}; +const int NB = sizeof(B1) / sizeof(bool); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + int res = std::inner_product(A1, A1 + NA, A2, 31); + VERIFY( res == 983 ); +} + +void +test02() +{ + bool test __attribute__((unused)) = true; + + int res = std::inner_product(B1, B1 + NB, B2, 100); + VERIFY( res == 102 ); +} + +int +main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..56e2edd55e5 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/2.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <numeric> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* iterator_type; + + template value_type inner_product(iterator_type, iterator_type, iterator_type, value_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..da72492e4cd --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/inner_product/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,43 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <numeric> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* iterator_type; + + template value_type inner_product(iterator_type, iterator_type, iterator_type, value_type); +} diff --git a/libstdc++-v3/testsuite/26_numerics/partial_sum/1.cc b/libstdc++-v3/testsuite/26_numerics/partial_sum/1.cc new file mode 100644 index 00000000000..ac336916656 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/partial_sum/1.cc @@ -0,0 +1,46 @@ +// Copyright (C) 2001, 2004 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 26.4.3 [lib.partial.sum] +// 26.4.4 [lib.adjacent.difference] + +#include <algorithm> +#include <numeric> +#include <testsuite_hooks.h> + +int A[] = {1, 4, 9, 16, 25, 36, 49, 64, 81, 100}; +int B[] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19}; +const int N = sizeof(A) / sizeof(int); + +void +test01() +{ + bool test __attribute__((unused)) = true; + + int D[N]; + + std::partial_sum(B, B + N, D); + VERIFY( std::equal(D, D + N, A) ); +} + +int +main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..0887e17b35b --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/2.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <numeric> +#include <testsuite_api.h> + +namespace std +{ + using __gnu_test::NonDefaultConstructible; + + typedef NonDefaultConstructible value_type; + typedef value_type* input_iterator; + typedef value_type* output_iterator; + + template output_iterator partial_sum(input_iterator, input_iterator, output_iterator); +} diff --git a/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/pod.cc b/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/pod.cc new file mode 100644 index 00000000000..381eb89307a --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/partial_sum/requirements/explicit_instantiation/pod.cc @@ -0,0 +1,44 @@ +// { dg-do compile } + +// 2007-09-20 Benjamin Kosnik <bkoz@redhat.com> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <numeric> +#include <testsuite_character.h> + +namespace std +{ + using __gnu_test::pod_int; + + typedef pod_int value_type; + typedef value_type* input_iterator; + typedef value_type* output_iterator; + + template output_iterator partial_sum(input_iterator, input_iterator, output_iterator); +} diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/slice.cc b/libstdc++-v3/testsuite/26_numerics/slice/1.cc index d7ad877d9d7..d7ad877d9d7 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/slice.cc +++ b/libstdc++-v3/testsuite/26_numerics/slice/1.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/slice_array/array_assignment.cc b/libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc index 34888be44e9..34888be44e9 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/slice_array/array_assignment.cc +++ b/libstdc++-v3/testsuite/26_numerics/slice_array/array_assignment.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/slice_array/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/26_numerics/slice_array/requirements/explicit_instantiation.cc index 09dfed62745..09dfed62745 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/slice_array/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/26_numerics/slice_array/requirements/explicit_instantiation.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/slice_array/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/slice_array/requirements/typedefs.cc index 15295511a1a..15295511a1a 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/slice_array/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/26_numerics/slice_array/requirements/typedefs.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/27867.cc b/libstdc++-v3/testsuite/26_numerics/valarray/27867.cc index 7c208f4b100..7c208f4b100 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/27867.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/27867.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/28277.cc b/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc index 52f4c714085..52f4c714085 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/28277.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/28277.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/30416.cc b/libstdc++-v3/testsuite/26_numerics/valarray/30416.cc index c51329221d5..c51329221d5 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/30416.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/30416.cc diff --git a/libstdc++-v3/testsuite/26_numerics/valarray/33084.cc b/libstdc++-v3/testsuite/26_numerics/valarray/33084.cc new file mode 100644 index 00000000000..aaacfe7ee59 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/valarray/33084.cc @@ -0,0 +1,48 @@ +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// { dg-do compile } + +#include <valarray> + +// libstdc++/33084 +void test01() +{ + std::valarray<char> vc(char(0), 10); + std::valarray<bool> res(10); + char c(0); + + res = vc == vc; + res = vc == c; + res = c == vc; +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/algo.cc b/libstdc++-v3/testsuite/26_numerics/valarray/algo.cc index a69ce65e079..a69ce65e079 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/algo.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/algo.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/binary_closure.cc b/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc index 7dbcfbd5228..7dbcfbd5228 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/binary_closure.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/binary_closure.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/const_bracket.cc b/libstdc++-v3/testsuite/26_numerics/valarray/const_bracket.cc index 512cbafd3ce..512cbafd3ce 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/const_bracket.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/const_bracket.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/dr543.cc b/libstdc++-v3/testsuite/26_numerics/valarray/dr543.cc index 9afa93a4b83..9afa93a4b83 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/dr543.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/dr543.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/name_lookup.cc b/libstdc++-v3/testsuite/26_numerics/valarray/name_lookup.cc index 735f65f5df7..735f65f5df7 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/name_lookup.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/name_lookup.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/operators.cc b/libstdc++-v3/testsuite/26_numerics/valarray/operators.cc index 70ad0b0e788..70ad0b0e788 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/operators.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/operators.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/explicit_instantiation.cc index d4d5e283048..d4d5e283048 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/explicit_instantiation.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/typedefs.cc index a6f28dc41a6..a6f28dc41a6 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/requirements/typedefs.cc diff --git a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/subset_assignment.cc b/libstdc++-v3/testsuite/26_numerics/valarray/subset_assignment.cc index 4ce22afb31a..4ce22afb31a 100644 --- a/libstdc++-v3/testsuite/26_numerics/numeric_arrays/valarray/subset_assignment.cc +++ b/libstdc++-v3/testsuite/26_numerics/valarray/subset_assignment.cc diff --git a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/4.cc b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/4.cc index dde8086999a..1c8d9ea21f1 100644 --- a/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/4.cc +++ b/libstdc++-v3/testsuite/27_io/basic_filebuf/open/char/4.cc @@ -1,6 +1,6 @@ // 2006-10-01 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007 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 @@ -18,11 +18,12 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-require-fileio "" } + #include <fstream> #include <testsuite_hooks.h> -// As an extension to Table 92, consistently with the C standards, we also -// allow in|out|app and in|out|app|binary. +// DR 596. void test01() { bool test __attribute__((unused)) = true; @@ -30,17 +31,38 @@ void test01() std::fstream scratch_file; + scratch_file.open(name, std::ios_base::app); + VERIFY( scratch_file ); + VERIFY( scratch_file.is_open() ); + scratch_file.close(); + scratch_file.open(name, std::ios_base::in | std::ios_base::out | std::ios_base::app); VERIFY( scratch_file ); VERIFY( scratch_file.is_open() ); scratch_file.close(); + scratch_file.open(name, std::ios_base::in | std::ios_base::app); + VERIFY( scratch_file ); + VERIFY( scratch_file.is_open() ); + scratch_file.close(); + + scratch_file.open(name, std::ios_base::app | std::ios_base::binary); + VERIFY( scratch_file ); + VERIFY( scratch_file.is_open() ); + scratch_file.close(); + scratch_file.open(name, std::ios_base::in | std::ios_base::out | std::ios_base::app | std::ios_base::binary); VERIFY( scratch_file ); VERIFY( scratch_file.is_open() ); scratch_file.close(); + + scratch_file.open(name, std::ios_base::in | std::ios_base::app + | std::ios_base::binary); + VERIFY( scratch_file ); + VERIFY( scratch_file.is_open() ); + scratch_file.close(); } int diff --git a/libstdc++-v3/testsuite/backward/header_hashtable_h.cc b/libstdc++-v3/testsuite/27_io/basic_iostream/cons/16251.C index 4184f11014f..0167d1db790 100644 --- a/libstdc++-v3/testsuite/backward/header_hashtable_h.cc +++ b/libstdc++-v3/testsuite/27_io/basic_iostream/cons/16251.C @@ -1,6 +1,4 @@ -// 2002-03-15 Philipp Thomas <pthomas@suse.de> - -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2008 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 @@ -18,14 +16,27 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. -// backward header hashtable.h +// 27.6.1.5 - Template class basic_iostream + +#include <iostream> -#include <hashtable.h> -#include <testsuite_hooks.h> +class mystream +: public std::iostream +{ +public: + mystream () { }; +}; -// { dg-options "-Wno-deprecated" } +// libstdc++/16251 +void test01() +{ + mystream x; + x.rdbuf(std::cout.rdbuf()); + x << std::endl; +} -int main(void) +int main() { + test01(); return 0; } diff --git a/libstdc++-v3/testsuite/27_io/basic_iostream/cons/2020.cc b/libstdc++-v3/testsuite/27_io/basic_iostream/cons/2020.cc index e0af3ebd3e6..014ab7164a8 100644 --- a/libstdc++-v3/testsuite/27_io/basic_iostream/cons/2020.cc +++ b/libstdc++-v3/testsuite/27_io/basic_iostream/cons/2020.cc @@ -1,6 +1,7 @@ // 1999-01-17 bkoz test functionality of basic_filebuf for char_type == char -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, +// 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -19,8 +20,7 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. -// 27.8.1.1 - Template class basic_filebuf -// NB: This file is for testing basic_filebuf with NO OTHER INCLUDES. +// 27.6.1.5 - Template class basic_iostream #include <iostream> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/pod/3983-2.cc b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/pod/3983-2.cc index 7a979be7d38..a5164dc94c9 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/pod/3983-2.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/extractors_character/pod/3983-2.cc @@ -1,6 +1,7 @@ // 2001-06-05 Benjamin Kosnik <bkoz@redhat.com> -// Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +// 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 @@ -50,10 +51,11 @@ void test03() bool test __attribute__((unused)) = true; // input streams - pod_ushort arr[6] = { value_type('a'), value_type('b'), - value_type('c'), value_type('d'), value_type('e') }; + pod_ushort arr[6] = { { value_type('a') }, { value_type('b') }, + { value_type('c') }, { value_type('d') }, + { value_type('e') } }; - try + try { iss >> arr; } diff --git a/libstdc++-v3/testsuite/27_io/basic_istream/peek/wchar_t/12296.cc b/libstdc++-v3/testsuite/27_io/basic_istream/peek/wchar_t/12296.cc index d4dd4f117d7..4f3c1b15758 100644 --- a/libstdc++-v3/testsuite/27_io/basic_istream/peek/wchar_t/12296.cc +++ b/libstdc++-v3/testsuite/27_io/basic_istream/peek/wchar_t/12296.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2004 Free Software Foundation +// Copyright (C) 2004, 2005, 2006, 2007 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 @@ -30,7 +30,7 @@ void test01() wistringstream stream; VERIFY( stream.rdstate() == ios_base::goodbit ); wistringstream::int_type c = stream.peek(); - VERIFY( c == istringstream::traits_type::eof() ); + VERIFY( c == wistringstream::traits_type::eof() ); VERIFY( stream.rdstate() == ios_base::eofbit ); } diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc index f79fb064ccc..9c68320bf17 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-3.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation +// Copyright (C) 2006, 2006 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 @@ -38,7 +38,7 @@ void test01() oss_01 << 'a'; VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == width ); + VERIFY( oss_01.str().size() == string::size_type(width) ); } int main() diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc index cc02979cb5e..3ef1f8c4362 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/char/28277-4.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation +// Copyright (C) 2006, 2007 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 @@ -39,7 +39,7 @@ void test01() oss_01 << str_01.c_str(); VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == width ); + VERIFY( oss_01.str().size() == string::size_type(width) ); } int main() diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc index 736c8a8ae94..6213ad1f4be 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-2.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation +// Copyright (C) 2006, 2007 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 @@ -39,7 +39,7 @@ void test01() oss_01 << str_01.c_str(); VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == width ); + VERIFY( oss_01.str().size() == wstring::size_type(width) ); } int main() diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc index ae13c5267e3..dc5ffe5dff2 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-3.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation +// Copyright (C) 2006, 2007 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 @@ -38,7 +38,7 @@ void test01() oss_01 << L'a'; VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == width ); + VERIFY( oss_01.str().size() == wstring::size_type(width) ); } int main() diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc index 1a13e04fc40..e80242cf0a7 100644 --- a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_character/wchar_t/28277-4.cc @@ -1,6 +1,6 @@ // 2006-10-12 Paolo Carlini <pcarlini@suse.de> -// Copyright (C) 2006 Free Software Foundation +// Copyright (C) 2006, 2007 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 @@ -39,7 +39,7 @@ void test01() oss_01 << str_01.c_str(); VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == width ); + VERIFY( oss_01.str().size() == wstring::size_type(width) ); } int main() diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc new file mode 100644 index 00000000000..71c93e8d1b9 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/char/error_code.cc @@ -0,0 +1,74 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <ostream> +#include <sstream> +#include <system_error> +#include <algorithm> +#include <testsuite_hooks.h> + +// Effects: os << ec.category().name() << ':' << ec.value(); +void test() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + char buf[64]; + error_code e1; + error_code e2(posix_error::bad_address); + string s, s1, s2; + + { + ostringstream ostr; + ostr << e1 << endl; + s1 = ostr.str(); + + if (ostr.rdstate() & ios_base::eofbit) + test = false; + } + VERIFY( test ); + VERIFY( find(s1.begin(), s1.end(), ':') != s1.end() ); + + sprintf(buf, "%i", e1.value()); + s = buf; + VERIFY( s1.find(s) != string::npos); + + { + ostringstream ostr; + ostr << e2 << endl; + s2 = ostr.str(); + + if (ostr.rdstate() & ios_base::eofbit) + test = false; + } + VERIFY( test ); + VERIFY( find(s2.begin(), s2.end(), ':') != s2.end() ); + + sprintf(buf, "%i", e2.value()); + s = buf; + VERIFY( s2.find(s) != string::npos); +} + +int +main() +{ + test(); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc new file mode 100644 index 00000000000..73c838b4399 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/basic_ostream/inserters_other/wchar_t/error_code.cc @@ -0,0 +1,75 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <ostream> +#include <sstream> +#include <system_error> +#include <algorithm> +#include <wchar.h> +#include <testsuite_hooks.h> + +// Effects: os << ec.category().name() << ':' << ec.value(); +void test() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + wchar_t buf[64]; + error_code e1; + error_code e2(posix_error::bad_address); + wstring s, s1, s2; + + { + wostringstream ostr; + ostr << e1 << endl; + s1 = ostr.str(); + + if (ostr.rdstate() & ios_base::eofbit) + test = false; + } + VERIFY( test ); + VERIFY( find(s1.begin(), s1.end(), L':') != s1.end() ); + + swprintf(buf, 64, L"%i", e1.value()); + s = buf; + VERIFY( s1.find(s) != string::npos); + + { + wostringstream ostr; + ostr << e2 << endl; + s2 = ostr.str(); + + if (ostr.rdstate() & ios_base::eofbit) + test = false; + } + VERIFY( test ); + VERIFY( find(s2.begin(), s2.end(), L':') != s2.end() ); + + swprintf(buf, 64, L"%i", e2.value()); + s = buf; + VERIFY( s2.find(s) != string::npos); +} + +int +main() +{ + test(); + return 0; +} diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc index ca3f919a823..83989ff400f 100644 --- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/char/1.cc @@ -106,11 +106,11 @@ void test01() buf01.pub_setg(lit01, lit01, (lit01 + i01)); VERIFY( i01 == buf01.in_avail() ); - VERIFY( buf01.pub_uflow() == lit01[0] ); + VERIFY( buf01.pub_uflow() == traits_type::to_int_type(lit01[0]) ); VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[1]) ); - VERIFY( buf01.pub_uflow() == lit01[1] ); + VERIFY( buf01.pub_uflow() == traits_type::to_int_type(lit01[1]) ); VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[2]) ); - VERIFY( buf01.pub_uflow() == lit01[2] ); + VERIFY( buf01.pub_uflow() == traits_type::to_int_type(lit01[2]) ); VERIFY( buf01.sgetc() == traits_type::eof() ); } diff --git a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/wchar_t/1.cc index ecd9b4c5f04..009af5d24b8 100644 --- a/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_streambuf/sgetc/wchar_t/1.cc @@ -106,11 +106,11 @@ void test01() buf01.pub_setg(lit01, lit01, (lit01 + i01)); VERIFY( i01 == buf01.in_avail() ); - VERIFY( buf01.pub_uflow() == lit01[0] ); + VERIFY( buf01.pub_uflow() == traits_type::to_int_type(lit01[0]) ); VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[1]) ); - VERIFY( buf01.pub_uflow() == lit01[1] ); + VERIFY( buf01.pub_uflow() == traits_type::to_int_type(lit01[1]) ); VERIFY( buf01.sgetc() == traits_type::to_int_type(lit01[2]) ); - VERIFY( buf01.pub_uflow() == lit01[2] ); + VERIFY( buf01.pub_uflow() == traits_type::to_int_type(lit01[2]) ); VERIFY( buf01.sgetc() == traits_type::eof() ); } diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc index 9fc9a62cfd4..60ae6812fae 100644 --- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/char/1.cc @@ -1,6 +1,7 @@ // 981208 bkoz test functionality of basic_stringbuf for char_type == char -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, +// 2006, 2007 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -47,8 +48,8 @@ void test04() int_type c1 = strb_01.sbumpc(); int_type c2 = strb_02.sbumpc(); VERIFY( c1 != c2 ); - VERIFY( c1 == str_01[0] ); - VERIFY( c2 == str_02[0] ); //should equal first letter at this point + VERIFY( c1 == traits_type::to_int_type(str_01[0]) ); + VERIFY( c2 == traits_type::to_int_type(str_02[0]) ); //should equal first letter at this point int_type c3 = strb_01.sbumpc(); int_type c4 = strb_02.sbumpc(); VERIFY( c1 != c2 ); diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc index fa9dda8a8d8..5d583089883 100644 --- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sbumpc/wchar_t/1.cc @@ -47,8 +47,8 @@ void test04() int_type c1 = strb_01.sbumpc(); int_type c2 = strb_02.sbumpc(); VERIFY( c1 != c2 ); - VERIFY( c1 == str_01[0] ); - VERIFY( c2 == str_02[0] ); //should equal first letter at this point + VERIFY( c1 == traits_type::to_int_type(str_01[0]) ); + VERIFY( c2 == traits_type::to_int_type(str_02[0]) ); //should equal first letter at this point int_type c3 = strb_01.sbumpc(); int_type c4 = strb_02.sbumpc(); VERIFY( c1 != c2 ); diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc index 4a2b54821cc..6b6ad590440 100644 --- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/char/1.cc @@ -1,6 +1,7 @@ // 981208 bkoz test functionality of basic_stringbuf for char_type == char -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// 2006, 2007 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -83,8 +84,8 @@ void test04() c2 = strb_02.sgetc(); VERIFY( c6 == c1 ); //just by co-incidence both o's VERIFY( c7 != c2 ); // n != i - VERIFY( c1 == str_01[13] ); - VERIFY( c2 == str_02[13] ); //should equal fourteenth letter at this point + VERIFY( c1 == traits_type::to_int_type(str_01[13]) ); + VERIFY( c2 == traits_type::to_int_type(str_02[13]) ); //should equal fourteenth letter at this point strmsz_1 = strb_03.sgetn(carray1, 10); VERIFY( !strmsz_1 ); //zero strmsz_1 = strb_02.in_avail(); diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/wchar_t/1.cc index b7fda2f15c0..f77cb97c376 100644 --- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/sgetn/wchar_t/1.cc @@ -1,6 +1,7 @@ // 981208 bkoz test functionality of basic_stringbuf for char_type == wchar_t -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, +// 2006, 2007 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -83,8 +84,8 @@ void test04() c2 = strb_02.sgetc(); VERIFY( c6 == c1 ); //just by co-incidence both o's VERIFY( c7 != c2 ); // n != i - VERIFY( c1 == str_01[13] ); - VERIFY( c2 == str_02[13] ); //should equal fourteenth letter at this point + VERIFY( c1 == traits_type::to_int_type(str_01[13]) ); + VERIFY( c2 == traits_type::to_int_type(str_02[13]) ); //should equal fourteenth letter at this point strmsz_1 = strb_03.sgetn(carray1, 10); VERIFY( !strmsz_1 ); //zero strmsz_1 = strb_02.in_avail(); diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc index ddaa51e5bde..1383f83fb0d 100644 --- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/char/1.cc @@ -1,6 +1,7 @@ // 981208 bkoz test functionality of basic_stringbuf for char_type == char -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, +// 2006, 2007 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -62,8 +63,8 @@ void test04() c7 = strb_02.snextc(); VERIFY( c6 != c8 ); VERIFY( c7 != c9 ); - VERIFY( c6 == str_01[3] ); - VERIFY( c7 == str_02[3] ); //should equal fourth letter at this point + VERIFY( c6 == traits_type::to_int_type(str_01[3]) ); + VERIFY( c7 == traits_type::to_int_type(str_02[3]) ); //should equal fourth letter at this point c5 = strb_03.snextc(); VERIFY( c5 == traits_type::eof() ); } diff --git a/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/wchar_t/1.cc index 3cfaab2362d..955390b8030 100644 --- a/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/27_io/basic_stringbuf/snextc/wchar_t/1.cc @@ -1,6 +1,7 @@ // 981208 bkoz test functionality of basic_stringbuf for char_type == wchar_t -// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +// 2006, 2007 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -62,8 +63,8 @@ void test04() c7 = strb_02.snextc(); VERIFY( c6 != c8 ); VERIFY( c7 != c9 ); - VERIFY( c6 == str_01[3] ); - VERIFY( c7 == str_02[3] ); //should equal fourth letter at this point + VERIFY( c6 == traits_type::to_int_type(str_01[3]) ); + VERIFY( c7 == traits_type::to_int_type(str_02[3]) ); //should equal fourth letter at this point c5 = strb_03.snextc(); VERIFY( c5 == traits_type::eof() ); } diff --git a/libstdc++-v3/testsuite/27_io/fpos/14320-1.cc b/libstdc++-v3/testsuite/27_io/fpos/14320-1.cc index 85e1d432eb3..1e492d06d03 100644 --- a/libstdc++-v3/testsuite/27_io/fpos/14320-1.cc +++ b/libstdc++-v3/testsuite/27_io/fpos/14320-1.cc @@ -20,7 +20,7 @@ // 27.4.3 fpos -// { dg-do run { xfail *-*-* } } +// { dg-do run } #include <typeinfo> #include <limits> @@ -36,6 +36,11 @@ void test01() typedef istreambuf_iterator<char>::difference_type Distance; bool found = false; + // The C++ standard didn't originally have "long long", however that + // type will be in the C++0x standard and testing for it allows + // ilp32 targets to pass this test when `Distance' is 64 bits. + if (typeid(Distance) == typeid(long long int)) + found = true; if (typeid(Distance) == typeid(long int)) found = true; if (typeid(Distance) == typeid(int)) diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc index ec27d187e7b..5325523a0cc 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/assign_neg.cc @@ -1,6 +1,7 @@ // { dg-do compile } -// Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 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 @@ -40,7 +41,7 @@ void test01() test_base io2; io1 = io2; } -// { dg-error "synthesized" "" { target *-*-* } 41 } -// { dg-error "within this context" "" { target *-*-* } 34 } -// { dg-error "is private" "" { target *-*-* } 790 } +// { dg-error "synthesized" "" { target *-*-* } 42 } +// { dg-error "within this context" "" { target *-*-* } 35 } +// { dg-error "is private" "" { target *-*-* } 786 } // { dg-error "operator=" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc index 0c6bb296d38..536682eb6f3 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/cons/copy_neg.cc @@ -1,6 +1,7 @@ // { dg-do compile } -// Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 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 @@ -40,7 +41,7 @@ void test02() test_base io1; test_base io2 = io1; } -// { dg-error "within this context" "" { target *-*-* } 35 } -// { dg-error "synthesized" "" { target *-*-* } 41 } -// { dg-error "is private" "" { target *-*-* } 787 } +// { dg-error "within this context" "" { target *-*-* } 36 } +// { dg-error "synthesized" "" { target *-*-* } 42 } +// { dg-error "is private" "" { target *-*-* } 783 } // { dg-error "copy constructor" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/27_io/objects/char/9.cc b/libstdc++-v3/testsuite/27_io/objects/char/9.cc index 6ad7c47278e..4da987b94f8 100644 --- a/libstdc++-v3/testsuite/27_io/objects/char/9.cc +++ b/libstdc++-v3/testsuite/27_io/objects/char/9.cc @@ -17,6 +17,8 @@ // with this library; see the file COPYING. If not, write to the Free // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. + +// { dg-require-fileio "" } #include <iostream> #include <cstdio> diff --git a/libstdc++-v3/testsuite/Makefile.am b/libstdc++-v3/testsuite/Makefile.am index a881b9f1a2a..407d7c95f91 100644 --- a/libstdc++-v3/testsuite/Makefile.am +++ b/libstdc++-v3/testsuite/Makefile.am @@ -1,6 +1,6 @@ ## Makefile for the testsuite subdirectory of the GNU C++ Standard library. ## -## Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +## Copyright (C) 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc. ## ## This file is part of the libstdc++ version 3 distribution. ## Process this file with automake to produce Makefile.in. @@ -25,9 +25,6 @@ AUTOMAKE_OPTIONS = dejagnu nostdinc include $(top_srcdir)/fragment.am -AM_MAKEFLAGS = -j1 -AM_RUNTESTFLAGS = - # Generated lists of files to run. All of these names are valid make # targets, if you wish to generate a list manually. lists_of_files = \ @@ -114,20 +111,42 @@ check-performance: testsuite_files_performance ${performance_script} -@(chmod + ${check_performance_script}; \ ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir}) -# Generates the plots and graphs for performance testing. -doc_performance_script=${glibcxx_srcdir}/scripts/make_graphs.py -doc-performance: - -@(chmod + ${doc_performance_script}; \ - ${doc_performance_script} ${glibcxx_srcdir} \ - ${glibcxx_builddir}/testsuite \ - ${glibcxx_srcdir}/testsuite/data/make_graph_htmls.xml \ - ${glibcxx_srcdir}/testsuite/data/make_graph_test_infos.xml local g++) +# Runs the testsuite in parallel mode. +libgomp_dir=${glibcxx_builddir}/../libgomp +libgomp_flags=-B${glibcxx_builddir}/../libgomp \ + -I${glibcxx_builddir}/../libgomp \ + -L${glibcxx_builddir}/../libgomp/.libs -lgomp + +atomic_flags=$(ATOMIC_FLAGS) +parallel_flags="unix/-D_GLIBCXX_PARALLEL/-fopenmp" + +check-parallel: site.exp + -@(if test ! -d $${libgomp_dir}; then \ + echo "Testing parallel mode failed as libgomp not present."; \ + exit 1; \ + fi; \ + outputdir=parallel; export outputdir; \ + if test ! -d $${outputdir}; then \ + mkdir $${outputdir}; \ + fi; \ + srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ + EXPECT=$(EXPECT); export EXPECT; \ + $(MAKE) CXXFLAGS="$(atomic_flags) $(libgomp_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(parallel_flags)" check-DEJAGNU; ) + +check-performance-parallel: testsuite_files_performance ${performance_script} + -@(chmod + ${check_performance_script}; \ + CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \ + ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir}) .PHONY: baseline_symbols new-abi-baseline \ - check-abi check-compile check-performance + check-abi check-compile check-performance check-parallel # By adding these files here, automake will remove them for 'make clean' CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \ testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \ - *.o *.cc *.a *.so *.xml + *.s *.o *.cc *.a *.so *.xml + +# To remove directories. +clean-local: + rm -rf parallel diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in index f700c5b524d..44749597aef 100644 --- a/libstdc++-v3/testsuite/Makefile.in +++ b/libstdc++-v3/testsuite/Makefile.in @@ -41,6 +41,7 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ subdir = testsuite ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \ + $(top_srcdir)/../config/futex.m4 \ $(top_srcdir)/../config/iconv.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ $(top_srcdir)/../config/lib-ld.m4 \ @@ -75,6 +76,7 @@ AMTAR = @AMTAR@ AR = @AR@ AS = @AS@ ATOMICITY_SRCDIR = @ATOMICITY_SRCDIR@ +ATOMIC_FLAGS = @ATOMIC_FLAGS@ ATOMIC_WORD_SRCDIR = @ATOMIC_WORD_SRCDIR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -112,6 +114,8 @@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_PARALLEL_FALSE = @ENABLE_PARALLEL_FALSE@ +ENABLE_PARALLEL_TRUE = @ENABLE_PARALLEL_TRUE@ ENABLE_SYMVERS_DARWIN_FALSE = @ENABLE_SYMVERS_DARWIN_FALSE@ ENABLE_SYMVERS_DARWIN_TRUE = @ENABLE_SYMVERS_DARWIN_TRUE@ ENABLE_SYMVERS_FALSE = @ENABLE_SYMVERS_FALSE@ @@ -122,6 +126,7 @@ ENABLE_SYMVERS_GNU_TRUE = @ENABLE_SYMVERS_GNU_TRUE@ ENABLE_SYMVERS_TRUE = @ENABLE_SYMVERS_TRUE@ ENABLE_VISIBILITY_FALSE = @ENABLE_VISIBILITY_FALSE@ ENABLE_VISIBILITY_TRUE = @ENABLE_VISIBILITY_TRUE@ +ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@ EXEEXT = @EXEEXT@ EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@ FGREP = @FGREP@ @@ -273,8 +278,6 @@ WARN_CXXFLAGS = \ # -I/-D flags to pass when compiling. AM_CPPFLAGS = $(GLIBCXX_INCLUDES) -AM_MAKEFLAGS = -j1 -AM_RUNTESTFLAGS = # Generated lists of files to run. All of these names are valid make # targets, if you wish to generate a list manually. @@ -299,13 +302,19 @@ compile_script = ${glibcxx_srcdir}/scripts/check_compile # XXX Need to add dependency on libtestc++.a check_performance_script = ${glibcxx_srcdir}/scripts/check_performance -# Generates the plots and graphs for performance testing. -doc_performance_script = ${glibcxx_srcdir}/scripts/make_graphs.py +# Runs the testsuite in parallel mode. +libgomp_dir = ${glibcxx_builddir}/../libgomp +libgomp_flags = -B${glibcxx_builddir}/../libgomp \ + -I${glibcxx_builddir}/../libgomp \ + -L${glibcxx_builddir}/../libgomp/.libs -lgomp + +atomic_flags = $(ATOMIC_FLAGS) +parallel_flags = "unix/-D_GLIBCXX_PARALLEL/-fopenmp" # By adding these files here, automake will remove them for 'make clean' CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \ testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \ - *.o *.cc *.a *.so *.xml + *.s *.o *.cc *.a *.so *.xml all: all-am @@ -433,7 +442,7 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool mostlyclean-am +clean-am: clean-generic clean-libtool clean-local mostlyclean-am distclean: distclean-am -rm -f Makefile @@ -479,14 +488,15 @@ ps-am: uninstall-am: uninstall-info-am .PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \ - clean-libtool distclean distclean-DEJAGNU distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - uninstall uninstall-am uninstall-info-am + clean-libtool clean-local distclean distclean-DEJAGNU \ + distclean-generic distclean-libtool distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am # This rule generates all of the testsuite_files* lists at once. @@ -549,15 +559,31 @@ check-compile: testsuite_files ${compile_script} check-performance: testsuite_files_performance ${performance_script} -@(chmod + ${check_performance_script}; \ ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir}) -doc-performance: - -@(chmod + ${doc_performance_script}; \ - ${doc_performance_script} ${glibcxx_srcdir} \ - ${glibcxx_builddir}/testsuite \ - ${glibcxx_srcdir}/testsuite/data/make_graph_htmls.xml \ - ${glibcxx_srcdir}/testsuite/data/make_graph_test_infos.xml local g++) + +check-parallel: site.exp + -@(if test ! -d $${libgomp_dir}; then \ + echo "Testing parallel mode failed as libgomp not present."; \ + exit 1; \ + fi; \ + outputdir=parallel; export outputdir; \ + if test ! -d $${outputdir}; then \ + mkdir $${outputdir}; \ + fi; \ + srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ + EXPECT=$(EXPECT); export EXPECT; \ + $(MAKE) CXXFLAGS="$(atomic_flags) $(libgomp_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(parallel_flags)" check-DEJAGNU; ) + +check-performance-parallel: testsuite_files_performance ${performance_script} + -@(chmod + ${check_performance_script}; \ + CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \ + ${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir}) .PHONY: baseline_symbols new-abi-baseline \ - check-abi check-compile check-performance + check-abi check-compile check-performance check-parallel + +# To remove directories. +clean-local: + rm -rf parallel # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/libstdc++-v3/testsuite/backward/header_hash_set_h.cc b/libstdc++-v3/testsuite/abi/demangle/cxx0x/rref.cc index 7d32b03ed89..cb085b48d51 100644 --- a/libstdc++-v3/testsuite/backward/header_hash_set_h.cc +++ b/libstdc++-v3/testsuite/abi/demangle/cxx0x/rref.cc @@ -1,6 +1,6 @@ -// 2002-03-15 Philipp Thomas <pthomas@suse.de> +// 2007-06-28 Douglas Gregor <doug.gregor@gmail.com> -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2007 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 @@ -18,14 +18,15 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. -// backward header hash_set.h +// IA 64 C++ ABI - 5.1 External Names (a.k.a. Mangling) -#include <hash_set.h> #include <testsuite_hooks.h> -// { dg-options "-Wno-deprecated" } - -int main(void) +int main() { + using namespace __gnu_test; + + verify_demangle("_Z1fOi", "f(int&&)"); + return 0; } diff --git a/libstdc++-v3/testsuite/ext/hash_map/1.cc b/libstdc++-v3/testsuite/backward/hash_map/1.cc index 2062cb01b57..faa97d6f265 100644 --- a/libstdc++-v3/testsuite/ext/hash_map/1.cc +++ b/libstdc++-v3/testsuite/backward/hash_map/1.cc @@ -1,4 +1,6 @@ -// Copyright (C) 2002, 2005 Free Software Foundation, Inc. +// { dg-options "-Wno-deprecated" } + +// Copyright (C) 2002, 2005, 2007 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 @@ -20,7 +22,7 @@ #include <cstdlib> #include <string> -#include <ext/hash_map> +#include <hash_map> #include <testsuite_hooks.h> namespace __gnu_cxx diff --git a/libstdc++-v3/testsuite/ext/hash_map/14648.cc b/libstdc++-v3/testsuite/backward/hash_map/14648.cc index 91f8240e150..8c73b2d790d 100644 --- a/libstdc++-v3/testsuite/ext/hash_map/14648.cc +++ b/libstdc++-v3/testsuite/backward/hash_map/14648.cc @@ -1,4 +1,6 @@ -// Copyright (C) 2004, 2005 Free Software Foundation +// { dg-options "-Wno-deprecated" } + +// Copyright (C) 2004, 2005, 2007 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 @@ -17,7 +19,7 @@ // USA. #include <iostream> -#include <ext/hash_map> +#include <hash_map> #include <ext/rope> // libstdc++/14648 diff --git a/libstdc++-v3/testsuite/ext/hash_map/23528.cc b/libstdc++-v3/testsuite/backward/hash_map/23528.cc index e651e5b2d3d..42908eb3134 100644 --- a/libstdc++-v3/testsuite/ext/hash_map/23528.cc +++ b/libstdc++-v3/testsuite/backward/hash_map/23528.cc @@ -1,3 +1,6 @@ +// { dg-options "-Wno-deprecated" } +// { dg-do compile } + // Copyright (C) 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -16,9 +19,7 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. -// { dg-do compile } - -#include <ext/hash_map> +#include <hash_map> // libstdc++/23528 void test01() diff --git a/libstdc++-v3/testsuite/ext/hash_map/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/backward/hash_map/requirements/explicit_instantiation.cc index 85f1ba258e4..84df423ea61 100644 --- a/libstdc++-v3/testsuite/ext/hash_map/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/backward/hash_map/requirements/explicit_instantiation.cc @@ -1,4 +1,7 @@ -// Copyright (C) 2004 Free Software Foundation, Inc. +// { dg-options "-Wno-deprecated" } +// { dg-do compile } + +// Copyright (C) 2004, 2007 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 @@ -27,8 +30,6 @@ // This file tests explicit instantiation of library containers -#include <ext/hash_map> - -// { dg-do compile } +#include <hash_map> template class __gnu_cxx::hash_map<int, char>; diff --git a/libstdc++-v3/testsuite/ext/hash_set/1.cc b/libstdc++-v3/testsuite/backward/hash_set/1.cc index da1617cd9ff..b54f022b257 100644 --- a/libstdc++-v3/testsuite/ext/hash_set/1.cc +++ b/libstdc++-v3/testsuite/backward/hash_set/1.cc @@ -1,7 +1,9 @@ +// { dg-options "-Wno-deprecated" } + // 2002-04-28 Paolo Carlini <pcarlini@unitus.it> // Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> -// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2002, 2004, 2005, 2007 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 @@ -21,7 +23,7 @@ // hash_set (SGI extension) -#include <ext/hash_set> +#include <hash_set> void test01() diff --git a/libstdc++-v3/testsuite/ext/hash_set/check_construct_destroy.cc b/libstdc++-v3/testsuite/backward/hash_set/check_construct_destroy.cc index 4f03e49af5c..0e9a3756993 100644 --- a/libstdc++-v3/testsuite/ext/hash_set/check_construct_destroy.cc +++ b/libstdc++-v3/testsuite/backward/hash_set/check_construct_destroy.cc @@ -1,6 +1,8 @@ +// { dg-options "-Wno-deprecated" } + // 2004-07-26 Matt Austern <austern@apple.com> // -// Copyright (C) 2003 Free Software Foundation, Inc. +// Copyright (C) 2003, 2007 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 @@ -27,7 +29,7 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#include <ext/hash_set> +#include <hash_set> #include <functional> #include <iterator> #include <testsuite_allocator.h> diff --git a/libstdc++-v3/testsuite/ext/hash_set/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/backward/hash_set/requirements/explicit_instantiation.cc index 9d6f398d4a9..8d01bae374f 100644 --- a/libstdc++-v3/testsuite/ext/hash_set/requirements/explicit_instantiation.cc +++ b/libstdc++-v3/testsuite/backward/hash_set/requirements/explicit_instantiation.cc @@ -1,4 +1,7 @@ -// Copyright (C) 2004 Free Software Foundation, Inc. +// { dg-options "-Wno-deprecated" } +// { dg-do compile } + +// Copyright (C) 2004, 2007 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 @@ -27,8 +30,6 @@ // This file tests explicit instantiation of library containers -#include <ext/hash_set> - -// { dg-do compile } +#include <hash_set> template class __gnu_cxx::hash_set<int>; diff --git a/libstdc++-v3/testsuite/backward/header_iterator_h.cc b/libstdc++-v3/testsuite/backward/header_iterator_h.cc deleted file mode 100644 index 4f301bbb5ff..00000000000 --- a/libstdc++-v3/testsuite/backward/header_iterator_h.cc +++ /dev/null @@ -1,31 +0,0 @@ -// 2001-09-04 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> - -// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// backward header iterator.h - -#include <iterator.h> -#include <testsuite_hooks.h> - -// { dg-options "-Wno-deprecated" } - -int main(void) -{ - return 0; -} diff --git a/libstdc++-v3/testsuite/backward/header_tempbuf_h.cc b/libstdc++-v3/testsuite/backward/header_tempbuf_h.cc deleted file mode 100644 index 4b177b2ac5a..00000000000 --- a/libstdc++-v3/testsuite/backward/header_tempbuf_h.cc +++ /dev/null @@ -1,31 +0,0 @@ -// 2002-03-15 Philipp Thomas <pthomas@suse.de> - -// Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free -// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -// USA. - -// backward header tempbuf.h - -#include <tempbuf.h> -#include <testsuite_hooks.h> - -// { dg-options "-Wno-deprecated" } - -int main(void) -{ - return 0; -} diff --git a/libstdc++-v3/testsuite/config/default.exp b/libstdc++-v3/testsuite/config/default.exp index c08f6dd61ef..cb869311fca 100644 --- a/libstdc++-v3/testsuite/config/default.exp +++ b/libstdc++-v3/testsuite/config/default.exp @@ -31,3 +31,6 @@ proc ${tool}_target_compile { srcfile destfile compile_type options } { v3_target_compile $srcfile $destfile $compile_type $options } +# Support for old dejagnu. Must be loaded here, not in libstdc++.exp, to +# make sure all existing procs are loaded when their presence is tested. +load_file $srcdir/../../gcc/testsuite/lib/dejapatches.exp diff --git a/libstdc++-v3/testsuite/ext/array_allocator/1.cc b/libstdc++-v3/testsuite/ext/array_allocator/1.cc index 84a6c197ec8..8b7bcbde2af 100644 --- a/libstdc++-v3/testsuite/ext/array_allocator/1.cc +++ b/libstdc++-v3/testsuite/ext/array_allocator/1.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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 @@ -25,7 +25,7 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#include <string> +#include <ext/vstring.h> #include <ext/array_allocator.h> #include <testsuite_hooks.h> @@ -38,10 +38,10 @@ array_type extern_array; void test01() { bool test __attribute__((unused)) = true; - - using std::basic_string; + + using __gnu_cxx::__versa_string; typedef __gnu_cxx::array_allocator<char_type, array_type> allocator_type; - typedef basic_string<char_type, traits_type, allocator_type> string_type; + typedef __versa_string<char_type, traits_type, allocator_type> string_type; allocator_type a(&extern_array); string_type s(a); diff --git a/libstdc++-v3/testsuite/ext/array_allocator/2.cc b/libstdc++-v3/testsuite/ext/array_allocator/2.cc index f3b30947812..01702e792e8 100644 --- a/libstdc++-v3/testsuite/ext/array_allocator/2.cc +++ b/libstdc++-v3/testsuite/ext/array_allocator/2.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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 @@ -25,8 +25,8 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#include <string> #include <iostream> +#include <ext/vstring.h> #include <ext/array_allocator.h> #include <testsuite_hooks.h> @@ -40,9 +40,9 @@ void test01() { bool test __attribute__((unused)) = true; - using std::basic_string; + using __gnu_cxx::__versa_string; typedef __gnu_cxx::array_allocator<char_type, array_type> allocator_type; - typedef basic_string<char_type, traits_type, allocator_type> string_type; + typedef __versa_string<char_type, traits_type, allocator_type> string_type; allocator_type a(&extern_array); string_type s(a); diff --git a/libstdc++-v3/testsuite/ext/array_allocator/3.cc b/libstdc++-v3/testsuite/ext/array_allocator/3.cc index c9fa348a537..81f8bbd1d15 100644 --- a/libstdc++-v3/testsuite/ext/array_allocator/3.cc +++ b/libstdc++-v3/testsuite/ext/array_allocator/3.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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 @@ -25,7 +25,7 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#include <string> +#include <ext/vstring.h> #include <ext/array_allocator.h> #include <testsuite_hooks.h> @@ -39,9 +39,9 @@ void test01() { bool test __attribute__((unused)) = true; - using std::basic_string; + using __gnu_cxx::__versa_string; typedef __gnu_cxx::array_allocator<char_type, array_type> allocator_type; - typedef basic_string<char_type, traits_type, allocator_type> string_type; + typedef __versa_string<char_type, traits_type, allocator_type> string_type; // Construct array_allocator without underlying array. allocator_type a; diff --git a/libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc new file mode 100644 index 00000000000..5c3f9a57bb0 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/array_allocator/variadic_construct.cc @@ -0,0 +1,50 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-27 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 20.4.1.1 allocator members + +#include <ext/array_allocator.h> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef std::pair<int, char> pair_type; + typedef std::tr1::array<pair_type, 3> array_type; + array_type store; + + __gnu_cxx::array_allocator<pair_type, array_type> alloc1(&store); + pair_type* ptp1 = alloc1.allocate(1); + alloc1.construct(ptp1, 3, 'a'); + + VERIFY( ptp1->first == 3 ); + VERIFY( ptp1->second == 'a' ); + + alloc1.deallocate(ptp1, 1); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/bitmap_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/bitmap_allocator/variadic_construct.cc new file mode 100644 index 00000000000..4e911e1ca1f --- /dev/null +++ b/libstdc++-v3/testsuite/ext/bitmap_allocator/variadic_construct.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-26 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <ext/bitmap_allocator.h> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef std::pair<int, char> pair_type; + __gnu_cxx::bitmap_allocator<pair_type> alloc1; + + pair_type* ptp1 = alloc1.allocate(1); + alloc1.construct(ptp1, 3, 'a'); + + VERIFY( ptp1->first == 3 ); + VERIFY( ptp1->second == 'a' ); + + alloc1.deallocate(ptp1, 1); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/enc_filebuf/char/13598.cc b/libstdc++-v3/testsuite/ext/enc_filebuf/char/13598.cc index 3aa7de8cd82..767ae32eb2c 100644 --- a/libstdc++-v3/testsuite/ext/enc_filebuf/char/13598.cc +++ b/libstdc++-v3/testsuite/ext/enc_filebuf/char/13598.cc @@ -1,6 +1,6 @@ // { dg-require-iconv "ISO-8859-1" } -// Copyright (C) 2004, 2007 Free Software Foundation +// Copyright (C) 2004, 2005, 2006, 2007 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 @@ -20,6 +20,7 @@ #include <locale> #include <cstring> +#include <cstddef> #include <testsuite_hooks.h> #include <ext/enc_filebuf.h> @@ -41,8 +42,8 @@ int main() std::streamsize n = fb.sputn(str, std::strlen(str)); int s = fb.pubsync(); fb.close(); - - VERIFY( n == std::strlen(str) ); + + VERIFY( std::size_t(n) == std::strlen(str) ); VERIFY( s == 0 ); return 0; diff --git a/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc b/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc index 4ce8c673700..ae6ef0bd623 100644 --- a/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc +++ b/libstdc++-v3/testsuite/ext/forced_exception_error/cons_virtual_derivation.cc @@ -19,6 +19,8 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-require-time "" } + #include <ext/throw_allocator.h> #include <testsuite_api.h> diff --git a/libstdc++-v3/testsuite/ext/headers.cc b/libstdc++-v3/testsuite/ext/headers.cc index af66604377e..a1bdbb350f5 100644 --- a/libstdc++-v3/testsuite/ext/headers.cc +++ b/libstdc++-v3/testsuite/ext/headers.cc @@ -1,7 +1,7 @@ // { dg-do compile } // 1999-06-23 bkoz -// Copyright (C) 1999, 2001, 2003 Free Software Foundation, Inc. +// Copyright (C) 1999, 2001, 2003, 2007 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,8 +33,6 @@ #include <ext/debug_allocator.h> #include <ext/enc_filebuf.h> #include <ext/functional> -#include <ext/hash_map> -#include <ext/hash_set> #include <ext/iterator> #include <ext/malloc_allocator.h> #include <ext/memory> diff --git a/libstdc++-v3/testsuite/ext/malloc_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/malloc_allocator/variadic_construct.cc new file mode 100644 index 00000000000..39163c8e888 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/malloc_allocator/variadic_construct.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-26 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <ext/malloc_allocator.h> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef std::pair<int, char> pair_type; + __gnu_cxx::malloc_allocator<pair_type> alloc1; + + pair_type* ptp1 = alloc1.allocate(1); + alloc1.construct(ptp1, 3, 'a'); + + VERIFY( ptp1->first == 3 ); + VERIFY( ptp1->second == 'a' ); + + alloc1.deallocate(ptp1, 1); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/mt_allocator/variadic_construct.cc new file mode 100644 index 00000000000..8416c688e52 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/variadic_construct.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-26 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <ext/mt_allocator.h> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef std::pair<int, char> pair_type; + __gnu_cxx::__mt_alloc<pair_type> alloc1; + + pair_type* ptp1 = alloc1.allocate(1); + alloc1.construct(ptp1, 3, 'a'); + + VERIFY( ptp1->first == 3 ); + VERIFY( ptp1->second == 'a' ); + + alloc1.deallocate(ptp1, 1); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/new_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/new_allocator/variadic_construct.cc new file mode 100644 index 00000000000..575e23792a5 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/new_allocator/variadic_construct.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-26 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <ext/new_allocator.h> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef std::pair<int, char> pair_type; + __gnu_cxx::new_allocator<pair_type> alloc1; + + pair_type* ptp1 = alloc1.allocate(1); + alloc1.construct(ptp1, 3, 'a'); + + VERIFY( ptp1->first == 3 ); + VERIFY( ptp1->second == 'a' ); + + alloc1.deallocate(ptp1, 1); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/assoc_container_traits.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/assoc_container_traits.cc index 4946155a66e..a9b4affe2a0 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/assoc_container_traits.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/assoc_container_traits.cc @@ -57,8 +57,7 @@ #include <ext/pb_ds/tag_and_trait.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; template<class DS_Category> void diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_map.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_map.cc index cc3bbe3c352..3caacb78f52 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_map.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_map.cc @@ -55,8 +55,7 @@ #include <ext/pb_ds/assoc_container.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; // The following function performs a sequence of operations on an // associative container object mapping integers to characters. diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc index 77390809bb2..a48860597f6 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multimap.cc @@ -56,7 +56,7 @@ #include <ext/pb_ds/assoc_container.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multiset.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multiset.cc index 9b5d0aa069d..064e24d3610 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multiset.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_multiset.cc @@ -61,7 +61,7 @@ #include <ext/pb_ds/assoc_container.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; // A simple priority queue that also supports an "contains" query. class contains_pq diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_priority_queue.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_priority_queue.cc index cc7641c2405..beedd0e7a88 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_priority_queue.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_priority_queue.cc @@ -55,8 +55,7 @@ #include <ext/pb_ds/priority_queue.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; // The following function performs a sequence of operations on a // priority queue object storing integers. @@ -94,35 +93,35 @@ int main() { // Perform operations on a pairing-heap queue. cout << "Pairing heap" << endl; - pb_ds::priority_queue<int, less<int>, pairing_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, pairing_heap_tag> c; some_op_sequence(c); } { // Perform operations on a binomial-heap queue. cout << "Binomial heap" << endl; - pb_ds::priority_queue<int, less<int>, binomial_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, binomial_heap_tag> c; some_op_sequence(c); } { // Perform operations on a binomial-heap queue. cout << "Redundant-counter binomial heap" << endl; - pb_ds::priority_queue<int, less<int>, rc_binomial_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, rc_binomial_heap_tag> c; some_op_sequence(c); } { // Perform operations on a binomial-heap queue. cout << "Binary heap" << endl; - pb_ds::priority_queue<int, less<int>, binary_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, binary_heap_tag> c; some_op_sequence(c); } { // Perform operations on a thin-heap queue. cout << "Thin heap" << endl; - pb_ds::priority_queue<int, less<int>, thin_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, thin_heap_tag> c; some_op_sequence(c); } diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_set.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_set.cc index 733dca311d0..12a9ad2af1a 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/basic_set.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/basic_set.cc @@ -56,8 +56,7 @@ #include <ext/pb_ds/tag_and_trait.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; // The following function performs a sequence of operations on an // associative container object storing integers. diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/erase_if.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/erase_if.cc index 9142bd48377..b13dd0736ff 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/erase_if.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/erase_if.cc @@ -54,8 +54,7 @@ #include <ext/pb_ds/assoc_container.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; // The following functor takes a map's value-type object and returns // whether its key is between two numbers. diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_find_neg.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_find_neg.cc index a38c7fb6b3f..c77e6e0a141 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_find_neg.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_find_neg.cc @@ -55,7 +55,7 @@ #include <ext/pb_ds/assoc_container.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; int main() { diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_illegal_resize.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_illegal_resize.cc index 9b3e7747488..1518a0932ae 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_illegal_resize.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_illegal_resize.cc @@ -57,7 +57,7 @@ #include <cassert> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet @@ -115,7 +115,7 @@ int main() { g.resize(200); } - catch(pb_ds::resize_error& ) + catch(__gnu_pbds::resize_error& ) { ex_thrown = true; } diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_initial_size.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_initial_size.cc index 5107657dac6..6168ba457a5 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_initial_size.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_initial_size.cc @@ -54,7 +54,7 @@ #include <ext/pb_ds/hash_policy.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_load_set_change.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_load_set_change.cc index f8132e8e8db..0afc7efe6a4 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_load_set_change.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_load_set_change.cc @@ -56,7 +56,7 @@ #include <ext/pb_ds/hash_policy.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_mod.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_mod.cc index 500ed44724d..32b8e0fc483 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_mod.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_mod.cc @@ -54,7 +54,7 @@ #include <ext/pb_ds/hash_policy.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize.cc index b6421bdaf99..548e56cc88e 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize.cc @@ -55,7 +55,7 @@ #include <ext/pb_ds/hash_policy.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; // A simple hash functor. // hash could serve instead of this functor, but it is not yet diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize_neg.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize_neg.cc index f120ae69b5f..3a6022ba696 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize_neg.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_resize_neg.cc @@ -54,7 +54,7 @@ #include <ext/pb_ds/assoc_container.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; int main() { diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_shift_mask.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_shift_mask.cc index 33d00120d44..5242d82c223 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/hash_shift_mask.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/hash_shift_mask.cc @@ -57,7 +57,7 @@ #include <ext/pb_ds/hash_policy.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; // A simple hash functor. hash could serve instead of this functor, // but it is not yet standard everywhere. diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_container_traits.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_container_traits.cc index f2f0e3b4280..d59ed81020e 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_container_traits.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_container_traits.cc @@ -56,8 +56,7 @@ #include <ext/pb_ds/tag_and_trait.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; template<class DS_Category> void @@ -147,7 +146,7 @@ int main() { // Print the attributes of a binary heap. typedef - pb_ds::priority_queue< + __gnu_pbds::priority_queue< int, std::less<int>, binary_heap_tag> @@ -159,7 +158,7 @@ int main() { // Print the attributes of a binomial heap. typedef - pb_ds::priority_queue< + __gnu_pbds::priority_queue< int, std::less<int>, binomial_heap_tag> @@ -171,7 +170,7 @@ int main() { // Print the attributes of a redundant-counter binomial heap. typedef - pb_ds::priority_queue< + __gnu_pbds::priority_queue< int, std::less<int>, rc_binomial_heap_tag> @@ -183,7 +182,7 @@ int main() { // Print the attributes of a pairing heap. typedef - pb_ds::priority_queue< + __gnu_pbds::priority_queue< int, std::less<int>, pairing_heap_tag> @@ -198,7 +197,7 @@ int main() */ typedef - pb_ds::priority_queue< + __gnu_pbds::priority_queue< int, std::less<int>, thin_heap_tag> diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc index 53a788d5d55..af582b37b34 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_dijkstra.cc @@ -64,8 +64,7 @@ #include <ext/pb_ds/priority_queue.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; // The value type of the priority queue. // The first entry is the node's id, and the second is the distance. @@ -108,7 +107,7 @@ int main() }; // The priority queue type. - typedef pb_ds::priority_queue< pq_value, pq_value_cmp> pq_t; + typedef __gnu_pbds::priority_queue< pq_value, pq_value_cmp> pq_t; // The priority queue object. pq_t p; @@ -151,12 +150,16 @@ int main() // node to the neighbor. const size_t pot_dist = dist + a_a_edge_legnth[node_id][neighbor_i]; + if (a_it[neighbor_i] == a_it[0]) + continue; + // "Relax" the distance (if appropriate) through modify. if (pot_dist < a_it[neighbor_i]->second) p.modify(a_it[neighbor_i], pq_value(neighbor_i, pot_dist)); } // Done with the node, so we pop it. + a_it[node_id] = a_it[0]; p.pop(); } diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_erase_if.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_erase_if.cc index b67c8aed5d9..834994c4636 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_erase_if.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_erase_if.cc @@ -54,13 +54,12 @@ #include <ext/pb_ds/priority_queue.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; int main() { - pb_ds::priority_queue<int> p; + __gnu_pbds::priority_queue<int> p; // First we insert some values into the container. for (int i = 0; i < 1000; ++i) diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_split_join.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_split_join.cc index e59cb34918d..14604d73dce 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_split_join.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_split_join.cc @@ -54,14 +54,13 @@ #include <ext/pb_ds/priority_queue.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; int main() { // Two priority queue objects. - pb_ds::priority_queue<int> even_p, odd_p; + __gnu_pbds::priority_queue<int> even_p, odd_p; // First we insert some values: even ones into even_p, and odd ones // into odd_p. @@ -77,7 +76,7 @@ main() // Print out the values. cout << "Initial values in even priority queue:" << endl; - pb_ds::priority_queue<int>::const_iterator it; + __gnu_pbds::priority_queue<int>::const_iterator it; for (it = even_p.begin(); it != even_p.end(); ++it) cout <<* it << endl; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_xref.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_xref.cc index c718d1f86ff..7565e73e5c0 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_xref.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/priority_queue_xref.cc @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007 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 @@ -66,8 +66,7 @@ #include <ext/pb_ds/assoc_container.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; // A priority queue of integers, which supports fast pushes, // duplicated-int avoidance, and arbitrary-int erases. @@ -81,7 +80,7 @@ public: push(const int& r_str); // Returns a const reference to the largest int in the container. - const int + int top() const { assert(!empty()); @@ -107,7 +106,7 @@ public: private: // A priority queue of strings. - typedef pb_ds::priority_queue< int> pq_t; + typedef __gnu_pbds::priority_queue< int> pq_t; // A hash-table mapping strings to point_iterators inside the // priority queue. diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc index 4dc3721ad91..0be8d8535e7 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/ranged_hash.cc @@ -61,8 +61,7 @@ #include <ext/pb_ds/hash_policy.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; /** * A (somewhat simplistic) ranged-hash function for strings. diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/store_hash.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/store_hash.cc index 11ef830cf7c..ba46c824b52 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/store_hash.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/store_hash.cc @@ -60,7 +60,7 @@ #include <ext/pb_ds/hash_policy.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; // A string hash functor. struct string_hash : public unary_function<string, size_t> diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc index e82150de2b4..e4411aaab43 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_intervals.cc @@ -68,8 +68,7 @@ #include <ext/pb_ds/assoc_container.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; // Following are definitions of line intervals and functors operating // on them. As the purpose of this example is node invariants, and not diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_join.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_join.cc index 795456ab6d5..baba67e7292 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_join.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_join.cc @@ -59,8 +59,8 @@ #include <cassert> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; +using namespace __gnu_pbds; int main() { @@ -68,14 +68,7 @@ int main() * */ // A splay tree table mapping ints to chars. - typedef - tree< - int, - char, - less< - int>, - splay_tree_tag> - map_t; + typedef tree<int, char, less<int>, splay_tree_tag> map_t; // Two map_t object. map_t h0, h1; @@ -114,7 +107,7 @@ int main() { h2.join(h3); } - catch (pb_ds::join_error& ) + catch (__gnu_pbds::join_error& ) { exception_thrown = true; } diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics.cc index 30ae3091224..7a3e26292f6 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics.cc @@ -58,8 +58,7 @@ #include <ext/pb_ds/tree_policy.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; // A red-black tree table storing ints and their order // statistics. Note that since the tree uses diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics_join.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics_join.cc index 74fe8382cdc..24661070cd9 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics_join.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/tree_order_statistics_join.cc @@ -55,18 +55,14 @@ #include <ext/pb_ds/tree_policy.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; // A splay tree table mapping ints to chars and storing the ints order // statistics. typedef -tree< - int, - char, - less<int>, - splay_tree_tag, - tree_order_statistics_node_update> +tree<int, char, less<int>, + splay_tree_tag, + tree_order_statistics_node_update> tree_map_t; int main() diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/trie_dna.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/trie_dna.cc index 63afba382ba..76f2b7bdb81 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/trie_dna.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/trie_dna.cc @@ -57,7 +57,7 @@ #include <ext/pb_ds/trie_policy.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; // DNA is represented by a string. typedef string dna_t; diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/trie_prefix_search.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/trie_prefix_search.cc index 5cb140b5cb0..510da445836 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/trie_prefix_search.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/trie_prefix_search.cc @@ -57,8 +57,7 @@ #include <ext/pb_ds/tag_and_trait.hpp> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; // A PATRICIA trie with a prefix-search node-updator type. Note that // since the node updator is trie_prefix_search_node_update, then the diff --git a/libstdc++-v3/testsuite/ext/pb_ds/example/trie_split.cc b/libstdc++-v3/testsuite/ext/pb_ds/example/trie_split.cc index 11cd1823516..868a8cf6216 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/example/trie_split.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/example/trie_split.cc @@ -54,7 +54,7 @@ #include <ext/pb_ds/assoc_container.hpp> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; int main() { diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/associative_containers.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/associative_containers.cc index 686f8b9c70f..b7a0b8253ff 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/associative_containers.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/associative_containers.cc @@ -50,7 +50,7 @@ #include <cassert> using namespace std; -using namespace pb_ds; +using namespace __gnu_pbds; /** * The following function performs a sequence of operations on an diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc index d82813e729a..606679b19a4 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_data_map_rand.cc @@ -45,6 +45,8 @@ * Contains a random-operation test for maps and sets. */ +// { dg-require-time "" } + #include <regression/rand/assoc/rand_regression_test.hpp> #include <regression/assoc/common_type.hpp> @@ -59,7 +61,7 @@ int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; typedef hash_map_tl_t map_tl_t; return rand_regression_test(ITERATIONS, KEYS, diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc index 652774a39aa..202fe1443ce 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/hash_no_data_map_rand.cc @@ -45,6 +45,8 @@ * Contains a random-operation test for maps and sets. */ +// { dg-require-time "" } + #include <regression/rand/assoc/rand_regression_test.hpp> #include <regression/assoc/common_type.hpp> @@ -59,7 +61,7 @@ int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; typedef hash_set_tl_t map_tl_t; return rand_regression_test(ITERATIONS, KEYS, diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc index 98bbf59cf55..7c8bb40eb1b 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_data_map_rand.cc @@ -45,13 +45,15 @@ * Contains a random-operation test for maps and sets. */ +// { dg-require-time "" } + #include <regression/rand/assoc/rand_regression_test.hpp> #include <regression/assoc/common_type.hpp> int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; typedef lu_map_tl_t map_tl_t; return rand_regression_test(50, 10, diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc index 90e0de038c2..0d31f5ad846 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/list_update_no_data_map_rand.cc @@ -45,13 +45,15 @@ * Contains a random-operation test for maps and sets. */ +// { dg-require-time "" } + #include <regression/rand/assoc/rand_regression_test.hpp> #include <regression/assoc/common_type.hpp> int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; typedef lu_set_tl_t map_tl_t; return rand_regression_test(50, 10, diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc index 67e5b6f455a..8f4fdaaf689 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc @@ -45,6 +45,8 @@ * Contains a random-operation test for priority queues. */ +// { dg-require-time "" } + #include <regression/rand/priority_queue/rand_regression_test.hpp> #include <regression/priority_queue/common_type.hpp> @@ -59,7 +61,7 @@ int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; return rand_regression_test(ITERATIONS, KEYS, "tree_no_data_map_rand_regression_test", pq_tl_t()); diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queues.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queues.cc index 0f53cf22d03..52099b64e52 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queues.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/priority_queues.cc @@ -50,8 +50,8 @@ #include <cassert> using namespace std; -using namespace pb_ds; -using namespace pb_ds; +using namespace __gnu_pbds; +using namespace __gnu_pbds; template<typename Cntnr> void @@ -94,7 +94,7 @@ priority_queue_link_regression_test_0() * Perform operations on a pairing-heap queue. */ cout << "Pairing heap" << endl; - pb_ds::priority_queue<int, less<int>, pairing_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, pairing_heap_tag> c; some_op_sequence(c); } @@ -103,7 +103,7 @@ priority_queue_link_regression_test_0() * Perform operations on a binomial-heap queue. */ cout << "Binomial heap" << endl; - pb_ds::priority_queue<int, less<int>, binomial_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, binomial_heap_tag> c; some_op_sequence(c); } @@ -112,7 +112,7 @@ priority_queue_link_regression_test_0() * Perform operations on a binomial-heap queue. */ cout << "Redundant-counter binomial heap" << endl; - pb_ds::priority_queue<int, less<int>, rc_binomial_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, rc_binomial_heap_tag> c; some_op_sequence(c); } @@ -121,7 +121,7 @@ priority_queue_link_regression_test_0() * Perform operations on a binomial-heap queue. */ cout << "Binary heap" << endl; - pb_ds::priority_queue<int, less<int>, binary_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, binary_heap_tag> c; some_op_sequence(c); } @@ -130,7 +130,7 @@ priority_queue_link_regression_test_0() * Perform operations on a thin-heap queue. */ cout << "Thin heap" << endl; - pb_ds::priority_queue<int, less<int>, thin_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, thin_heap_tag> c; some_op_sequence(c); } } @@ -144,7 +144,7 @@ priority_queue_link_regression_test_1() * Perform operations on a pairing-heap queue. */ cout << "Pairing heap" << endl; - pb_ds::priority_queue<int, less<int>, pairing_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, pairing_heap_tag> c; some_op_sequence(c); } @@ -153,7 +153,7 @@ priority_queue_link_regression_test_1() * Perform operations on a binomial-heap queue. */ cout << "Binomial heap" << endl; - pb_ds::priority_queue<int, less<int>, binomial_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, binomial_heap_tag> c; some_op_sequence(c); } @@ -162,7 +162,7 @@ priority_queue_link_regression_test_1() * Perform operations on a binomial-heap queue. */ cout << "Redundant-counter binomial heap" << endl; - pb_ds::priority_queue<int, less<int>, rc_binomial_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, rc_binomial_heap_tag> c; some_op_sequence(c); } @@ -171,7 +171,7 @@ priority_queue_link_regression_test_1() * Perform operations on a binomial-heap queue. */ cout << "Binary heap" << endl; - pb_ds::priority_queue<int, less<int>, binary_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, binary_heap_tag> c; some_op_sequence(c); } @@ -180,7 +180,7 @@ priority_queue_link_regression_test_1() * Perform operations on a thin-heap queue. */ cout << "Thin heap" << endl; - pb_ds::priority_queue<int, less<int>, thin_heap_tag> c; + __gnu_pbds::priority_queue<int, less<int>, thin_heap_tag> c; some_op_sequence(c); } } diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc index 645d2eecd05..b08fb855940 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_data_map_rand.cc @@ -45,6 +45,8 @@ * Contains a random-operation test for maps and sets. */ +// { dg-require-time "" } + #include <regression/rand/assoc/rand_regression_test.hpp> #include <regression/assoc/common_type.hpp> @@ -59,7 +61,7 @@ int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; typedef tree_map_tl_t map_tl_t; return rand_regression_test(ITERATIONS, KEYS, diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc index 1e3a3dbe05e..6f1024f7d4a 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/tree_no_data_map_rand.cc @@ -45,6 +45,8 @@ * Contains a random-operation test for maps and sets. */ +// { dg-require-time "" } + #include <regression/rand/assoc/rand_regression_test.hpp> #include <regression/assoc/common_type.hpp> @@ -59,7 +61,7 @@ int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; typedef tree_set_tl_t map_tl_t; return rand_regression_test(ITERATIONS, KEYS, diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc index 90e4fc6129f..bd55a83a094 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_data_map_rand.cc @@ -45,6 +45,8 @@ * Contains a random-operation test for maps and sets. */ +// { dg-require-time "" } + #include <regression/rand/assoc/rand_regression_test.hpp> #include <regression/assoc/common_type.hpp> @@ -59,7 +61,7 @@ int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; typedef trie_map_tl_t map_tl_t; return rand_regression_test(ITERATIONS, KEYS, diff --git a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc index cd1991e73c5..3407825bd78 100644 --- a/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc +++ b/libstdc++-v3/testsuite/ext/pb_ds/regression/trie_no_data_map_rand.cc @@ -45,6 +45,8 @@ * Contains a random-operation test for maps and sets. */ +// { dg-require-time "" } + #include <regression/rand/assoc/rand_regression_test.hpp> #include <regression/assoc/common_type.hpp> @@ -59,7 +61,7 @@ int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; typedef trie_set_tl_t map_tl_t; return rand_regression_test(ITERATIONS, KEYS, diff --git a/libstdc++-v3/testsuite/ext/pool_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/pool_allocator/variadic_construct.cc new file mode 100644 index 00000000000..7d453b66844 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/pool_allocator/variadic_construct.cc @@ -0,0 +1,46 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-26 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <ext/pool_allocator.h> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef std::pair<int, char> pair_type; + __gnu_cxx::__pool_alloc<pair_type> alloc1; + + pair_type* ptp1 = alloc1.allocate(1); + alloc1.construct(ptp1, 3, 'a'); + + VERIFY( ptp1->first == 3 ); + VERIFY( ptp1->second == 'a' ); + + alloc1.deallocate(ptp1, 1); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/char/35209.cc b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/char/35209.cc new file mode 100644 index 00000000000..b7755aed274 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/char/35209.cc @@ -0,0 +1,40 @@ +// Copyright (C) 2008 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-do link } + +#include <ext/stdio_sync_filebuf.h> + +struct my_ssf +: __gnu_cxx::stdio_sync_filebuf<char> +{ + my_ssf(std::__c_file* __f) + : __gnu_cxx::stdio_sync_filebuf<char>(__f) { } +}; + +// libstdc++/35209 +void test01() +{ + my_ssf ss1(0); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/35209.cc b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/35209.cc new file mode 100644 index 00000000000..636fdb2735d --- /dev/null +++ b/libstdc++-v3/testsuite/ext/stdio_sync_filebuf/wchar_t/35209.cc @@ -0,0 +1,40 @@ +// Copyright (C) 2008 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-do link } + +#include <ext/stdio_sync_filebuf.h> + +struct my_ssf +: __gnu_cxx::stdio_sync_filebuf<wchar_t> +{ + my_ssf(std::__c_file* __f) + : __gnu_cxx::stdio_sync_filebuf<wchar_t>(__f) { } +}; + +// libstdc++/35209 +void test01() +{ + my_ssf ss1(0); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc b/libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc index 902361eff0d..9e5c041f6f5 100644 --- a/libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc +++ b/libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc @@ -17,6 +17,8 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-require-time "" } + #include <ext/throw_allocator.h> #include <testsuite_allocator.h> diff --git a/libstdc++-v3/testsuite/ext/throw_allocator/check_deallocate_null.cc b/libstdc++-v3/testsuite/ext/throw_allocator/check_deallocate_null.cc index 8e6e1a025aa..c49ed2de1e3 100644 --- a/libstdc++-v3/testsuite/ext/throw_allocator/check_deallocate_null.cc +++ b/libstdc++-v3/testsuite/ext/throw_allocator/check_deallocate_null.cc @@ -17,6 +17,8 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-require-time "" } + #include <ext/throw_allocator.h> #include <testsuite_allocator.h> diff --git a/libstdc++-v3/testsuite/ext/throw_allocator/check_delete.cc b/libstdc++-v3/testsuite/ext/throw_allocator/check_delete.cc index a8e716798fe..7dd7b1a2c9c 100644 --- a/libstdc++-v3/testsuite/ext/throw_allocator/check_delete.cc +++ b/libstdc++-v3/testsuite/ext/throw_allocator/check_delete.cc @@ -17,6 +17,8 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-require-time "" } + #include <cstdlib> #include <ext/throw_allocator.h> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/ext/throw_allocator/check_new.cc b/libstdc++-v3/testsuite/ext/throw_allocator/check_new.cc index 1b00412918f..55c1d2b9483 100644 --- a/libstdc++-v3/testsuite/ext/throw_allocator/check_new.cc +++ b/libstdc++-v3/testsuite/ext/throw_allocator/check_new.cc @@ -17,6 +17,8 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-require-time "" } + #include <cstdlib> #include <ext/throw_allocator.h> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/ext/throw_allocator/deallocate_global.cc b/libstdc++-v3/testsuite/ext/throw_allocator/deallocate_global.cc index c8bbe510c9b..1eb90ab28e2 100644 --- a/libstdc++-v3/testsuite/ext/throw_allocator/deallocate_global.cc +++ b/libstdc++-v3/testsuite/ext/throw_allocator/deallocate_global.cc @@ -17,6 +17,8 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-require-time "" } + #include <string> #include <stdexcept> #include <ext/throw_allocator.h> diff --git a/libstdc++-v3/testsuite/ext/throw_allocator/deallocate_local.cc b/libstdc++-v3/testsuite/ext/throw_allocator/deallocate_local.cc index 794232e914e..d6d57e7e955 100644 --- a/libstdc++-v3/testsuite/ext/throw_allocator/deallocate_local.cc +++ b/libstdc++-v3/testsuite/ext/throw_allocator/deallocate_local.cc @@ -17,6 +17,8 @@ // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, // USA. +// { dg-require-time "" } + #include <string> #include <ext/throw_allocator.h> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/ext/throw_allocator/variadic_construct.cc b/libstdc++-v3/testsuite/ext/throw_allocator/variadic_construct.cc new file mode 100644 index 00000000000..51c5de650f9 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/throw_allocator/variadic_construct.cc @@ -0,0 +1,48 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-26 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-require-time "" } + +#include <ext/throw_allocator.h> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef std::pair<int, char> pair_type; + __gnu_cxx::throw_allocator<pair_type> alloc1; + + pair_type* ptp1 = alloc1.allocate(1); + alloc1.construct(ptp1, 3, 'a'); + + VERIFY( ptp1->first == 3 ); + VERIFY( ptp1->second == 'a' ); + + alloc1.deallocate(ptp1, 1); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/vstring/element_access/char/front_back.cc b/libstdc++-v3/testsuite/ext/vstring/element_access/char/front_back.cc new file mode 100644 index 00000000000..22959a91240 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/element_access/char/front_back.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-16 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <ext/vstring.h> +#include <testsuite_hooks.h> + +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + __gnu_cxx::__vstring str("ramifications"); + const __gnu_cxx::__vstring cstr("melodien"); + + VERIFY( str.front() == 'r' ); + VERIFY( str.back() == 's' ); + VERIFY( cstr.front() == 'm' ); + VERIFY( cstr.back() == 'n' ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/vstring/element_access/wchar_t/front_back.cc b/libstdc++-v3/testsuite/ext/vstring/element_access/wchar_t/front_back.cc new file mode 100644 index 00000000000..dc18c5a3e11 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/element_access/wchar_t/front_back.cc @@ -0,0 +1,44 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-16 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +#include <ext/vstring.h> +#include <testsuite_hooks.h> + +void test01() +{ + using namespace std; + bool test __attribute__((unused)) = true; + + __gnu_cxx::__wvstring str(L"ramifications"); + const __gnu_cxx::__wvstring cstr(L"melodien"); + + VERIFY( str.front() == L'r' ); + VERIFY( str.back() == L's' ); + VERIFY( cstr.front() == L'm' ); + VERIFY( cstr.back() == L'n' ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc index f76a2c4f62b..eb506b0c81d 100644 --- a/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc +++ b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/char/28277.cc @@ -38,7 +38,7 @@ void test01() oss_01 << str_01; VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == width ); + VERIFY( oss_01.str().size() == __gnu_cxx::__vstring::size_type(width) ); } int main() diff --git a/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc index 405163d0bb9..205a99525f6 100644 --- a/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc +++ b/libstdc++-v3/testsuite/ext/vstring/inserters_extractors/wchar_t/28277.cc @@ -38,7 +38,7 @@ void test01() oss_01 << str_01; VERIFY( oss_01.good() ); - VERIFY( oss_01.str().size() == width ); + VERIFY( oss_01.str().size() == __gnu_cxx::__wvstring::size_type(width) ); } int main() diff --git a/libstdc++-v3/testsuite/ext/vstring/moveable.cc b/libstdc++-v3/testsuite/ext/vstring/moveable.cc new file mode 100644 index 00000000000..7a33145fa22 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/moveable.cc @@ -0,0 +1,71 @@ +// { dg-options "-std=gnu++0x" } + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +// NOTE: This makes use of the fact that we know how moveable +// is implemented on deque (via swap). If the implementation changed +// this test may begin to fail. + +#include <ext/vstring.h> +#include <utility> +#include <testsuite_hooks.h> + +void test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::__sso_string a,b; + a.push_back('1'); + b = std::move(a); + VERIFY( b.size() == 1 && b[0] == '1' && a.size() == 0 ); + + __gnu_cxx::__sso_string c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == '1' ); + VERIFY( b.size() == 0 ); +} + +void test02() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::__rc_string a,b; + a.push_back('1'); + b = std::move(a); + VERIFY( b.size() == 1 && b[0] == '1' && a.size() == 0 ); + + __gnu_cxx::__rc_string c(std::move(b)); + VERIFY( c.size() == 1 && c[0] == '1' ); + VERIFY( b.size() == 0 ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc new file mode 100644 index 00000000000..3e579e80fca --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini <pcarlini@suse.de> + +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <ext/vstring.h> +#include <testsuite_hooks.h> + +void +test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::__vstring v(7, 'a'); + VERIFY( v.cbegin() == v.begin() ); + VERIFY( v.cend() == v.end() ); + VERIFY( v.crbegin() == v.rbegin() ); + VERIFY( v.crend() == v.rend() ); + VERIFY( v.cbegin() != v.cend() ); + VERIFY( v.crbegin() != v.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp index 29943ce2a6b..327b691fc0f 100644 --- a/libstdc++-v3/testsuite/lib/dg-options.exp +++ b/libstdc++-v3/testsuite/lib/dg-options.exp @@ -35,6 +35,15 @@ proc dg-require-debug-mode { args } { return } +proc dg-require-parallel-mode { args } { + if { ![ check_v3_target_parallel_mode ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + return + } + return +} + proc dg-require-fileio { args } { if { ![ check_v3_target_fileio ] } { upvar dg-do-what dg-do-what @@ -70,3 +79,12 @@ proc dg-require-time { args } { } return } + +proc dg-require-rvalref { args } { + if { ![ check_v3_target_rvalref ] } { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + return + } + return +} diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index a0bca54d485..b482bf58d20 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -83,7 +83,7 @@ proc libstdc++_init { testfile } { global env global v3-sharedlib global srcdir blddir objdir tool_root_dir - global cc cxx cxxflags cxxldflags + global cc cxx cxxflags cxxpchflags cxxldflags global includes global gluefile wrap_flags global ld_library_path @@ -123,15 +123,26 @@ proc libstdc++_init { testfile } { v3-copy-files [glob -nocomplain "$srcdir/data/*.tst"] v3-copy-files [glob -nocomplain "$srcdir/data/*.txt"] + set ld_library_path_tmp "" + # Locate libgcc.a so we don't need to account for different values of # SHLIB_EXT on different platforms set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] if {$gccdir != ""} { set gccdir [file dirname $gccdir] + append ld_library_path_tmp ":${gccdir}" } v3track gccdir 3 - # Look for shared library. (ie libstdc++.so.) + # Locate libgomp. This is only required for parallel mode. + set libgompdir [lookfor_file $blddir/../libgomp .libs/libgomp.so] + if {$libgompdir != ""} { + set libgompdir [file dirname $libgompdir] + append ld_library_path_tmp ":${libgompdir}" + } + v3track libgompdir 3 + + # Locate libstdc++ shared library. (ie libstdc++.so.) set v3-sharedlib 0 set sharedlibdir [lookfor_file $blddir src/.libs/libstdc++.so] if {$sharedlibdir != ""} { @@ -144,9 +155,8 @@ proc libstdc++_init { testfile } { # Compute what needs to be added to the existing LD_LIBRARY_PATH. if {$gccdir != ""} { - set ld_library_path "" - append ld_library_path ":${gccdir}" set compiler ${gccdir}/g++ + set ld_library_path ${ld_library_path_tmp} append ld_library_path ":${blddir}/src/.libs" if { [is_remote host] == 0 && [which $compiler] != 0 } { @@ -173,7 +183,8 @@ proc libstdc++_init { testfile } { # Default settings. set cxx [transform "g++"] - set cxxflags "-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0" + set cxxflags "-g -O2 -D_GLIBCXX_ASSERT -fmessage-length=0" + set cxxpchflags "" set cxxldflags "" set cc [transform "gcc"] # Locate testsuite_hooks.h and other testsuite headers. @@ -211,10 +222,14 @@ proc libstdc++_init { testfile } { # If we find a testsuite_flags file, we're testing in the build dir. set cxx [exec sh $flags_file --build-cxx] set cxxflags [exec sh $flags_file --cxxflags] + set cxxpchflags [exec sh $flags_file --cxxpchflags] set cxxldflags [exec sh $flags_file --cxxldflags] set cc [exec sh $flags_file --build-cc] set includes [exec sh $flags_file --build-includes] } + append cxxflags " " + append cxxflags [getenv CXXFLAGS] + v3track cxxflags 2 # Always use MO files built by this test harness. set cxxflags "$cxxflags -DLOCALEDIR=\".\"" @@ -224,23 +239,29 @@ proc libstdc++_init { testfile } { # this check until $cxx and such have been initialized because we # perform a test compilation. (Ideally, gcc --print-file-name would # list PCH files, but it does not.) - global PCH_CXXFLAGS - if ![info exists PCH_CXXFLAGS] then { + if { $cxxpchflags != "" } { set src "config[pid].cc" set f [open $src "w"] puts $f "int main () {}" close $f + # Fixme: "additional_flags=$cxxpchflags" fails, but would be + # useful as then the requested variant of the pre-build PCH + # files could be tested to see if it works. set lines [v3_target_compile $src "config[pid].o" object \ - "additional_flags=-include additional_flags=bits/stdtr1c++.h"] - if {$lines == "" } { -# set PCH_CXXFLAGS "-include bits/extc++.h" -# set PCH_CXXFLAGS "-include bits/stdtr1c++.h" - set PCH_CXXFLAGS "-include bits/stdc++.h" - } else { - set PCH_CXXFLAGS "" - } + "additional_flags=-include additional_flags=bits/stdc++.h"] + if { $lines != "" } { + verbose -log "Requested PCH file: $cxxpchflags" + verbose -log "is not working, and will not be used." + set cxxpchflags "" + } file delete $src + } + v3track cxxpchflags 2 + + global PCH_CXXFLAGS + if ![info exists PCH_CXXFLAGS] then { + set PCH_CXXFLAGS $cxxpchflags v3track PCH_CXXFLAGS 2 } @@ -380,6 +401,7 @@ proc v3_target_compile_as_c { source dest type options } { global flags_file global blddir global cc + global cxxflags if { [target_info needs_status_wrapper] != "" && [info exists gluefile] } { lappend options "libs=${gluefile}" @@ -390,6 +412,7 @@ proc v3_target_compile_as_c { source dest type options } { set cc_final $cc set cxxlibglossflags [libgloss_link_flags] set cc_final [concat $cc_final $cxxlibglossflags] + set cc_final [concat $cc_final $cxxflags] set cc_final [concat $cc_final $includes] regsub -all {\s[-]nostdinc[+][+]} $cc_final "" cc_final @@ -450,12 +473,15 @@ proc v3-build_support { } { set libtest_objs "" set config_src "config.cc" + set config_out "config.ii" set f [open $config_src "w"] puts $f "#include <bits/c++config.h>" puts $f "#include <bits/gthr.h>" close $f - set preprocessed [v3_target_compile $config_src "" \ - preprocess "additional_flags=-dN"] + v3_target_compile $config_src $config_out preprocess "additional_flags=-dN" + set file [open $config_out r] + set preprocessed [read $file] + close $file if { [string first "_GLIBCXX_USE_WCHAR_T" $preprocessed] != -1 } { verbose -log "wchar_t support detected" set v3-wchar_t 1 @@ -507,9 +533,9 @@ proc v3-build_support { } { } else { set ar [transform "ar"] } - set arcommand "$ar -rc ./libtestc++.a ${libtest_objs}" - verbose -log "$arcommand" - set result [lindex [local_exec "$arcommand" "" "" 300] 0] + set arargs "-rc ./libtestc++.a ${libtest_objs}" + verbose -log "$ar $arargs" + set result [lindex [remote_exec host "$ar" "$arargs"] 0] verbose "link result is $result" if { $result == 0 } { if [info exists env(RANLIB)] { @@ -517,9 +543,9 @@ proc v3-build_support { } { } else { set ranlib [transform "ranlib"] } - set ranlibcommand "$ranlib ./libtestc++.a" - verbose -log "$ranlibcommand" - set result [lindex [local_exec "$ranlibcommand" "" "" 300] 0] + set ranlibargs "./libtestc++.a" + verbose -log "$ranlib $ranlibargs" + set result [lindex [remote_exec host "$ranlib" "$ranlibargs"] 0] if { $result != 0 } { error "could not link libtestc++.a" } @@ -581,15 +607,20 @@ proc check_v3_target_fileio { } { puts $f "int main ()" puts $f "{" puts $f " int fd = open (\".\", O_RDONLY);" + puts $f " int ret = 0;" puts $f " if (fd == -1)" puts $f " {" puts $f " int err = errno;" puts $f " if (err == EIO || err == ENOSYS)" - puts $f " return 1;" + puts $f " ret = 1;" puts $f " }" puts $f " else" + puts $f " {" + puts $f " if (lseek (fd, 0, SEEK_CUR) == -1)" + puts $f " ret = 1;" puts $f " close (fd);" - puts $f " return 0;" + puts $f " }" + puts $f " return ret;" puts $f "}" close $f @@ -739,6 +770,61 @@ proc check_v3_target_time { } { return $et_time_saved } +proc check_v3_target_rvalref { } { + global et_rvalref_saved + global et_rvalref_target_name + global tool + + if { ![info exists et_rvalref_target_name] } { + set et_rvalref_target_name "" + } + + # If the target has changed since we set the cached value, clear it. + set current_target [current_target_name] + if { $current_target != $et_rvalref_target_name } { + verbose "check_v3_target_rvalref: `$et_rvalref_target_name'" 2 + set et_rvalref_target_name $current_target + if [info exists et_rvalref_saved] { + verbose "check_v3_target_rvalref: removing cached result" 2 + unset et_rvalref_saved + } + } + + if [info exists et_rvalref_saved] { + verbose "check_v3_target_rvalref: using cached result" 2 + } else { + set et_rvalref_saved 0 + + # Set up and compile a C++ test program that tries to use + # the library components of rval references + set src rvalref[pid].cc + set exe rvalref[pid].x + + set f [open $src "w"] + puts $f "#include <iterator>" + puts $f "#include <utility>" + puts $f "using std::move;" + puts $f "using std::identity;" + puts $f "using std::forward;" + puts $f "using std::move_iterator;" + puts $f "using std::make_move_iterator;" + close $f + + set lines [v3_target_compile $src $exe executable ""] + file delete $src + + if [string match "" $lines] { + # No error message, compilation succeeded. + verbose "check_v3_target_rvalref: compilation succeeded" 2 + remote_file build delete $exe + set et_rvalref_saved 1 + } else { + verbose "check_v3_target_rvalref: compilation failed" 2 + } + } + return $et_rvalref_saved +} + proc check_v3_target_namedlocale { } { global et_namedlocale_saved global et_namedlocale_target_name @@ -830,7 +916,6 @@ proc check_v3_target_namedlocale { } { proc check_v3_target_debug_mode { } { global cxxflags global et_debug_mode - global tool if { ![info exists et_debug_mode_target_name] } { @@ -879,3 +964,59 @@ proc check_v3_target_debug_mode { } { verbose "check_v3_target_debug_mode: $et_debug_mode" 2 return $et_debug_mode } + +proc check_v3_target_parallel_mode { } { + global cxxflags + global DEFAULT_CXXFLAGS + global et_parallel_mode + + global tool + + if { ![info exists et_parallel_mode_target_name] } { + set et_parallel_mode_target_name "" + } + + # If the target has changed since we set the cached value, clear it. + set current_target [current_target_name] + if { $current_target != $et_parallel_mode_target_name } { + verbose "check_v3_target_parallel_mode: `$et_parallel_mode_target_name'" 2 + set et_parallel_mode_target_name $current_target + if [info exists et_parallel_mode] { + verbose "check_v3_target_parallel_mode: removing cached result" 2 + unset et_parallel_mode + } + } + + if [info exists et_parallel_mode] { + verbose "check_v3_target_parallel_mode: using cached result" 2 + } else { + set et_parallel_mode 0 + + # Set up, compile, and execute a C++ test program that depends + # on parallel mode working. + set src parallel_mode[pid].cc + set exe parallel_mode[pid].exe + + set f [open $src "w"] + puts $f "#include <omp.h>" + puts $f "int main()" + puts $f "{ return 0; }" + close $f + + set cxxflags_saved $cxxflags + set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror" + + set lines [v3_target_compile $src $exe executable ""] + set cxxflags $cxxflags_saved + file delete $src + + if [string match "" $lines] { + # No error message, compilation succeeded. + set et_parallel_mode 1 + } else { + verbose "check_v3_target_parallel_mode: compilation failed" 2 + } + } + verbose "check_v3_target_parallel_mode: $et_parallel_mode" 2 + return $et_parallel_mode +} diff --git a/libstdc++-v3/testsuite/performance/25_algorithms/lexicographical_compare.cc b/libstdc++-v3/testsuite/performance/25_algorithms/lexicographical_compare.cc new file mode 100644 index 00000000000..b983881c4b4 --- /dev/null +++ b/libstdc++-v3/testsuite/performance/25_algorithms/lexicographical_compare.cc @@ -0,0 +1,55 @@ +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include <vector> +#include <testsuite_performance.h> + +// libstdc++/32908 +int main() +{ + using namespace __gnu_test; + + time_counter time; + resource_counter resource; + + int cnt = 0; + std::vector<int> a(10000), b(10000); + + start_counters(time, resource); + for (int i = 0; i < 100000; ++i) + { + if (a < b) + ++cnt; + if (a > b) + ++cnt; + } + stop_counters(time, resource); + report_performance(__FILE__, "", time, resource); + clear_counters(time, resource); + + return cnt; +} diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc index 27a7ff87903..cb7720cc609 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_random_int_erase_mem_usage.cc @@ -68,7 +68,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; size_t vn = 200; size_t vs = 200; @@ -87,7 +87,7 @@ main(int argc, char* a_p_argv[]) erase_test<vec_t::const_iterator> tst(b, vn, vs, vm); typedef __gnu_test::tracker_allocator<char> alloc_t; { - typedef hash_common_types<int, pb_ds::null_mapped_type, int_hash, std::equal_to<int>, alloc_t>::performance_tl tl_t; + typedef hash_common_types<int, __gnu_pbds::null_mapped_type, int_hash, std::equal_to<int>, alloc_t>::performance_tl tl_t; tl_t tl; __gnu_cxx::typelist::apply(tst, tl); diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_zlob_random_int_find_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_zlob_random_int_find_timing.cc index 602ff530e24..d3cebc87571 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_zlob_random_int_find_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/hash_zlob_random_int_find_timing.cc @@ -60,7 +60,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; size_t vn = 200; size_t vs = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_find_timing.hpp b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_find_timing.hpp index 61a91f4dda4..2b8a2a9b77b 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_find_timing.hpp +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_find_timing.hpp @@ -67,7 +67,7 @@ set_test_parameters(size_t& n, size_t&s, size_t& m, size_t& prm); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t prm; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert_mem_usage.hpp b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert_mem_usage.hpp index 5bfa42b3b6d..a485a8b915d 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert_mem_usage.hpp +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert_mem_usage.hpp @@ -68,7 +68,7 @@ set_test_parameters(size_t& n, size_t&s, size_t& m, size_t& prm); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t prm; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert_timing.hpp b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert_timing.hpp index cdf7e94f910..f7f33f051e0 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert_timing.hpp +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/multimap_text_insert_timing.hpp @@ -67,7 +67,7 @@ set_test_parameters(size_t& n, size_t&s, size_t& m, size_t& prm); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t prm; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_random_int_push_pop_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_random_int_push_pop_timing.cc index 4487c27cf70..ad6fdd176c1 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_random_int_push_pop_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_random_int_push_pop_timing.cc @@ -60,7 +60,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; size_t vn = 200; size_t vs = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_random_int_push_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_random_int_push_timing.cc index b867f9b79e7..5ab8db1edd5 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_random_int_push_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_random_int_push_timing.cc @@ -60,7 +60,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; size_t vn = 200; size_t vs = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_join_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_join_timing.cc index 4add14795cb..c5ba556f239 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_join_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_join_timing.cc @@ -80,7 +80,7 @@ usage() int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t vn = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_modify_timing.hpp b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_modify_timing.hpp index 4eadff4f6d1..e8dffa6978b 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_modify_timing.hpp +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_modify_timing.hpp @@ -63,7 +63,7 @@ set_test_parameters(bool& b); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t vn = 100; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem_usage.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem_usage.cc index 3185e9b1ff0..adbbc0384fd 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem_usage.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_pop_mem_usage.cc @@ -61,7 +61,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t vn = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_push_pop_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_push_pop_timing.cc index a02f50b6d5a..65a009c08ce 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_push_pop_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_push_pop_timing.cc @@ -60,7 +60,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t vn = 200; size_t vs = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_push_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_push_timing.cc index cd60912051a..6fcaa0d23f6 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_push_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/priority_queue_text_push_timing.cc @@ -60,7 +60,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t vn = 200; size_t vs = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_find_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_find_timing.cc index 409685dd64e..87d14d7f9e5 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_find_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_find_timing.cc @@ -61,7 +61,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; size_t vn = 200; size_t vs = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_subscript_find_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_subscript_find_timing.cc index d500bd39f0d..e336114b489 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_subscript_find_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_subscript_find_timing.cc @@ -61,7 +61,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; size_t vn = 200; size_t vs = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_subscript_insert_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_subscript_insert_timing.cc index 09a13fec66b..e9554c1600d 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_subscript_insert_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/random_int_subscript_insert_timing.cc @@ -61,7 +61,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; size_t vn = 200; size_t vs = 200; size_t vm = 2100; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/text_find_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/text_find_timing.cc index cc88399463f..8409a4aebb2 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/text_find_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/text_find_timing.cc @@ -62,7 +62,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t vn = 200; size_t vs = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc index 5909b56b5a3..2ca61ca1495 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_order_statistics_timing.cc @@ -59,7 +59,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; size_t vn = 200; size_t vs = 200; size_t vm = 2100; @@ -71,7 +71,7 @@ main(int argc, char* a_p_argv[]) { typedef tree_order_statistics_test< true> test_t; test_t tst(vn, vs, vm); - typedef tree_common_types<int, pb_ds::null_mapped_type, std::less<int>, pb_ds::tree_order_statistics_node_update>::performance_tl tl_t; + typedef tree_common_types<int, __gnu_pbds::null_mapped_type, std::less<int>, __gnu_pbds::tree_order_statistics_node_update>::performance_tl tl_t; tl_t tl; __gnu_cxx::typelist::apply(tst, tl); } diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_split_join_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_split_join_timing.cc index 3a27eb2a0b7..9c4970f2826 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_split_join_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_split_join_timing.cc @@ -59,7 +59,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; size_t vn = 200; size_t vs = 200; size_t vm = 2100; @@ -72,7 +72,7 @@ main(int argc, char* a_p_argv[]) typedef tree_split_join_test<true> test_t; test_t tst(vn, vs, vm); - typedef tree_common_types<int, pb_ds::null_mapped_type>::performance_tl tl_t; + typedef tree_common_types<int, __gnu_pbds::null_mapped_type>::performance_tl tl_t; tl_t tl; __gnu_cxx::typelist::apply(tst, tl); } diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_text_insert_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_text_insert_timing.cc index 5ee6f90be3c..23a63023314 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_text_insert_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_text_insert_timing.cc @@ -62,7 +62,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t vn = 200; diff --git a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_text_lor_find_timing.cc b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_text_lor_find_timing.cc index da7bdedca74..44329b3f769 100644 --- a/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_text_lor_find_timing.cc +++ b/libstdc++-v3/testsuite/performance/ext/pb_ds/tree_text_lor_find_timing.cc @@ -60,7 +60,7 @@ usage(); int main(int argc, char* a_p_argv[]) { - using namespace pb_ds::test; + using namespace __gnu_pbds::test; std::string f_name = "thirty_years_among_the_dead_preproc.txt"; size_t vn = 200; diff --git a/libstdc++-v3/testsuite/thread/guard.cc b/libstdc++-v3/testsuite/thread/guard.cc new file mode 100644 index 00000000000..a509321f83f --- /dev/null +++ b/libstdc++-v3/testsuite/thread/guard.cc @@ -0,0 +1,66 @@ +// +// Copyright (C) 2007, 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* } } +// { dg-options "-pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-darwin* alpha*-*-osf* } } + +#include <cstdlib> +#include <pthread.h> + +// This used to deadlock with the old libstdc++ because there is only one +// global mutex guarding initialization of statics and it is held during by +// the initializer thread of a static until the variable is completely +// initialized. If the initializer thread creates and waits for another thread +// which also initializes a static variable, there will be a deadlock because +// the first thread is holding the mutex and waiting for the second thread, +// which is blocked when it is acquiring the mutex. + +int +get_bar (void) +{ + return 1; +} + +void* +do_something (void *arg) +{ + static int bar __attribute__((unused)) = get_bar (); + return NULL; +} + +int +get_foo (void) +{ + pthread_t new_thread; + + if (pthread_create (&new_thread, NULL, do_something, NULL) != 0) + std::abort (); + + if (pthread_join (new_thread, NULL) != 0) + std::abort (); + + return 1; +} + +int +main (int argc, char **argv) +{ + static int foo __attribute__((unused)) = get_foo (); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..0d4839c9871 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/requirements/explicit_instantiation/2.cc @@ -0,0 +1,34 @@ +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// TR1 2.2.2 Template class shared_ptr [tr.util.smartptr.shared] + +#include <tr1/memory> +#include <testsuite_tr1.h> + +// { dg-do compile } + +// Check the _S_single lock policy can be instantiated. For a thread-enabled +// library this checks the templates can be instantiated for non-default +// lock policy, for a single-threaded lib this is redundant but harmless. +using namespace __gnu_test; +using std::tr1::__shared_ptr; +using std::tr1::_S_single; +template class __shared_ptr<int, _S_single>; +template class __shared_ptr<ClassType, _S_single>; +template class __shared_ptr<IncompleteClass, _S_single>; diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc index ecf5fa2c159..3c681fd87b4 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/default_weaktoshared.cc @@ -82,7 +82,7 @@ struct shared_and_weak_pools void* thread_hammer_and_kill(void* opaque_pools) { - shared_and_weak_pools& pools = *reinterpret_cast<shared_and_weak_pools*>(opaque_pools); + shared_and_weak_pools& pools = *static_cast<shared_and_weak_pools*>(opaque_pools); // Using the same parameters as in the RNG test cases. std::tr1::mersenne_twister< unsigned long, 32, 624, 397, 31, @@ -117,7 +117,7 @@ void* thread_hammer_and_kill(void* opaque_pools) void* thread_hammer(void* opaque_weak) { - wp_vector_t& weak_pool = *reinterpret_cast<wp_vector_t*>(opaque_weak); + wp_vector_t& weak_pool = *static_cast<wp_vector_t*>(opaque_weak); // Using the same parameters as in the RNG test cases. std::tr1::mersenne_twister< unsigned long, 32, 624, 397, 31, @@ -162,14 +162,14 @@ test01() #endif pthread_attr_t tattr; - int ret = pthread_attr_init(&tattr); + pthread_attr_init(&tattr); shared_and_weak_pools pools(obj_pool, weak_pool[0]); - pthread_create(threads, &tattr, thread_hammer_and_kill, reinterpret_cast<void*>(&pools)); + pthread_create(threads, &tattr, thread_hammer_and_kill, static_cast<void*>(&pools)); for (unsigned int worker = 1; worker < HAMMER_MAX_THREADS; worker++) { if (pthread_create(&threads[worker], &tattr, - thread_hammer, reinterpret_cast<void*>(&weak_pool[worker]))) + thread_hammer, static_cast<void*>(&weak_pool[worker]))) std::abort(); } // Wait for threads to complete, then check integrity of reference. diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc index f11474fb1c1..433189e0614 100644 --- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/thread/mutex_weaktoshared.cc @@ -84,7 +84,7 @@ struct shared_and_weak_pools void* thread_hammer_and_kill(void* opaque_pools) { - shared_and_weak_pools& pools = *reinterpret_cast<shared_and_weak_pools*>(opaque_pools); + shared_and_weak_pools& pools = *static_cast<shared_and_weak_pools*>(opaque_pools); // Using the same parameters as in the RNG test cases. std::tr1::mersenne_twister< unsigned long, 32, 624, 397, 31, @@ -119,7 +119,7 @@ void* thread_hammer_and_kill(void* opaque_pools) void* thread_hammer(void* opaque_weak) { - wp_vector_t& weak_pool = *reinterpret_cast<wp_vector_t*>(opaque_weak); + wp_vector_t& weak_pool = *static_cast<wp_vector_t*>(opaque_weak); // Using the same parameters as in the RNG test cases. std::tr1::mersenne_twister< unsigned long, 32, 624, 397, 31, @@ -164,14 +164,14 @@ test01() #endif pthread_attr_t tattr; - int ret = pthread_attr_init(&tattr); + pthread_attr_init(&tattr); shared_and_weak_pools pools(obj_pool, weak_pool[0]); - pthread_create(threads, &tattr, thread_hammer_and_kill, reinterpret_cast<void*>(&pools)); + pthread_create(threads, &tattr, thread_hammer_and_kill, static_cast<void*>(&pools)); for (unsigned int worker = 1; worker < HAMMER_MAX_THREADS; worker++) { if (pthread_create(&threads[worker], &tattr, - thread_hammer, reinterpret_cast<void*>(&weak_pool[worker]))) + thread_hammer, static_cast<void*>(&weak_pool[worker]))) std::abort(); } // Wait for threads to complete, then check integrity of reference. diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/2.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/2.cc new file mode 100644 index 00000000000..567f3489c23 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/weak_ptr/requirements/explicit_instantiation/2.cc @@ -0,0 +1,35 @@ +// Copyright (C) 2007 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// TR1 2.2.4 Template class weak_ptr [tr.util.smartptr.weak] + +#include <tr1/memory> +#include <testsuite_tr1.h> + +// { dg-do compile } + +// Check the _S_single lock policy can be instantiated. For a thread-enabled +// library this checks the templates can be instantiated for non-default +// lock policy, for a single-threaded lib this is redundant but harmless. +using namespace __gnu_test; +using std::tr1::__weak_ptr; +using std::tr1::_S_single; +template class __weak_ptr<int, _S_single>; +template class __weak_ptr<void, _S_single>; +template class __weak_ptr<ClassType, _S_single>; +template class __weak_ptr<IncompleteClass, _S_single>; diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc index 3d47cd62ee8..823e66ea0d0 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/cons/gen1.cc @@ -21,6 +21,8 @@ // 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong] // 5.1.1 Table 16 line 3 template ctor(gen) +// { dg-require-time "" } + #include <ctime> #include <tr1/random> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc index 94d81edc213..e41fbba48cd 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc @@ -1,6 +1,6 @@ // 2006-06-04 Stephen M. Webb <stephen.webb@bregmasoft.com> // -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007 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 @@ -20,25 +20,13 @@ // { dg-do compile } // { dg-options "-D_GLIBCXX_CONCEPT_CHECKS" } -// { dg-error "not a valid type" "" { target *-*-* } 37 } -// { dg-error "invalid type" "" { target *-*-* } 37 } +// { dg-error "not a valid type" "" { target *-*-* } 31 } +// { dg-error "invalid type" "" { target *-*-* } 31 } // 5.1.4.1 class template linear_congruential [tr.rand.eng.lcong] // 5.1.4.1 [4] #include <tr1/random> -#include <testsuite_hooks.h> + +std::tr1::linear_congruential<double, 48271, 0, 2147483647> x; -void -test01() -{ - using namespace std::tr1; - - linear_congruential<double, 48271, 0, 2147483647> x; -} - -int main() -{ - test01(); - return 0; -} diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc index 7861954a13f..5e4075d24fb 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/mersenne_twister/cons/gen1.cc @@ -21,6 +21,8 @@ // 5.1.4.2 class template mersenne_twister [tr.rand.eng.mers] // 5.1.1 Table 16 line 3 Gen ctor +// { dg-require-time "" } + #include <ctime> #include <tr1/random> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc index 509144563c3..ef583dda341 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry/cons/gen1.cc @@ -21,6 +21,8 @@ // 5.1.4.3 class template subtract_with_carry [tr.rand.eng.sub] // 5.1.1 Table 16 line 3 Gen ctor +// { dg-require-time "" } + #include <ctime> #include <tr1/random> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc index 0a95397c518..d7a894b0870 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/subtract_with_carry_01/cons/gen1.cc @@ -21,6 +21,8 @@ // 5.1.4.4 class template subtract_with_carry_01 [tr.rand.eng.sub1] // 5.1.1 Table 16 line 3 Gen ctor +// { dg-require-time "" } + #include <ctime> #include <tr1/random> #include <testsuite_hooks.h> diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc new file mode 100644 index 00000000000..f699ba32448 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/uniform_int/33128.cc @@ -0,0 +1,43 @@ +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 5.1.7.1 Class template uniform_int +// 5.1.1 [7] Table 17 + +#include <tr1/random> +#include <testsuite_hooks.h> + +// libstdc++/33128 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::tr1::mt19937 rng; + std::tr1::uniform_int<> six(1,6); + std::tr1::variate_generator<std::tr1::mt19937, std::tr1::uniform_int<> > + die(rng, six); + + int val = die(); + VERIFY( val >= 1 && val <= 6 ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/check_nan.cc index 98f174fa7b1..f03c7a2eaee 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2006-02-04 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/compile.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/compile.cc index 3beffc10ee3..995c5376d1f 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/compile.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/01_assoc_laguerre/compile.cc @@ -2,7 +2,7 @@ // 2006-02-04 Edward Smith-Rowland <3dw4rd@verizon.net> // -// Copyright (C) 2006-2007 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007 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 @@ -27,18 +27,16 @@ void test01() { - float xf = 0.5F; double xd = 0.5; long double xl = 0.5L; unsigned int n = 2, m = 1; - float a = std::tr1::assoc_laguerre(n, m, xf); - float b = std::tr1::assoc_laguerref(n, m, xf); - double c = std::tr1::assoc_laguerre(n, m, xd); - long double d = std::tr1::assoc_laguerre(n, m, xl); - long double e = std::tr1::assoc_laguerrel(n, m, xl); + std::tr1::assoc_laguerre(n, m, xf); + std::tr1::assoc_laguerref(n, m, xf); + std::tr1::assoc_laguerre(n, m, xd); + std::tr1::assoc_laguerre(n, m, xl); + std::tr1::assoc_laguerrel(n, m, xl); return; } - diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/check_nan.cc index 174a43c791c..1e4138ab374 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/02_assoc_legendre/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/03_beta/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/03_beta/check_nan.cc index ca8246c4e72..40fdd67eba7 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/03_beta/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/03_beta/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/04_comp_ellint_1/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/04_comp_ellint_1/check_nan.cc index f5a0e9b74ca..b026dd958cd 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/04_comp_ellint_1/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/04_comp_ellint_1/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/05_comp_ellint_2/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/05_comp_ellint_2/check_nan.cc index b30c77a7555..c9c8001e262 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/05_comp_ellint_2/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/05_comp_ellint_2/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_nan.cc index b928eab7642..6da4ec55c31 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/06_comp_ellint_3/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/check_nan.cc index 1f2bb40bd0c..71abf3e8acb 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/07_conf_hyperg/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_nan.cc index 4220f0236d5..0a8c3055e61 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/08_cyl_bessel_i/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_nan.cc index 606697a00b4..85548e048cd 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/09_cyl_bessel_j/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_nan.cc index 72754a7dacd..ee9f7b3452b 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/10_cyl_bessel_k/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_nan.cc index 6d631086928..18381c3e005 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/11_cyl_neumann/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/12_ellint_1/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/12_ellint_1/check_nan.cc index d86c5b40f54..d48b211c227 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/12_ellint_1/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/12_ellint_1/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/13_ellint_2/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/13_ellint_2/check_nan.cc index 9e1775e5749..f6dfc3a9ee5 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/13_ellint_2/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/13_ellint_2/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/check_nan.cc index fcf2f680d94..3f345a8b9ad 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/14_ellint_3/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/15_expint/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/15_expint/check_nan.cc index f01caa05144..b6c8f603350 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/15_expint/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/15_expint/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_nan.cc index 8d06a964d79..a45ae593a55 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/16_hermite/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/18_laguerre/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/18_laguerre/check_nan.cc index 121a4528d06..d8c04d41a3d 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/18_laguerre/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/18_laguerre/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/19_legendre/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/19_legendre/check_nan.cc index e051b3cadff..adb3aa2fd9a 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/19_legendre/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/19_legendre/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_nan.cc index bdfa2e9af18..fb2c0935313 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc index 2a86846ea4a..ac80c334d31 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_neg.cc @@ -20,6 +20,12 @@ // riemann_zeta +// This can take long on simulators, timing out the test. +// { dg-options "-DMAX_ITERATIONS=5" { target simulator } } + +#ifndef MAX_ITERATIONS +#define MAX_ITERATIONS (sizeof(data001) / sizeof(testcase_riemann_zeta<double>)) +#endif // Compare against values generated by the GNU Scientific Library. // The GSL can be found on the web: http://www.gnu.org/software/gsl/ @@ -106,8 +112,7 @@ void test001() const Tp eps = std::numeric_limits<Tp>::epsilon(); Tp max_abs_diff = -Tp(1); Tp max_abs_frac = -Tp(1); - unsigned int num_datum = sizeof(data001) - / sizeof(testcase_riemann_zeta<double>); + unsigned int num_datum = MAX_ITERATIONS; for (unsigned int i = 0; i < num_datum; ++i) { const Tp f = std::tr1::riemann_zeta(Tp(data001[i].x)); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_pos.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_pos.cc index 3188c334f5b..e5d8758ec4d 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_pos.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/20_riemann_zeta/check_value_pos.cc @@ -20,6 +20,12 @@ // riemann_zeta +// This can take long on simulators, timing out the test. +// { dg-options "-DMAX_ITERATIONS=5" { target simulator } } + +#ifndef MAX_ITERATIONS +#define MAX_ITERATIONS (sizeof(data001) / sizeof(testcase_riemann_zeta<double>)) +#endif // Compare against values generated by the GNU Scientific Library. // The GSL can be found on the web: http://www.gnu.org/software/gsl/ @@ -196,8 +202,7 @@ void test001() const Tp eps = std::numeric_limits<Tp>::epsilon(); Tp max_abs_diff = -Tp(1); Tp max_abs_frac = -Tp(1); - unsigned int num_datum = sizeof(data001) - / sizeof(testcase_riemann_zeta<double>); + unsigned int num_datum = MAX_ITERATIONS; for (unsigned int i = 0; i < num_datum; ++i) { const Tp f = std::tr1::riemann_zeta(Tp(data001[i].x)); diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_nan.cc index 2b856742d0e..29a98a46586 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/21_sph_bessel/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/check_nan.cc index e8bbfff188f..179ed2d627f 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/22_sph_legendre/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_nan.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_nan.cc index 17f8ca6b0ac..556c9db1a99 100644 --- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_nan.cc +++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/special_functions/23_sph_neumann/check_nan.cc @@ -1,4 +1,5 @@ // { dg-require-c-std "" } +// { dg-options "-mieee" { target sh*-*-* } } // 2007-01-10 Edward Smith-Rowland <3dw4rd@verizon.net> // diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/empty.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/empty.cc index 7eda9223701..50e7ead1895 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/empty.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/empty.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -30,8 +30,8 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; - + array_type a = { { 0, 1, 2, 3, 4 } }; + VERIFY( a.empty() == false ); } @@ -40,7 +40,7 @@ test01() typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; array_type a; - + VERIFY( a.empty() == true ); } } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/max_size.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/max_size.cc index 22e0c7b503a..05849b88356 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/max_size.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/max_size.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -30,8 +30,8 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; - + array_type a = { { 0, 1, 2, 3, 4 } }; + VERIFY( a.max_size() == len ); } @@ -40,7 +40,7 @@ test01() typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; array_type a; - + VERIFY( a.max_size() == len ); } } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/size.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/size.cc index bb04ab151a0..748fb8d2cfb 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/size.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/capacity/size.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -30,8 +30,8 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; - + array_type a = { { 0, 1, 2, 3, 4 } }; + VERIFY( a.size() == len ); } @@ -40,7 +40,7 @@ test01() typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; array_type a; - + VERIFY( a.size() == len ); } } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/equal.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/equal.cc index 0df99ef0294..971fcde1d30 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/equal.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/equal.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -29,10 +29,10 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; - array_type b = { 0, 1, 2, 3, 4 }; - array_type c = { 0, 1, 2, 3 }; - + array_type a = { { 0, 1, 2, 3, 4 } }; + array_type b = { { 0, 1, 2, 3, 4 } }; + array_type c = { { 0, 1, 2, 3 } }; + VERIFY( a == b ); VERIFY( !(a == c) ); } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater.cc index 11a8e770741..8d38e9a8a3c 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -29,10 +29,10 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; - array_type b = { 0, 1, 2, 3, 4 }; - array_type c = { 0, 1, 2, 3, 7 }; - + array_type a = { { 0, 1, 2, 3, 4 } }; + array_type b = { { 0, 1, 2, 3, 4 } }; + array_type c = { { 0, 1, 2, 3, 7 } }; + VERIFY( !(a > b) ); VERIFY( c > a ); } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater_or_equal.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater_or_equal.cc index ad4e6d607f9..914cd2e326a 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater_or_equal.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/greater_or_equal.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -29,10 +29,10 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; - array_type b = { 0, 1, 2, 3, 4 }; - array_type c = { 0, 1, 2, 3, 7 }; - + array_type a = { { 0, 1, 2, 3, 4 } }; + array_type b = { { 0, 1, 2, 3, 4 } }; + array_type c = { { 0, 1, 2, 3, 7 } }; + VERIFY( a >= b ); VERIFY( c >= a ); } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less.cc index b42dc645f3e..e6f394cc935 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -29,10 +29,10 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; - array_type b = { 0, 1, 2, 3, 4 }; - array_type c = { 0, 1, 2, 3, 7 }; - + array_type a = { { 0, 1, 2, 3, 4 } }; + array_type b = { { 0, 1, 2, 3, 4 } }; + array_type c = { { 0, 1, 2, 3, 7 } }; + VERIFY( !(a < b) ); VERIFY( a < c ); } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less_or_equal.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less_or_equal.cc index 6b8f6caf7c4..d74b529edd1 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less_or_equal.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/less_or_equal.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -29,10 +29,10 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; - array_type b = { 0, 1, 2, 3, 4 }; - array_type c = { 0, 1, 2, 3, 7 }; - + array_type a = { { 0, 1, 2, 3, 4 } }; + array_type b = { { 0, 1, 2, 3, 4 } }; + array_type c = { { 0, 1, 2, 3, 7 } }; + VERIFY( a <= b ); VERIFY( a <= c ); } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/not_equal.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/not_equal.cc index 717fc8a8307..dc0ac6381f9 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/not_equal.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/comparison_operators/not_equal.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -29,10 +29,10 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; - array_type b = { 0, 1, 2, 3, 4 }; - array_type c = { 0, 1, 2, 3 }; - + array_type a = { { 0, 1, 2, 3, 4 } }; + array_type b = { { 0, 1, 2, 3, 4 } }; + array_type c = { { 0, 1, 2, 3 } }; + VERIFY( !(a != b) ); VERIFY( a != c ); } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc index 1c6c8edd670..ca3ea5d3b66 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc @@ -2,7 +2,7 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004, 2005 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -29,8 +29,8 @@ test01() { typedef std::tr1::array<int, 5> array_type; - array_type a = { 0, 1, 2, 3, 4 }; - array_type b = { 0, 1, 2, 3 }; + array_type a = { { 0, 1, 2, 3, 4 } }; + array_type b = { { 0, 1, 2, 3 } }; a = b; } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/at_out_of_range.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/at_out_of_range.cc index 10796dccfb8..cee0e732a71 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/at_out_of_range.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/at_out_of_range.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -30,7 +30,7 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; + array_type a = { { 0, 1, 2, 3, 4 } }; try { diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/back.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/back.cc index cc08381341e..9ba2f6343ac 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/back.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/back.cc @@ -1,6 +1,6 @@ // 2005-08-26 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2005 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 2008 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 @@ -32,13 +32,13 @@ test01() typedef std::tr1::array<int, len> array_type; { - array_type a = { 0, 1, 2, 3, 4 }; + array_type a = { { 0, 1, 2, 3, 4 } }; int& ri = a.back(); VERIFY( ri == 4 ); } { - const array_type ca = { 4, 3, 2, 1, 0 }; + const array_type ca = { { 4, 3, 2, 1, 0 } }; const int& cri = ca.back(); VERIFY( cri == 0 ); } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/data.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/data.cc index f6866dcc670..3a4efcf1ffb 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/data.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/data.cc @@ -1,6 +1,6 @@ // 2005-08-26 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2005 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 2008 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 @@ -32,13 +32,13 @@ test01() typedef std::tr1::array<int, len> array_type; { - array_type a = { 0, 1, 2, 3, 4 }; + array_type a = { { 0, 1, 2, 3, 4 } }; int* pi = a.data(); VERIFY( *pi == 0 ); } { - const array_type ca = { 4, 3, 2, 1, 0 }; + const array_type ca = { { 4, 3, 2, 1, 0 } }; const int* pci = ca.data(); VERIFY( *pci == 4 ); } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/front.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/front.cc index 33c93bef52f..493c6ed4c1b 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/front.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/element_access/front.cc @@ -1,6 +1,6 @@ // 2005-08-26 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2005 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 2008 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 @@ -32,13 +32,13 @@ test01() typedef std::tr1::array<int, len> array_type; { - array_type a = { 0, 1, 2, 3, 4 }; + array_type a = { { 0, 1, 2, 3, 4 } }; int& ri = a.front(); VERIFY( ri == 0 ); } { - const array_type ca = { 4, 3, 2, 1, 0 }; + const array_type ca = { { 4, 3, 2, 1, 0 } }; const int& cri = ca.front(); VERIFY( cri == 4 ); } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/iterators/end_is_one_past.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/iterators/end_is_one_past.cc index 497fb61e32d..58ba7be4ea0 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/iterators/end_is_one_past.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/iterators/end_is_one_past.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -30,7 +30,7 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; + array_type a = { { 0, 1, 2, 3, 4 } }; array_type::iterator b = a.begin(); array_type::iterator e = a.end(); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc index e65c54e9aee..5ffe849d91f 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/assign.cc @@ -1,6 +1,6 @@ // 2006-02-24 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007, 2008 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 @@ -31,7 +31,7 @@ test01() const size_t len = 3; typedef std::tr1::array<int, len> array_type; - array_type a = { 0, 1, 2 }; + array_type a = { { 0, 1, 2 } }; const int value = 5; a.assign(value); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc index 7632674cf50..30c78583a44 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/contiguous.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -29,7 +29,7 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; bool test __attribute__((unused)) = true; - array_type a = { 0, 1, 2, 3, 4 }; + array_type a = { { 0, 1, 2, 3, 4 } }; // &a[n] == &a[0] + n for all 0 <= n < N. for (size_t i = 0; i < len; ++i) diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc index 3baa3cb2b3a..3f09b89237a 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/member_swap.cc @@ -1,6 +1,6 @@ // 2006-02-24 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007, 2008 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 @@ -31,10 +31,10 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; - array_type a = { 0, 1, 2, 3, 4 }; + array_type a = { { 0, 1, 2, 3, 4 } }; const array_type a_ref = a; - array_type b = { 4, 3, 2, 1, 0 }; + array_type b = { { 4, 3, 2, 1, 0 } }; const array_type b_ref = b; a.swap(b); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/specialized_algorithms/swap.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/specialized_algorithms/swap.cc index 6ec9968f4c7..f369838daa5 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/specialized_algorithms/swap.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/specialized_algorithms/swap.cc @@ -1,6 +1,6 @@ // 2006-02-24 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2006 Free Software Foundation, Inc. +// Copyright (C) 2006, 2007, 2008 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 @@ -31,10 +31,10 @@ test01() const size_t len = 5; typedef std::tr1::array<int, len> array_type; - array_type a = { 0, 1, 2, 3, 4 }; + array_type a = { { 0, 1, 2, 3, 4 } }; const array_type a_ref = a; - array_type b = { 4, 3, 2, 1, 0 }; + array_type b = { { 4, 3, 2, 1, 0 } }; const array_type b_ref = b; std::tr1::swap(a, b); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/get.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/get.cc index b7463b38957..59c0c7ffc9a 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/get.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/tuple_interface/get.cc @@ -1,6 +1,6 @@ // 2005-08-26 Paolo Carlini <pcarlini@suse.de> // -// Copyright (C) 2005 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 2008 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,13 +33,13 @@ test01() typedef array<int, len> array_type; { - array_type a = { 0, 1, 2, 3, 4 }; + array_type a = { { 0, 1, 2, 3, 4 } }; int& ri = get<0>(a); VERIFY( ri == 0 ); } { - const array_type a = { 4, 3, 2, 1, 0 }; + const array_type a = { { 4, 3, 2, 1, 0 } }; const int& cri = get<1>(a); VERIFY( cri == 3 ); } diff --git a/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc b/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc new file mode 100644 index 00000000000..7b45816da50 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/6_containers/hash/operators/size_t.cc @@ -0,0 +1,76 @@ +// 2007-08-20 <benjamin@redhat.com> +// +// Copyright (C) 2007, 2008 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// 6.3.3 Class template hash + +#include <tr1/functional> +#include <string> +#include <testsuite_hooks.h> + +template<typename T> + void + do_test() + { + bool test __attribute__((unused)) = true; + + typedef T value_type; + typedef std::tr1::hash<value_type> hash_type; + using std::size_t; + + value_type v = T(); // default initialized is fine, same value all + // that matters. + hash_type h1; + size_t r1 = size_t(h1(v)); + + hash_type h2; + size_t r2 = size_t(h2(v)); + + VERIFY( r1 == r2 ); + } + +void test01() +{ + do_test<bool>(); + do_test<char>(); + do_test<signed char>(); + do_test<unsigned char>(); + do_test<short>(); + do_test<int>(); + do_test<long>(); + do_test<unsigned short>(); + do_test<unsigned int>(); + do_test<unsigned long>(); + do_test<int*>(); + do_test<std::string>(); + do_test<float>(); + do_test<double>(); + do_test<long double>(); + +#ifdef _GLIBCXX_USE_WCHAR_T + do_test<wchar_t>(); + do_test<std::wstring>(); +#endif +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/6_containers/headers/functional/synopsis.cc b/libstdc++-v3/testsuite/tr1/6_containers/headers/functional/synopsis.cc index c4e2e9c3160..fd0b595eb3f 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/headers/functional/synopsis.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/headers/functional/synopsis.cc @@ -29,24 +29,5 @@ namespace tr1 { // [6.3.3] Hash function base template template <class T> struct hash; - // Hash function specializations - template <> struct hash<bool>; - template <> struct hash<char>; - template <> struct hash<signed char>; - template <> struct hash<unsigned char>; - template <> struct hash<wchar_t>; - template <> struct hash<short>; - template <> struct hash<unsigned short>; - template <> struct hash<int>; - template <> struct hash<unsigned int>; - template <> struct hash<long>; - template <> struct hash<unsigned long>; - template <> struct hash<float>; - template <> struct hash<double>; - template <> struct hash<long double>; - template<class T> struct hash<T*>; - template <> struct hash<std::string>; - template <> struct hash<std::wstring>; - } // namespace tr1 } // namespace std diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc index f22d975c86b..7eee7a8d12d 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/comparison_operators/comparisons.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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 @@ -25,6 +25,8 @@ using namespace std::tr1; +bool test __attribute__((unused)) = true; + #define TEST1(x) VERIFY( x == x && !(x != x) && x <= x && !(x < x) ) int diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc index 6207b41f9df..973b5f0ce31 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/assignment.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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,6 +28,8 @@ using namespace std::tr1; int main() { + bool test __attribute__((unused)) = true; + tuple<> ta; tuple<> tb; ta = tb; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc index a23ad8dbc74..3525bf2cb7c 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/big_tuples.cc @@ -1,6 +1,7 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 +// 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,11 +34,13 @@ struct foo void test_constructors() { + bool test __attribute__((unused)) = true; + int x1=0,x2=0; const int &z1=x1; // Test empty constructor - tuple<> ta; + tuple<> ta __attribute__((unused)); tuple<int,int> tb; // Test construction from values tuple<int,int> tc(x1,x2); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc index 89e9a113ffa..73f9ed6879a 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/cons/constructor.cc @@ -1,6 +1,7 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007, 2008 +// 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 @@ -29,11 +30,13 @@ using std::pair; int main() { + bool test __attribute__((unused)) = true; + int x1=0,x2=0; const int &z1=x1; // Test empty constructor - tuple<> ta; + tuple<> ta __attribute__((unused)); tuple<int,int> tb; // Test construction from values tuple<int,int> tc(x1,x2); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc index ca69be21f0e..9a0fc6f6dae 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/make_tuple.cc @@ -29,6 +29,8 @@ using namespace std::tr1; int main() { + bool test __attribute__((unused)) = true; + int i=0; make_tuple(1,2,4.0); make_tuple(ref(i)) = tuple<int>(1); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc index ea63a5d5c6a..d8389be410d 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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,6 +28,8 @@ using namespace std::tr1; int main() { + bool test __attribute__((unused)) = true; + int x1 = 0; int x2 = 0; int y1 = 0; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc new file mode 100644 index 00000000000..4682424cafa --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/creation_functions/tie2.cc @@ -0,0 +1,37 @@ +// Copyright (C) 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// Tuple + +#include <tr1/tuple> +#include <string> +#include <testsuite_hooks.h> + +int +main() +{ + bool test __attribute__((unused)) = true; + using namespace std::tr1; + + int i; + std::string s; + + tie(i, ignore, s) = make_tuple(42, 3.14, "C++"); + VERIFY( i == 42 ); + VERIFY( s == "C++" ); +} diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc index 85ec6cb10dc..5cfda148634 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/element_access/get.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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,6 +28,8 @@ using namespace std::tr1; int main() { + bool test __attribute__((unused)) = true; + int j=1; const int k=2; tuple<int,int &,const int&> a(0,j,k); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc index 44a93171e85..6178e567699 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_element.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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 @@ -31,7 +31,7 @@ struct foo int main() { - // As foo isn't constructable from anything else, this + // As foo isn't constructible from anything else, this // lets us check if type is returning foo when it should foo q1; tuple_element<0,tuple<foo,void,int> >::type q2(q1); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc index 967cb43d95c..73389373b26 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/tuple/tuple_size.cc @@ -1,6 +1,6 @@ // 2004-09-23 Chris Jefferson <chris@bubblescope.net> -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005, 2006, 2007 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,6 +28,8 @@ using namespace std::tr1; int main() { + bool test __attribute__((unused)) = true; + VERIFY(tuple_size<tuple<> >::value == 0); VERIFY(tuple_size<tuple<int> >::value == 1); VERIFY(tuple_size<tuple<void> >::value == 1); diff --git a/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/assign/char/range.cc b/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/assign/char/range.cc index e96e169463c..d5bfb417a1d 100644 --- a/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/assign/char/range.cc +++ b/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/assign/char/range.cc @@ -32,7 +32,7 @@ void test01() char s[] = "a+b|c"; test_type re; - re.assign(s, s + sizeof(s)); + re.assign(s, s + 5); } int diff --git a/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/assign/wchar_t/range.cc b/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/assign/wchar_t/range.cc index ca48cadf880..1e97c6a5ce6 100644 --- a/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/assign/wchar_t/range.cc +++ b/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/assign/wchar_t/range.cc @@ -32,7 +32,7 @@ void test01() wchar_t s[] = L"a+b|c"; test_type re; - re.assign(s, s + sizeof(s)); + re.assign(s, s + 5); } int diff --git a/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/ctors/char/range.cc b/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/ctors/char/range.cc index 53f1f4fc1c8..42c2bf39879 100644 --- a/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/ctors/char/range.cc +++ b/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/ctors/char/range.cc @@ -31,7 +31,7 @@ void test01() typedef std::tr1::basic_regex<char> test_type; char s[] = "a+b|c"; - test_type re(s, s + sizeof(s)); + test_type re(s, s + 5); } int diff --git a/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/ctors/wchar_t/range.cc b/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/ctors/wchar_t/range.cc index eb9139a9038..9ebebf2f601 100644 --- a/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/ctors/wchar_t/range.cc +++ b/libstdc++-v3/testsuite/tr1/7_regular_expressions/basic_regex/ctors/wchar_t/range.cc @@ -31,7 +31,7 @@ void test01() typedef std::tr1::basic_regex<wchar_t> test_type; wchar_t s[] = L"a+b|c"; - test_type re(s, s + sizeof(s)); + test_type re(s, s + 5); } int diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp index 209208747f4..e5af5c22cca 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp @@ -51,13 +51,13 @@ #include <common_type/assoc/template_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { template<typename Key, typename Data, - class Hash_Fn = typename pb_ds::detail::default_hash_fn<Key>::type, + class Hash_Fn = typename __gnu_pbds::detail::default_hash_fn<Key>::type, class Eq_Fn = std::equal_to<Key>, class Allocator = std::allocator<std::pair<const Key, Data> > > struct hash_common_types @@ -66,7 +66,7 @@ namespace pb_ds typedef typename Allocator::size_type size_type; typedef - pb_ds::test::hash_load_check_resize_trigger_t_< + __gnu_pbds::test::hash_load_check_resize_trigger_t_< Allocator, 1, 8, 1, 2, @@ -74,7 +74,7 @@ namespace pb_ds no_access_half_load_check_resize_trigger_policy; typedef - pb_ds::test::hash_load_check_resize_trigger_t_< + __gnu_pbds::test::hash_load_check_resize_trigger_t_< Allocator, 1, 8, 1, 2, @@ -82,7 +82,7 @@ namespace pb_ds access_half_load_check_resize_trigger_policy; typedef - pb_ds::test::hash_load_check_resize_trigger_t_< + __gnu_pbds::test::hash_load_check_resize_trigger_t_< Allocator, 1, 8, 1, 1, @@ -90,149 +90,149 @@ namespace pb_ds no_access_one_load_check_resize_trigger_policy; typedef - pb_ds::test::cc_hash_max_collision_check_resize_trigger_t_< + __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_< Allocator, 1, 2, false> no_access_half_max_col_check_check_resize_trigger_policy; typedef - pb_ds::test::cc_hash_max_collision_check_resize_trigger_t_< + __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_< Allocator, 1, 2, true> access_half_max_col_check_check_resize_trigger_policy; - typedef pb_ds::test::linear_probe_fn_t_<Key, Allocator> lin_p_t; + typedef __gnu_pbds::test::linear_probe_fn_t_<Key, Allocator> lin_p_t; - typedef pb_ds::test::quadratic_probe_fn_t_<Key, Allocator> quad_p_t; + typedef __gnu_pbds::test::quadratic_probe_fn_t_<Key, Allocator> quad_p_t; typedef typename __gnu_cxx::typelist::create4< - pb_ds::detail::false_type, - pb_ds::test::direct_mask_range_hashing_t_< + __gnu_pbds::detail::false_type, + __gnu_pbds::test::direct_mask_range_hashing_t_< Allocator>, no_access_half_load_check_resize_trigger_policy, - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator> >::type performance_cc_policy0; typedef typename __gnu_cxx::typelist::create4< - pb_ds::detail::false_type, - pb_ds::test::direct_mod_range_hashing_t_< + __gnu_pbds::detail::false_type, + __gnu_pbds::test::direct_mod_range_hashing_t_< Allocator>, no_access_half_load_check_resize_trigger_policy, - pb_ds::test::hash_prime_size_policy_t_>::type + __gnu_pbds::test::hash_prime_size_policy_t_>::type performance_cc_policy1; typedef typename __gnu_cxx::typelist::create4< - pb_ds::detail::false_type, - pb_ds::test::direct_mask_range_hashing_t_< + __gnu_pbds::detail::false_type, + __gnu_pbds::test::direct_mask_range_hashing_t_< Allocator>, no_access_one_load_check_resize_trigger_policy, - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator> >::type performance_cc_policy2; typedef typename __gnu_cxx::typelist::create4< - pb_ds::detail::false_type, - pb_ds::test::direct_mod_range_hashing_t_< + __gnu_pbds::detail::false_type, + __gnu_pbds::test::direct_mod_range_hashing_t_< Allocator>, no_access_one_load_check_resize_trigger_policy, - pb_ds::test::hash_prime_size_policy_t_ >::type + __gnu_pbds::test::hash_prime_size_policy_t_ >::type performance_cc_policy3; typedef typename __gnu_cxx::typelist::create4< - pb_ds::detail::true_type, - pb_ds::test::direct_mask_range_hashing_t_< + __gnu_pbds::detail::true_type, + __gnu_pbds::test::direct_mask_range_hashing_t_< Allocator>, no_access_half_load_check_resize_trigger_policy, - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator> >::type performance_cc_policy4; typedef typename __gnu_cxx::typelist::create4< - pb_ds::detail::false_type, - pb_ds::test::direct_mask_range_hashing_t_< + __gnu_pbds::detail::false_type, + __gnu_pbds::test::direct_mask_range_hashing_t_< Allocator>, no_access_half_max_col_check_check_resize_trigger_policy, - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator> >::type performance_cc_policy5; typedef typename __gnu_cxx::typelist::create4< - pb_ds::detail::false_type, - pb_ds::test::direct_mask_range_hashing_t_< + __gnu_pbds::detail::false_type, + __gnu_pbds::test::direct_mask_range_hashing_t_< Allocator>, access_half_max_col_check_check_resize_trigger_policy, - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator> >::type regression_cc_policy0; typedef typename __gnu_cxx::typelist::create4< - pb_ds::detail::false_type, - pb_ds::test::direct_mask_range_hashing_t_< + __gnu_pbds::detail::false_type, + __gnu_pbds::test::direct_mask_range_hashing_t_< Allocator>, access_half_load_check_resize_trigger_policy, - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator> >::type regression_cc_policy1; typedef typename __gnu_cxx::typelist::create4< - pb_ds::detail::true_type, - pb_ds::test::direct_mod_range_hashing_t_< + __gnu_pbds::detail::true_type, + __gnu_pbds::test::direct_mod_range_hashing_t_< Allocator>, no_access_half_load_check_resize_trigger_policy, - pb_ds::test::hash_prime_size_policy_t_ >::type + __gnu_pbds::test::hash_prime_size_policy_t_ >::type regression_cc_policy2; typedef typename __gnu_cxx::typelist::create5< - pb_ds::detail::false_type, + __gnu_pbds::detail::false_type, lin_p_t, - pb_ds::test::direct_mask_range_hashing_t_< + __gnu_pbds::test::direct_mask_range_hashing_t_< Allocator>, no_access_half_load_check_resize_trigger_policy, - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator> >::type performance_gp_policy0; typedef typename __gnu_cxx::typelist::create5< - pb_ds::detail::false_type, + __gnu_pbds::detail::false_type, quad_p_t, - pb_ds::test::direct_mod_range_hashing_t_< + __gnu_pbds::test::direct_mod_range_hashing_t_< Allocator>, no_access_half_load_check_resize_trigger_policy, - pb_ds::test::hash_prime_size_policy_t_ >::type + __gnu_pbds::test::hash_prime_size_policy_t_ >::type performance_gp_policy1; typedef typename __gnu_cxx::typelist::create5< - pb_ds::detail::false_type, + __gnu_pbds::detail::false_type, quad_p_t, - pb_ds::test::direct_mod_range_hashing_t_< + __gnu_pbds::test::direct_mod_range_hashing_t_< Allocator>, access_half_load_check_resize_trigger_policy, - pb_ds::test::hash_prime_size_policy_t_>::type + __gnu_pbds::test::hash_prime_size_policy_t_>::type regression_gp_policy0; typedef typename __gnu_cxx::typelist::create5< - pb_ds::detail::true_type, + __gnu_pbds::detail::true_type, lin_p_t, - pb_ds::test::direct_mask_range_hashing_t_< + __gnu_pbds::test::direct_mask_range_hashing_t_< Allocator>, access_half_load_check_resize_trigger_policy, - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator> >::type regression_gp_policy1; @@ -296,13 +296,13 @@ namespace pb_ds public: typedef - pb_ds::cc_hash_table< + __gnu_pbds::cc_hash_table< Key, Data, Hash_Fn, Eq_Fn, comb_hash_fn, - pb_ds::hash_standard_resize_policy< + __gnu_pbds::hash_standard_resize_policy< size_policy, trigger_policy, false>, @@ -342,13 +342,13 @@ namespace pb_ds public: typedef - pb_ds::cc_hash_table< + __gnu_pbds::cc_hash_table< Key, Data, Hash_Fn, Eq_Fn, comb_hash_fn, - pb_ds::hash_standard_resize_policy< + __gnu_pbds::hash_standard_resize_policy< size_policy, trigger_policy, true>, @@ -393,14 +393,14 @@ namespace pb_ds public: typedef - pb_ds::gp_hash_table< + __gnu_pbds::gp_hash_table< Key, Data, Hash_Fn, Eq_Fn, comb_probe_fn, probe_fn, - pb_ds::hash_standard_resize_policy< + __gnu_pbds::hash_standard_resize_policy< size_policy, trigger_policy, false>, @@ -445,14 +445,14 @@ namespace pb_ds public: typedef - pb_ds::gp_hash_table< + __gnu_pbds::gp_hash_table< Key, Data, Hash_Fn, Eq_Fn, comb_probe_fn, probe_fn, - pb_ds::hash_standard_resize_policy< + __gnu_pbds::hash_standard_resize_policy< size_policy, trigger_policy, true>, @@ -533,7 +533,7 @@ namespace pb_ds typedef typename Allocator::size_type size_type; typedef - pb_ds::test::hash_load_check_resize_trigger_t_< + __gnu_pbds::test::hash_load_check_resize_trigger_t_< Allocator, 1, 8, 1, 2, @@ -541,7 +541,7 @@ namespace pb_ds no_access_half_load_check_resize_trigger_policy; typedef - pb_ds::test::hash_load_check_resize_trigger_t_< + __gnu_pbds::test::hash_load_check_resize_trigger_t_< Allocator, 1, 8, 1, 1, @@ -549,28 +549,28 @@ namespace pb_ds no_access_one_load_check_resize_trigger_policy; typedef - pb_ds::hash_standard_resize_policy< - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::hash_standard_resize_policy< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator>, no_access_half_load_check_resize_trigger_policy> mask_half_resize_policy_t; typedef - pb_ds::hash_standard_resize_policy< - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::hash_standard_resize_policy< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator>, no_access_one_load_check_resize_trigger_policy> mask_one_resize_policy_t; typedef - pb_ds::hash_standard_resize_policy< - pb_ds::test::hash_prime_size_policy_t_, + __gnu_pbds::hash_standard_resize_policy< + __gnu_pbds::test::hash_prime_size_policy_t_, no_access_half_load_check_resize_trigger_policy> mod_half_resize_policy_t; typedef - pb_ds::hash_standard_resize_policy< - pb_ds::test::hash_prime_size_policy_t_, + __gnu_pbds::hash_standard_resize_policy< + __gnu_pbds::test::hash_prime_size_policy_t_, no_access_one_load_check_resize_trigger_policy> mod_one_resize_policy_t; @@ -579,7 +579,7 @@ namespace pb_ds template<typename Allocator_> struct half_resize_policy_selector< - pb_ds::test::direct_mask_range_hashing_t_< + __gnu_pbds::test::direct_mask_range_hashing_t_< Allocator_> > { typedef mask_half_resize_policy_t type; @@ -587,7 +587,7 @@ namespace pb_ds template<typename Allocator_> struct half_resize_policy_selector< - pb_ds::test::direct_mod_range_hashing_t_< + __gnu_pbds::test::direct_mod_range_hashing_t_< Allocator_> > { typedef mod_half_resize_policy_t type; @@ -598,7 +598,7 @@ namespace pb_ds template<typename Allocator_> struct one_resize_policy_selector< - pb_ds::test::direct_mask_range_hashing_t_< + __gnu_pbds::test::direct_mask_range_hashing_t_< Allocator_> > { typedef mask_one_resize_policy_t type; @@ -606,7 +606,7 @@ namespace pb_ds template<typename Allocator_> struct one_resize_policy_selector< - pb_ds::test::direct_mod_range_hashing_t_< + __gnu_pbds::test::direct_mod_range_hashing_t_< Allocator_> > { typedef mod_one_resize_policy_t type; @@ -616,10 +616,10 @@ namespace pb_ds struct generic_cc_hash_table_t { typedef - pb_ds::cc_hash_table< + __gnu_pbds::cc_hash_table< Key, Data, - pb_ds::null_hash_fn, + __gnu_pbds::null_hash_fn, Eq_Fn, Comb_Hash_Fn, typename one_resize_policy_selector< @@ -639,13 +639,13 @@ namespace pb_ds struct no_access_generic_gp_hash_table_t { typedef - pb_ds::gp_hash_table< + __gnu_pbds::gp_hash_table< Key, Data, - pb_ds::null_hash_fn, + __gnu_pbds::null_hash_fn, Eq_Fn, Comb_Probe_Fn, - pb_ds::null_probe_fn, + __gnu_pbds::null_probe_fn, typename half_resize_policy_selector< typename Comb_Probe_Fn::comb_fn>::type, false, @@ -675,9 +675,9 @@ namespace pb_ds private: typedef typename Allocator::size_type size_type; - typedef pb_ds::test::move_to_front_lu_policy_t_ mtf_u; + typedef __gnu_pbds::test::move_to_front_lu_policy_t_ mtf_u; - typedef pb_ds::test::counter_lu_policy_t_<Allocator, 5> cnt_5_u; + typedef __gnu_pbds::test::counter_lu_policy_t_<Allocator, 5> cnt_5_u; typedef typename __gnu_cxx::typelist::create1<mtf_u>::type lu_policy0; @@ -700,7 +700,7 @@ namespace pb_ds public: typedef - pb_ds::list_update< + __gnu_pbds::list_update< Key, Data, Eq_Fn, @@ -733,37 +733,37 @@ namespace pb_ds class Node_Iterator, class Cmp_Fn_, class Allocator_> - class Node_Update = pb_ds::null_tree_node_update, + class Node_Update = __gnu_pbds::null_tree_node_update, class Allocator = std::allocator<std::pair<const Key, Data> > > struct tree_common_types { private: typedef - pb_ds::tree< + __gnu_pbds::tree< Key, Data, Cmp_Fn, - pb_ds::ov_tree_tag, + __gnu_pbds::ov_tree_tag, Node_Update, Allocator> ov_tree_assoc_container_t; typedef - pb_ds::tree< + __gnu_pbds::tree< Key, Data, Cmp_Fn, - pb_ds::rb_tree_tag, + __gnu_pbds::rb_tree_tag, Node_Update, Allocator> rb_tree_assoc_container_t; typedef - pb_ds::tree< + __gnu_pbds::tree< Key, Data, Cmp_Fn, - pb_ds::splay_tree_tag, + __gnu_pbds::splay_tree_tag, Node_Update, Allocator> splay_tree_assoc_container_t; @@ -792,18 +792,18 @@ namespace pb_ds template<typename Key, typename Data, class E_Access_Traits = - typename pb_ds::detail::default_trie_e_access_traits<Key>::type, - class Tag = pb_ds::pat_trie_tag, + typename __gnu_pbds::detail::default_trie_e_access_traits<Key>::type, + class Tag = __gnu_pbds::pat_trie_tag, template<typename Const_Node_Iterator, typename Node_Iterator, class E_Access_Traits_, typename Allocator_> - class Node_Update = pb_ds::null_trie_node_update, + class Node_Update = __gnu_pbds::null_trie_node_update, class Allocator = std::allocator<char> > class trie_common_types { private: - typedef pb_ds::trie<Key, Data, E_Access_Traits, Tag, Node_Update, Allocator> type; + typedef __gnu_pbds::trie<Key, Data, E_Access_Traits, Tag, Node_Update, Allocator> type; public: typedef typename __gnu_cxx::typelist::create1<type>::type performance_tl; @@ -813,6 +813,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_COMMON_TYPES_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/comb_hash_fn_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/comb_hash_fn_string_form.hpp index 024caab4b2b..41d908e58f5 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/comb_hash_fn_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/comb_hash_fn_string_form.hpp @@ -51,7 +51,7 @@ #include <common_type/assoc/template_policy.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -116,7 +116,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_COMB_HASH_FN_STRING_FORM_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/ds_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/ds_string_form.hpp index 84edbd90273..28625aff6aa 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/ds_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/ds_string_form.hpp @@ -59,7 +59,7 @@ #include <common_type/assoc/detail/store_hash_string_form.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -74,7 +74,7 @@ namespace pb_ds template<typename Cntnr> struct ds_string_form< Cntnr, - pb_ds::cc_hash_tag> + __gnu_pbds::cc_hash_tag> { static std::string name() @@ -104,7 +104,7 @@ namespace pb_ds template<typename Cntnr> struct ds_string_form< Cntnr, - pb_ds::gp_hash_tag> + __gnu_pbds::gp_hash_tag> { static std::string name() @@ -166,7 +166,7 @@ namespace pb_ds template<typename Cntnr> struct ds_string_form< Cntnr, - pb_ds::rb_tree_tag> : private tree_ds_string_form< + __gnu_pbds::rb_tree_tag> : private tree_ds_string_form< Cntnr> { private: @@ -189,7 +189,7 @@ namespace pb_ds template<typename Cntnr> struct ds_string_form< Cntnr, - pb_ds::splay_tree_tag> : private tree_ds_string_form< + __gnu_pbds::splay_tree_tag> : private tree_ds_string_form< Cntnr> { private: @@ -212,7 +212,7 @@ namespace pb_ds template<typename Cntnr> struct ds_string_form< Cntnr, - pb_ds::ov_tree_tag> : private tree_ds_string_form< + __gnu_pbds::ov_tree_tag> : private tree_ds_string_form< Cntnr> { private: @@ -235,7 +235,7 @@ namespace pb_ds template<typename Cntnr> struct ds_string_form< Cntnr, - pb_ds::list_update_tag> + __gnu_pbds::list_update_tag> { static std::string name() @@ -258,7 +258,7 @@ namespace pb_ds template<typename Cntnr> struct ds_string_form< Cntnr, - pb_ds::pat_trie_tag> + __gnu_pbds::pat_trie_tag> { static std::string name() @@ -298,7 +298,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_DS_STRING_FORM_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/list_update_policy_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/list_update_policy_string_form.hpp index d8f9e977aec..08b65056065 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/list_update_policy_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/list_update_policy_string_form.hpp @@ -51,7 +51,7 @@ #include <common_type/assoc/template_policy.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -107,7 +107,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_LU_POLICY_STRING_FORM_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/probe_fn_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/probe_fn_string_form.hpp index 364e7efcc73..84c5d040051 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/probe_fn_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/probe_fn_string_form.hpp @@ -51,7 +51,7 @@ #include <common_type/assoc/template_policy.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -103,7 +103,7 @@ namespace pb_ds template<> struct probe_fn_string_form< - pb_ds::null_probe_fn> + __gnu_pbds::null_probe_fn> { static std::string name() @@ -122,7 +122,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_PROBE_FN_STRING_FORM_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/resize_policy_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/resize_policy_string_form.hpp index 96da7a3c721..8507163ff77 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/resize_policy_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/resize_policy_string_form.hpp @@ -53,7 +53,7 @@ #include <common_type/assoc/template_policy.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -70,7 +70,7 @@ namespace pb_ds bool External_Size_Access, typename Size_Type> struct resize_policy_string_form< - pb_ds::hash_standard_resize_policy< + __gnu_pbds::hash_standard_resize_policy< Size_Policy, Trigger_Policy, External_Size_Access, @@ -100,7 +100,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_RESIZE_POLICY_STRING_FORM_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/size_policy_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/size_policy_string_form.hpp index 1ae61c4c14a..876505be3ee 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/size_policy_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/size_policy_string_form.hpp @@ -53,7 +53,7 @@ #include <common_type/assoc/template_policy.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -67,7 +67,7 @@ namespace pb_ds template<typename Allocator> struct size_policy_string_form< - pb_ds::test::hash_exponential_size_policy_t_< + __gnu_pbds::test::hash_exponential_size_policy_t_< Allocator> > { static std::string @@ -85,7 +85,7 @@ namespace pb_ds template<> struct size_policy_string_form< - pb_ds::test::hash_prime_size_policy_t_> + __gnu_pbds::test::hash_prime_size_policy_t_> { static std::string name() @@ -104,7 +104,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_SIZE_POLICY_STRING_FORM_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/store_hash_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/store_hash_string_form.hpp index 4dabbd6ca8f..89ef675ced5 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/store_hash_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/store_hash_string_form.hpp @@ -51,7 +51,7 @@ #include <common_type/assoc/template_policy.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -97,7 +97,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_STORE_HASH_STRING_FORM_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/tree_supports_order_statistics.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/tree_supports_order_statistics.hpp index 14bdc7bab32..f4b23110491 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/tree_supports_order_statistics.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/tree_supports_order_statistics.hpp @@ -49,7 +49,7 @@ #include <ext/pb_ds/tree_policy.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -63,9 +63,9 @@ namespace pb_ds { enum { - value = pb_ds::detail::is_same< + value = __gnu_pbds::detail::is_same< typename Tree_Cntnr::node_update, - pb_ds::tree_order_statistics_node_update< + __gnu_pbds::tree_order_statistics_node_update< typename Tree_Cntnr::const_node_iterator, typename Tree_Cntnr::node_iterator, typename Tree_Cntnr::cmp_fn, @@ -77,7 +77,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_TREE_SUPPORTS_ORDER_STATISTICS_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_order_statistics.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_order_statistics.hpp index 43f2c711107..c23708f23cc 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_order_statistics.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_order_statistics.hpp @@ -49,7 +49,7 @@ #include <ext/pb_ds/trie_policy.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -63,9 +63,9 @@ namespace pb_ds { enum { - value = pb_ds::detail::is_same< + value = __gnu_pbds::detail::is_same< typename Tree_Cntnr::node_update, - pb_ds::trie_order_statistics_node_update< + __gnu_pbds::trie_order_statistics_node_update< typename Tree_Cntnr::const_node_iterator, typename Tree_Cntnr::node_iterator, typename Tree_Cntnr::e_access_traits, @@ -77,7 +77,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_TRIE_SUPPORTS_ORDER_STATISTICS_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_prefix_search.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_prefix_search.hpp index 7fb3479715f..0adf029507e 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_prefix_search.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trie_supports_prefix_search.hpp @@ -49,7 +49,7 @@ #include <ext/pb_ds/trie_policy.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -63,9 +63,9 @@ namespace pb_ds { enum { - value = pb_ds::detail::is_same< + value = __gnu_pbds::detail::is_same< typename Tree_Cntnr::node_update, - pb_ds::trie_prefix_search_node_update< + __gnu_pbds::trie_prefix_search_node_update< typename Tree_Cntnr::const_node_iterator, typename Tree_Cntnr::node_iterator, typename Tree_Cntnr::e_access_traits, @@ -77,7 +77,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_TRIE_SUPPORTS_PREFIX_SEARCH_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trigger_policy_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trigger_policy_string_form.hpp index 0d7081f4966..8169d938155 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/detail/trigger_policy_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/detail/trigger_policy_string_form.hpp @@ -51,7 +51,7 @@ #include <common_type/assoc/template_policy.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -70,7 +70,7 @@ namespace pb_ds typename Allocator::size_type Max_Load_Denom, bool External_Access> struct trigger_policy_string_form< - pb_ds::test::hash_load_check_resize_trigger_t_< + __gnu_pbds::test::hash_load_check_resize_trigger_t_< Allocator, Min_Load_Nom, Min_Load_Denom, @@ -111,7 +111,7 @@ namespace pb_ds typename Allocator::size_type Load_Denom, bool External_Access> struct trigger_policy_string_form< - pb_ds::test::cc_hash_max_collision_check_resize_trigger_t_< + __gnu_pbds::test::cc_hash_max_collision_check_resize_trigger_t_< Allocator, Load_Nom, Load_Denom, @@ -147,7 +147,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_TRIGGER_POLICY_STRING_FORM_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/native_set.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/native_set.hpp index b34364b132d..4667c9d4e2d 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/native_set.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/native_set.hpp @@ -52,7 +52,7 @@ #include <io/xml.hpp> #include <string> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -88,7 +88,7 @@ namespace pb_ds { return (make_xml_tag("type", "value", "std_set")); } }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/string_form.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/string_form.hpp index f29f29d24e0..73015b8967d 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/string_form.hpp @@ -61,7 +61,7 @@ #include <regression/basic_type.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -119,11 +119,11 @@ namespace pb_ds { return (""); } static std::string - name(pb_ds::null_mapped_type) + name(__gnu_pbds::null_mapped_type) { return ("set"); } static std::string - desc(pb_ds::null_mapped_type) + desc(__gnu_pbds::null_mapped_type) { return (""); } public: @@ -183,7 +183,7 @@ namespace pb_ds typename Cntnr::container_category> { }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/template_policy.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/template_policy.hpp index 10f03dadd06..12cf9fbcac6 100644 --- a/libstdc++-v3/testsuite/util/common_type/assoc/template_policy.hpp +++ b/libstdc++-v3/testsuite/util/common_type/assoc/template_policy.hpp @@ -52,24 +52,24 @@ #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/list_update_policy.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { template<typename Allocator> struct direct_mask_range_hashing_t_ - : public pb_ds::direct_mask_range_hashing<typename Allocator::size_type> + : public __gnu_pbds::direct_mask_range_hashing<typename Allocator::size_type> { typedef typename Allocator::size_type size_type; - typedef pb_ds::direct_mask_range_hashing<size_type> base_type; + typedef __gnu_pbds::direct_mask_range_hashing<size_type> base_type; }; template<typename Allocator> struct direct_mod_range_hashing_t_ - : public pb_ds::direct_mod_range_hashing<typename Allocator::size_type> + : public __gnu_pbds::direct_mod_range_hashing<typename Allocator::size_type> { typedef typename Allocator::size_type size_type; - typedef pb_ds::direct_mod_range_hashing<size_type> base_type; + typedef __gnu_pbds::direct_mod_range_hashing<size_type> base_type; }; template<typename Allocator, @@ -79,11 +79,11 @@ namespace pb_ds typename Allocator::size_type Max_Load_Denom, bool External_Access> struct hash_load_check_resize_trigger_t_ - : public pb_ds::hash_load_check_resize_trigger<External_Access, + : public __gnu_pbds::hash_load_check_resize_trigger<External_Access, typename Allocator::size_type> { typedef typename Allocator::size_type size_type; - typedef pb_ds::hash_load_check_resize_trigger<External_Access, size_type> base_type; + typedef __gnu_pbds::hash_load_check_resize_trigger<External_Access, size_type> base_type; inline hash_load_check_resize_trigger_t_() @@ -102,11 +102,11 @@ namespace pb_ds typename Allocator::size_type Load_Denom, bool External_Access> struct cc_hash_max_collision_check_resize_trigger_t_ - : public pb_ds::cc_hash_max_collision_check_resize_trigger<External_Access, + : public __gnu_pbds::cc_hash_max_collision_check_resize_trigger<External_Access, typename Allocator::size_type> { typedef typename Allocator::size_type size_type; - typedef pb_ds::cc_hash_max_collision_check_resize_trigger<External_Access, size_type> base_type; + typedef __gnu_pbds::cc_hash_max_collision_check_resize_trigger<External_Access, size_type> base_type; inline cc_hash_max_collision_check_resize_trigger_t_() @@ -120,36 +120,36 @@ namespace pb_ds }; }; - struct hash_prime_size_policy_t_ : public pb_ds::hash_prime_size_policy + struct hash_prime_size_policy_t_ : public __gnu_pbds::hash_prime_size_policy { }; template<typename Allocator> struct hash_exponential_size_policy_t_ - : public pb_ds::hash_exponential_size_policy<typename Allocator::size_type> + : public __gnu_pbds::hash_exponential_size_policy<typename Allocator::size_type> { }; template<typename Key, class Allocator> struct linear_probe_fn_t_ - : public pb_ds::linear_probe_fn<typename Allocator::size_type> + : public __gnu_pbds::linear_probe_fn<typename Allocator::size_type> { }; template<typename Key, class Allocator> struct quadratic_probe_fn_t_ - : public pb_ds::quadratic_probe_fn<typename Allocator::size_type> + : public __gnu_pbds::quadratic_probe_fn<typename Allocator::size_type> { }; template<typename Allocator, typename Allocator::size_type Max_Count> struct counter_lu_policy_t_ - : public pb_ds::counter_lu_policy<Max_Count, Allocator> + : public __gnu_pbds::counter_lu_policy<Max_Count, Allocator> { - typedef pb_ds::counter_lu_policy<Max_Count, Allocator> base_type; + typedef __gnu_pbds::counter_lu_policy<Max_Count, Allocator> base_type; }; struct move_to_front_lu_policy_t_ - : public pb_ds::move_to_front_lu_policy<> + : public __gnu_pbds::move_to_front_lu_policy<> { }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/common_type/priority_queue/common_type.hpp b/libstdc++-v3/testsuite/util/common_type/priority_queue/common_type.hpp index a9975578463..80176db44dd 100644 --- a/libstdc++-v3/testsuite/util/common_type/priority_queue/common_type.hpp +++ b/libstdc++-v3/testsuite/util/common_type/priority_queue/common_type.hpp @@ -51,7 +51,7 @@ #include <ext/pb_ds/priority_queue.hpp> #include <ext/typelist.h> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -62,15 +62,15 @@ namespace pb_ds private: // typedef typename Allocator::size_type size_type; - typedef pb_ds::priority_queue<Value_Type, Cmp_Fn, pb_ds::pairing_heap_tag, Allocator> pairing_heap_t; + typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::pairing_heap_tag, Allocator> pairing_heap_t; - typedef pb_ds::priority_queue<Value_Type, Cmp_Fn, pb_ds::binomial_heap_tag, Allocator> binomial_heap_t; + typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::binomial_heap_tag, Allocator> binomial_heap_t; - typedef pb_ds::priority_queue<Value_Type, Cmp_Fn, pb_ds::rc_binomial_heap_tag, Allocator> rc_binomial_heap_t; + typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::rc_binomial_heap_tag, Allocator> rc_binomial_heap_t; - typedef pb_ds::priority_queue<Value_Type, Cmp_Fn, pb_ds::binary_heap_tag, Allocator> binary_heap_t; + typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::binary_heap_tag, Allocator> binary_heap_t; - typedef pb_ds::priority_queue<Value_Type, Cmp_Fn, pb_ds::thin_heap_tag, Allocator> thin_heap_t; + typedef __gnu_pbds::priority_queue<Value_Type, Cmp_Fn, __gnu_pbds::thin_heap_tag, Allocator> thin_heap_t; typedef typename __gnu_cxx::typelist::create5<thin_heap_t, pairing_heap_t, binomial_heap_t, rc_binomial_heap_t, binary_heap_t>::type all_tl; @@ -82,6 +82,6 @@ namespace pb_ds }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_COMMON_TYPES_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/priority_queue/detail/ds_string_form.hpp b/libstdc++-v3/testsuite/util/common_type/priority_queue/detail/ds_string_form.hpp index 4c33e6c1fdb..bf3b6885024 100644 --- a/libstdc++-v3/testsuite/util/common_type/priority_queue/detail/ds_string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/priority_queue/detail/ds_string_form.hpp @@ -51,7 +51,7 @@ #include <ext/pb_ds/tag_and_trait.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -61,7 +61,7 @@ namespace pb_ds struct ds_string_form; template<typename Cntnr> - struct ds_string_form<Cntnr, pb_ds::pairing_heap_tag> + struct ds_string_form<Cntnr, __gnu_pbds::pairing_heap_tag> { static std::string name() @@ -73,7 +73,7 @@ namespace pb_ds }; template<typename Cntnr> - struct ds_string_form<Cntnr, pb_ds::thin_heap_tag> + struct ds_string_form<Cntnr, __gnu_pbds::thin_heap_tag> { static std::string name() @@ -85,7 +85,7 @@ namespace pb_ds }; template<typename Cntnr> - struct ds_string_form<Cntnr, pb_ds::binomial_heap_tag> + struct ds_string_form<Cntnr, __gnu_pbds::binomial_heap_tag> { static std::string name() @@ -97,7 +97,7 @@ namespace pb_ds }; template<typename Cntnr> - struct ds_string_form<Cntnr, pb_ds::rc_binomial_heap_tag> + struct ds_string_form<Cntnr, __gnu_pbds::rc_binomial_heap_tag> { static std::string name() @@ -109,7 +109,7 @@ namespace pb_ds }; template<typename Cntnr> - struct ds_string_form<Cntnr, pb_ds::binary_heap_tag> + struct ds_string_form<Cntnr, __gnu_pbds::binary_heap_tag> { static std::string name() @@ -122,7 +122,7 @@ namespace pb_ds } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_DS_STRING_FORM_HPP diff --git a/libstdc++-v3/testsuite/util/common_type/priority_queue/string_form.hpp b/libstdc++-v3/testsuite/util/common_type/priority_queue/string_form.hpp index 6d85b86a11d..0e5b0ce87c9 100644 --- a/libstdc++-v3/testsuite/util/common_type/priority_queue/string_form.hpp +++ b/libstdc++-v3/testsuite/util/common_type/priority_queue/string_form.hpp @@ -54,7 +54,7 @@ #include <common_type/priority_queue/detail/ds_string_form.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -103,7 +103,7 @@ namespace pb_ds : public detail::tag_select_string_form<Cntnr, typename Cntnr::container_category> { }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_STRING_FORM_HPP diff --git a/libstdc++-v3/testsuite/util/hash_fn/dna_str_limit.hpp b/libstdc++-v3/testsuite/util/hash_fn/dna_str_limit.hpp index 144cf03b2b9..0f97906764f 100644 --- a/libstdc++-v3/testsuite/util/hash_fn/dna_str_limit.hpp +++ b/libstdc++-v3/testsuite/util/hash_fn/dna_str_limit.hpp @@ -50,7 +50,7 @@ #include <string> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -67,6 +67,6 @@ namespace pb_ds return ret; } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_DNA_STR_LIMIT_HPP diff --git a/libstdc++-v3/testsuite/util/hash_fn/limit_string_hash_fn.hpp b/libstdc++-v3/testsuite/util/hash_fn/limit_string_hash_fn.hpp index 78cc6f22735..59c09672256 100644 --- a/libstdc++-v3/testsuite/util/hash_fn/limit_string_hash_fn.hpp +++ b/libstdc++-v3/testsuite/util/hash_fn/limit_string_hash_fn.hpp @@ -49,7 +49,7 @@ #include <string> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -77,6 +77,6 @@ namespace pb_ds size_t limit_string_hash_fn::_S_max; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/hash_fn/string_hash_fn.hpp b/libstdc++-v3/testsuite/util/hash_fn/string_hash_fn.hpp index b1990b4b390..00da3a95bce 100644 --- a/libstdc++-v3/testsuite/util/hash_fn/string_hash_fn.hpp +++ b/libstdc++-v3/testsuite/util/hash_fn/string_hash_fn.hpp @@ -49,7 +49,7 @@ #include <string> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -73,6 +73,6 @@ namespace pb_ds } }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/hash_fn/string_ranged_hash_fn.hpp b/libstdc++-v3/testsuite/util/hash_fn/string_ranged_hash_fn.hpp index e9a5465e485..ebfe6e2c605 100644 --- a/libstdc++-v3/testsuite/util/hash_fn/string_ranged_hash_fn.hpp +++ b/libstdc++-v3/testsuite/util/hash_fn/string_ranged_hash_fn.hpp @@ -50,7 +50,7 @@ #include <string> #include <hash_fn/dna_str_limit.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -104,6 +104,6 @@ namespace pb_ds { return ("string ranged-hash using" + string_form<comb_fn>::desc()); } }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/hash_fn/string_ranged_probe_fn.hpp b/libstdc++-v3/testsuite/util/hash_fn/string_ranged_probe_fn.hpp index 63bb0533c55..b677fed58b7 100644 --- a/libstdc++-v3/testsuite/util/hash_fn/string_ranged_probe_fn.hpp +++ b/libstdc++-v3/testsuite/util/hash_fn/string_ranged_probe_fn.hpp @@ -49,7 +49,7 @@ #include <string> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -108,6 +108,6 @@ namespace pb_ds { return ("string ranged-probe using" + string_form<comb_fn>::desc());} }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/io/illegal_input_error.hpp b/libstdc++-v3/testsuite/util/io/illegal_input_error.hpp index 63675f9850c..033a90b3b1c 100644 --- a/libstdc++-v3/testsuite/util/io/illegal_input_error.hpp +++ b/libstdc++-v3/testsuite/util/io/illegal_input_error.hpp @@ -49,7 +49,7 @@ #include <exception> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -67,6 +67,6 @@ namespace pb_ds #endif } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_ILLEGAL_INPUT_EX_HPP diff --git a/libstdc++-v3/testsuite/util/io/prog_bar.cc b/libstdc++-v3/testsuite/util/io/prog_bar.cc index 365c5186532..b306762a9bd 100644 --- a/libstdc++-v3/testsuite/util/io/prog_bar.cc +++ b/libstdc++-v3/testsuite/util/io/prog_bar.cc @@ -46,7 +46,7 @@ #include <util/io/prog_bar.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -89,4 +89,4 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds diff --git a/libstdc++-v3/testsuite/util/io/prog_bar.hpp b/libstdc++-v3/testsuite/util/io/prog_bar.hpp index 0bbbda27854..b58f770933f 100644 --- a/libstdc++-v3/testsuite/util/io/prog_bar.hpp +++ b/libstdc++-v3/testsuite/util/io/prog_bar.hpp @@ -51,7 +51,7 @@ #include <iostream> #include <string> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -91,6 +91,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_PROG_BAR_HPP diff --git a/libstdc++-v3/testsuite/util/io/text_populate.hpp b/libstdc++-v3/testsuite/util/io/text_populate.hpp index a91097c5c93..c8bd15ebd24 100644 --- a/libstdc++-v3/testsuite/util/io/text_populate.hpp +++ b/libstdc++-v3/testsuite/util/io/text_populate.hpp @@ -54,7 +54,7 @@ #include <string> #include <iostream> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -75,7 +75,7 @@ namespace pb_ds std::cerr << "Cannot open file " << r_f_name.c_str() << std::endl; - throw pb_ds::test::illegal_input_error(); + throw __gnu_pbds::test::illegal_input_error(); } size_t i = 0; @@ -93,7 +93,7 @@ namespace pb_ds std::cerr << "Read only " << static_cast<unsigned long>(i) << " words" << std::endl; - throw pb_ds::test::illegal_input_error(); + throw __gnu_pbds::test::illegal_input_error(); } } catch(...) @@ -119,7 +119,7 @@ namespace pb_ds std::cerr << "Cannot open file " << r_f_name.c_str() << std::endl; - throw pb_ds::test::illegal_input_error(); + throw __gnu_pbds::test::illegal_input_error(); } typedef std::set< typename Vec::value_type::first_type> set_t; @@ -145,7 +145,7 @@ namespace pb_ds std::cerr << "Read only " << static_cast<unsigned long>(s.size()) << " words" << std::endl; - throw pb_ds::test::illegal_input_error(); + throw __gnu_pbds::test::illegal_input_error(); } } catch(...) @@ -158,6 +158,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_TEXT_POPULATE_HPP diff --git a/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc b/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc index c24cd6fc10e..824f0d733f3 100644 --- a/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc +++ b/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.cc @@ -50,7 +50,7 @@ #include <stdlib.h> #include <bits/functexcept.h> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -113,4 +113,4 @@ namespace pb_ds return false; } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds diff --git a/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.hpp b/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.hpp index 725c75e6291..4e0b99216ce 100644 --- a/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.hpp +++ b/libstdc++-v3/testsuite/util/io/verified_cmd_line_input.hpp @@ -50,7 +50,7 @@ #include <io/illegal_input_error.hpp> #include <string> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -72,6 +72,6 @@ namespace pb_ds bool get_cmd_line_bool(int argc, char* a_p_argv[], int argn); } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_VERIFIED_CMD_LINE_INPUT_HPP diff --git a/libstdc++-v3/testsuite/util/io/xml.hpp b/libstdc++-v3/testsuite/util/io/xml.hpp index 506c1a10a0d..eb544da4442 100644 --- a/libstdc++-v3/testsuite/util/io/xml.hpp +++ b/libstdc++-v3/testsuite/util/io/xml.hpp @@ -50,7 +50,7 @@ #include <string> #include <sstream> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -126,6 +126,6 @@ namespace pb_ds return sstrm.str(); } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_XML_HPP diff --git a/libstdc++-v3/testsuite/util/io/xml_test_formatter.hpp b/libstdc++-v3/testsuite/util/io/xml_test_formatter.hpp index ceedf817378..9eab6888ffb 100644 --- a/libstdc++-v3/testsuite/util/io/xml_test_formatter.hpp +++ b/libstdc++-v3/testsuite/util/io/xml_test_formatter.hpp @@ -51,7 +51,7 @@ #include <iostream> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -83,6 +83,6 @@ namespace pb_ds { std::cout << "</cntnr>" << std::endl; } }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_XML_TEST_FORMATTER_HPP diff --git a/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_map.hpp b/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_map.hpp index be0e8f4227c..5db36110601 100644 --- a/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_map.hpp +++ b/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_map.hpp @@ -41,7 +41,7 @@ /** * @file native_hash_map.hpp - * Contains an adapter to Dinkumware/SGI hash tables + * Contains an adapter to TR1 unordered containers. */ #ifndef PB_DS_NATIVE_HASH_MAP_HPP @@ -52,40 +52,23 @@ #include <ext/pb_ds/detail/standard_policies.hpp> #include <native_type/assoc/native_hash_tag.hpp> #include <io/xml.hpp> - -// Default to using tr1. -#define PB_DS_USE_TR1 1 - -#ifdef PB_DS_USE_TR1 #include <tr1/unordered_map> -#else -#include <ext/hash_map> -#endif -namespace pb_ds +namespace __gnu_pbds { namespace test { -#ifdef PB_DS_USE_TR1 #define PB_DS_BASE_C_DEC \ std::tr1::__unordered_map<Key, Data, Hash_Fn, Eq_Fn, \ typename Allocator::template rebind<std::pair<const Key, Data> >::other, Cache_Hash> -#else -#define PB_DS_BASE_C_DEC \ - __gnu_cxx::hash_map<Key, Data, Hash_Fn, Eq_Fn, \ - typename Allocator::template rebind<std::pair<const Key, Data> >::other> -#endif template<typename Key, typename Data, size_t Init_Size = 8, - typename Hash_Fn = typename pb_ds::detail::default_hash_fn<Key>::type, + typename Hash_Fn = typename __gnu_pbds::detail::default_hash_fn<Key>::type, typename Eq_Fn = std::equal_to<Key>, typename Less_Fn = std::less<Key>, - typename Allocator = std::allocator<char> -#ifdef PB_DS_USE_TR1 - , bool Cache_Hash = false -#endif + typename Allocator = std::allocator<char>, bool Cache_Hash = false > class native_hash_map : public PB_DS_BASE_C_DEC { @@ -104,18 +87,13 @@ namespace pb_ds static std::string name() { -#ifdef PB_DS_USE_TR1 return std::string("n_hash_map_") + (Cache_Hash ? std::string("cah") : std::string("ncah")); -#else - return std::string("n_hash_map_ncah"); -#endif } static std::string desc() { -#ifdef PB_DS_USE_TR1 const std::string cache_hash_desc = make_xml_tag("cache_hash_code", "value", @@ -123,16 +101,13 @@ namespace pb_ds return make_xml_tag("type", "value", "std_tr1_unordered_map", cache_hash_desc); -#else - return make_xml_tag("type", "value", "__gnucxx_hash_map"); -#endif } }; #undef PB_DS_BASE_C_DEC } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_multimap.hpp b/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_multimap.hpp index a525ef20759..a3f82ba8a75 100644 --- a/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_multimap.hpp +++ b/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_multimap.hpp @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007 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 @@ -41,50 +41,47 @@ /** * @file native_hash_multimap.hpp - * Contains an adapter to Dinkumware/SGI hash tables + * Contains an adapter to TR1 unordered containers. */ #ifndef PB_DS_NATIVE_HASH_MULTIMAP_HPP #define PB_DS_NATIVE_HASH_MULTIMAP_HPP #include <string> -#include <ext/hash_map> +#include <tr1/unordered_map> #include <ext/pb_ds/detail/type_utils.hpp> #include <ext/pb_ds/detail/standard_policies.hpp> #include <native_type/assoc/native_hash_tag.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { #define PB_DS_BASE_C_DEC \ - __gnu_cxx::hash_multimap<Key, Data, Hash_Fn, Eq_Fn, Allocator> + std::tr1::unordered_multimap<Key, Data, Hash_Fn, Eq_Fn, Allocator> template<typename Key, typename Data, size_t Init_Size = 8, - class Hash_Fn = typename pb_ds::detail::default_hash_fn<Key>::type, + class Hash_Fn = typename __gnu_pbds::detail::default_hash_fn<Key>::type, class Eq_Fn = std::equal_to<Key>, class Less_Fn = std::less<Key>, class Allocator = std::allocator<char> > class native_hash_multimap : public PB_DS_BASE_C_DEC { private: - typedef PB_DS_BASE_C_DEC base_type; + typedef PB_DS_BASE_C_DEC base_type; + typedef std::pair<Key, Data> pair_type; public: - typedef native_hash_tag container_category; - - typedef Allocator allocator; - - typedef typename base_type::iterator iterator; - + typedef native_hash_tag container_category; + typedef Allocator allocator; + typedef typename base_type::iterator iterator; typedef typename base_type::const_iterator const_iterator; typedef - typename Allocator::template rebind< - std::pair<Key, Data> >::other::const_reference + typename allocator::template rebind<pair_type>::other::const_reference const_reference; native_hash_multimap() : base_type(Init_Size) @@ -95,7 +92,7 @@ namespace pb_ds { } inline void - insert(typename base_type::const_reference r_val) + insert(const_reference r_val) { typedef std::pair<iterator, iterator> eq_range_t; eq_range_t f = base_type::equal_range(r_val.first); @@ -148,14 +145,12 @@ namespace pb_ds static std::string desc() - { - return make_xml_tag("type", "value", "__gnucxx_hash_multimap"); - } + { return make_xml_tag("type", "value", "__gnucxx_hash_multimap"); } }; #undef PB_DS_BASE_C_DEC } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_set.hpp b/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_set.hpp index c78553b73fe..86ad2482132 100644 --- a/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_set.hpp +++ b/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_set.hpp @@ -41,7 +41,7 @@ /** * @file native_hash_set.hpp - * Contains an adapter to Dinkumware/SGI hash tables + * Contains an adapter to TR1 unordered containers. */ #ifndef PB_DS_NATIVE_HASH_SET_HPP @@ -52,39 +52,22 @@ #include <ext/pb_ds/detail/standard_policies.hpp> #include <native_type/assoc/native_hash_tag.hpp> #include <io/xml.hpp> - -// Default to using tr1. -#define PB_DS_USE_TR1 1 - -#ifdef PB_DS_USE_TR1 #include <tr1/unordered_set> -#else -#include <ext/hash_set> -#endif -namespace pb_ds +namespace __gnu_pbds { namespace test { -#ifdef PB_DS_USE_TR1 #define PB_DS_BASE_C_DEC \ std::tr1::__unordered_set<Key, Hash_Fn, Eq_Fn, \ typename Allocator::template rebind<Key>::other, Cache_Hash> -#else -#define PB_DS_BASE_C_DEC \ - __gnu_cxx::hash_set<Key, Hash_Fn, Eq_Fn, \ - typename Allocator::template rebind<Key>::other> -#endif template<typename Key, size_t Init_Size = 8, - typename Hash_Fn = typename pb_ds::detail::default_hash_fn<Key>::type, + typename Hash_Fn = typename __gnu_pbds::detail::default_hash_fn<Key>::type, typename Eq_Fn = std::equal_to<Key>, typename Less_Fn = std::less<Key>, - typename Allocator = std::allocator<char> -#ifdef PB_DS_USE_TR1 - , bool Cache_Hash = false -#endif + typename Allocator = std::allocator<char>, bool Cache_Hash = false > class native_hash_set : public PB_DS_BASE_C_DEC { @@ -129,32 +112,24 @@ namespace pb_ds static std::string name() { -#ifdef PB_DS_USE_TR1 return std::string("n_hash_set_") + (Cache_Hash ? std::string("cah") : std::string("ncah")); -#else - return std::string("n_hash_set_ncah"); -#endif } static std::string desc() { -#ifdef PB_DS_USE_TR1 const std::string cache_hash_desc = make_xml_tag("cache_hash_code", "value", Cache_Hash ? std::string("true") : std::string("false")); return make_xml_tag("type", "value", "std_tr1_unordered_set", cache_hash_desc); -#else - return make_xml_tag("type", "value", "__gnucxx_hash_set"); -#endif } }; #undef PB_DS_BASE_C_DEC } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_tag.hpp b/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_tag.hpp index d4a19c2bda1..ad8fec10f2c 100644 --- a/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_tag.hpp +++ b/libstdc++-v3/testsuite/util/native_type/assoc/native_hash_tag.hpp @@ -47,12 +47,12 @@ #ifndef PB_DS_NATIVE_HASH_DS_TAG_HPP #define PB_DS_NATIVE_HASH_DS_TAG_HPP -namespace pb_ds +namespace __gnu_pbds { namespace test { struct native_hash_tag { }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/native_type/assoc/native_map.hpp b/libstdc++-v3/testsuite/util/native_type/assoc/native_map.hpp index d32730c230b..1be7ee5984f 100644 --- a/libstdc++-v3/testsuite/util/native_type/assoc/native_map.hpp +++ b/libstdc++-v3/testsuite/util/native_type/assoc/native_map.hpp @@ -41,7 +41,7 @@ /** * @file native_map.hpp - * Contains an adapter to Dinkumware/SGI tree tables + * Contains an adapter to std::map */ #ifndef PB_DS_NATIVE_MAP_HPP @@ -54,7 +54,7 @@ #include <native_type/assoc/native_tree_tag.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -92,6 +92,6 @@ typename Allocator::template rebind<std::pair<const Key, Data > >::other > } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_NATIVE_MAP_HPP diff --git a/libstdc++-v3/testsuite/util/native_type/assoc/native_multimap.hpp b/libstdc++-v3/testsuite/util/native_type/assoc/native_multimap.hpp index e2e1bafb3fb..906fca3244e 100644 --- a/libstdc++-v3/testsuite/util/native_type/assoc/native_multimap.hpp +++ b/libstdc++-v3/testsuite/util/native_type/assoc/native_multimap.hpp @@ -41,7 +41,7 @@ /** * @file native_multimap.hpp - * Contains an adapter to Dinkumware/SGI tables + * Contains an adapter to std::multimap */ #ifndef PB_DS_NATIVE_MULTIMAP_HPP @@ -52,7 +52,7 @@ #include <ext/pb_ds/detail/type_utils.hpp> #include <native_type/assoc/native_tree_tag.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -147,6 +147,6 @@ namespace pb_ds #undef PB_DS_BASE_C_DEC } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_NATIVE_MULTIMAP_HPP diff --git a/libstdc++-v3/testsuite/util/native_type/assoc/native_set.hpp b/libstdc++-v3/testsuite/util/native_type/assoc/native_set.hpp index 9d03adce3fc..b25f2bac29e 100644 --- a/libstdc++-v3/testsuite/util/native_type/assoc/native_set.hpp +++ b/libstdc++-v3/testsuite/util/native_type/assoc/native_set.hpp @@ -41,7 +41,7 @@ /** * @file native_set.hpp - * Contains an adapter to Dinkumware/SGI tree tables + * Contains an adapter to std::set */ #ifndef PB_DS_NATIVE_SET_HPP @@ -53,7 +53,7 @@ #include <native_type/assoc/native_tree_tag.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -92,6 +92,6 @@ namespace pb_ds #undef PB_DS_BASE_C_DEC } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_NATIVE_SET_HPP diff --git a/libstdc++-v3/testsuite/util/native_type/assoc/native_tree_tag.hpp b/libstdc++-v3/testsuite/util/native_type/assoc/native_tree_tag.hpp index e8f8e705fb6..de2a019b273 100644 --- a/libstdc++-v3/testsuite/util/native_type/assoc/native_tree_tag.hpp +++ b/libstdc++-v3/testsuite/util/native_type/assoc/native_tree_tag.hpp @@ -47,13 +47,13 @@ #ifndef PB_DS_NATIVE_TREE_DS_TAG_HPP #define PB_DS_NATIVE_TREE_DS_TAG_HPP -namespace pb_ds +namespace __gnu_pbds { namespace test { struct native_tree_tag { }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/native_type/priority_queue/native_priority_queue.hpp b/libstdc++-v3/testsuite/util/native_type/priority_queue/native_priority_queue.hpp index 88b2697c4bd..81525c0bfc9 100644 --- a/libstdc++-v3/testsuite/util/native_type/priority_queue/native_priority_queue.hpp +++ b/libstdc++-v3/testsuite/util/native_type/priority_queue/native_priority_queue.hpp @@ -55,7 +55,7 @@ #include <ext/pb_ds/detail/type_utils.hpp> #include <io/xml.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -229,6 +229,6 @@ namespace pb_ds #undef PB_DS_CLASS_C_DEC } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/mem_usage/erase_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/mem_usage/erase_test.hpp index 3d2804e81f5..722811aac51 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/mem_usage/erase_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/mem_usage/erase_test.hpp @@ -53,7 +53,7 @@ #include <performance/io/xml_formatter.hpp> #include <common_type/assoc/string_form.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -113,7 +113,7 @@ namespace pb_ds } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/mem_usage/multimap_insert_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/mem_usage/multimap_insert_test.hpp index 1fb4eef9003..22300bb5b86 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/mem_usage/multimap_insert_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/mem_usage/multimap_insert_test.hpp @@ -53,7 +53,7 @@ #include <performance/io/xml_formatter.hpp> #include <common_type/assoc/string_form.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -74,11 +74,11 @@ namespace pb_ds template<typename Cntnr> size_t - insert(Cntnr, It ins_it_b, It ins_it_e, pb_ds::detail::true_type); + insert(Cntnr, It ins_it_b, It ins_it_e, __gnu_pbds::detail::true_type); template<typename Cntnr> size_t - insert(Cntnr, It ins_it_b, It ins_it_e, pb_ds::detail::false_type); + insert(Cntnr, It ins_it_b, It ins_it_e, __gnu_pbds::detail::false_type); const It m_ins_b; const size_t m_ins_vn; @@ -104,7 +104,7 @@ namespace pb_ds std::advance(ins_it_e, ins_size); const size_t delta_mem = insert(Cntnr(), ins_it_b, ins_it_e, - pb_ds::detail::integral_constant<int,Native>()); + __gnu_pbds::detail::integral_constant<int,Native>()); res_set_fmt.add_res(ins_size, static_cast<double>(delta_mem)); } @@ -114,7 +114,7 @@ namespace pb_ds template<typename Cntnr> size_t multimap_insert_test<It, Native>:: - insert(Cntnr, It ins_it_b, It ins_it_e, pb_ds::detail::true_type) + insert(Cntnr, It ins_it_b, It ins_it_e, __gnu_pbds::detail::true_type) { typedef __gnu_test::tracker_allocator_counter counter_type; __gnu_test::tracker_allocator<char> alloc; @@ -133,7 +133,7 @@ namespace pb_ds template<typename Cntnr> size_t multimap_insert_test<It, Native>:: - insert(Cntnr, It ins_it_b, It ins_it_e, pb_ds::detail::false_type) + insert(Cntnr, It ins_it_b, It ins_it_e, __gnu_pbds::detail::false_type) { typedef __gnu_test::tracker_allocator_counter counter_type; __gnu_test::tracker_allocator<char> alloc; @@ -148,7 +148,7 @@ namespace pb_ds return (final_mem - init_mem); } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp b/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp index e0bb1e95d73..2d386ff2645 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/multimap_common_type.hpp @@ -50,7 +50,7 @@ #include <hash_fn/string_hash_fn.hpp> #include <common_type/assoc/common_type.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -67,9 +67,9 @@ namespace pb_ds struct hash_set_tl_t { typedef - typename pb_ds::test::hash_common_types< + typename __gnu_pbds::test::hash_common_types< Key, - pb_ds::null_mapped_type, + __gnu_pbds::null_mapped_type, int_hash, std::equal_to<Key>, Allocator>::performance_min_tl @@ -80,9 +80,9 @@ namespace pb_ds struct lu_set_tl_t { typedef - typename pb_ds::test::lu_common_types< + typename __gnu_pbds::test::lu_common_types< Key, - pb_ds::null_mapped_type, + __gnu_pbds::null_mapped_type, std::equal_to< Key>, Allocator>::performance_min_tl @@ -96,8 +96,8 @@ namespace pb_ds { private: typedef - typename pb_ds::detail::__conditional_type< - pb_ds::detail::is_same< + typename __gnu_pbds::detail::__conditional_type< + __gnu_pbds::detail::is_same< int, Key>::value, int_hash, @@ -108,7 +108,7 @@ namespace pb_ds struct hash_mmap_transform { typedef - typename pb_ds::test::hash_common_types< + typename __gnu_pbds::test::hash_common_types< Key, Cntnr_T, hash_fn_t, @@ -137,12 +137,12 @@ namespace pb_ds struct tree_mmap_transform { typedef - typename pb_ds::test::tree_common_types< + typename __gnu_pbds::test::tree_common_types< Key, Cntnr_T, std::less< Key>, - pb_ds::null_tree_node_update, + __gnu_pbds::null_tree_node_update, Allocator>::performance_min_tl type; }; @@ -227,7 +227,7 @@ namespace pb_ds }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/common_type.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/common_type.hpp index be4a31b3bdc..72cdf115cbc 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/common_type.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/common_type.hpp @@ -49,25 +49,25 @@ #include <common_type/assoc/common_type.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { typedef - pb_ds::test::hash_common_types< + __gnu_pbds::test::hash_common_types< int, - pb_ds::null_mapped_type>::tl + __gnu_pbds::null_mapped_type>::tl hash_set_tl_t; template<typename Cntnr_T> struct hash_mmap_transform { typedef - typename pb_ds::test::hash_common_types< + typename __gnu_pbds::test::hash_common_types< int, - pb_ds::compound_data_type< + __gnu_pbds::compound_data_type< Cntnr_T> >::tl type; }; @@ -80,18 +80,18 @@ namespace pb_ds hash_mmap_tl_t; typedef - pb_ds::test::tree_common_types< + __gnu_pbds::test::tree_common_types< int, - pb_ds::null_mapped_type>::tl + __gnu_pbds::null_mapped_type>::tl tree_set_tl_t; template<typename Cntnr_T> struct tree_mmap_transform { typedef - typename pb_ds::test::tree_common_types< + typename __gnu_pbds::test::tree_common_types< int, - pb_ds::compound_data_type< + __gnu_pbds::compound_data_type< Cntnr_T> >::tl type; }; @@ -107,7 +107,7 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_MULTIMAP_RANDOM_INT_INSERT_TEST_COMMON_TYPE_HPP diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/find_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/find_test.hpp index bffac262247..d9ec7fb1572 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/find_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/find_test.hpp @@ -52,7 +52,7 @@ #include <common_type/assoc/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -111,7 +111,7 @@ namespace pb_ds } // namespace detail template<typename It, bool LOR = false> - class find_test : private pb_ds::test::detail::timing_test_base + class find_test : private __gnu_pbds::test::detail::timing_test_base { public: find_test(It ins_b, It fnd_it_b, size_t ins_vn, size_t ins_vs, @@ -161,16 +161,16 @@ namespace pb_ds It fnd_it_e = m_fnd_it_b; std::advance(fnd_it_e, fnd_size); - pb_ds::test::detail::find_find_functor<It, Cntnr, LOR> + __gnu_pbds::test::detail::find_find_functor<It, Cntnr, LOR> fn(test_container, fnd_it_b, fnd_it_e); const double res = - pb_ds::test::detail::timing_test_base::operator()(fn); + __gnu_pbds::test::detail::timing_test_base::operator()(fn); res_set_fmt.add_res(v, res / fnd_size); } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/insert_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/insert_test.hpp index c1ff8eb064a..b4dfa29b8cf 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/insert_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/insert_test.hpp @@ -53,7 +53,7 @@ #include <common_type/assoc/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -85,7 +85,7 @@ namespace pb_ds } // namespace detail template<typename It> - class insert_test : private pb_ds::test::detail::timing_test_base + class insert_test : private __gnu_pbds::test::detail::timing_test_base { public: insert_test(It ins_b, size_t ins_vn, size_t ins_vs, size_t ins_vm) @@ -126,11 +126,11 @@ namespace pb_ds It ins_it_e = m_ins_b; std::advance(ins_it_e, v); - pb_ds::test::detail::insert_insert_functor<It, Cntnr> + __gnu_pbds::test::detail::insert_insert_functor<It, Cntnr> fn(ins_it_b, ins_it_e); const double res = - pb_ds::test::detail::timing_test_base::operator()(fn); + __gnu_pbds::test::detail::timing_test_base::operator()(fn); res_set_fmt.add_res(v, res / v); } @@ -147,7 +147,7 @@ namespace pb_ds cntnr.insert((typename Cntnr::const_reference)(*ins_it)); } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_find_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_find_test.hpp index 019a32d2a23..4d639d38c4e 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_find_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_find_test.hpp @@ -52,7 +52,7 @@ #include <common_type/assoc/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -128,7 +128,8 @@ namespace pb_ds template<typename It, bool Native> - class multimap_find_test : private pb_ds::test::detail::timing_test_base + class multimap_find_test + : private __gnu_pbds::test::detail::timing_test_base { public: multimap_find_test(It ins_b, size_t ins_vn, size_t vs, size_t ins_vm) @@ -144,12 +145,12 @@ namespace pb_ds template<typename Cntnr> Cntnr - init(It ins_b, It ins_e, Cntnr, pb_ds::detail::true_type) + init(It ins_b, It ins_e, Cntnr, __gnu_pbds::detail::true_type) { return Cntnr(ins_b, ins_e); } template<typename Cntnr> Cntnr - init(It ins_b, It ins_e, Cntnr, pb_ds::detail::false_type) + init(It ins_b, It ins_e, Cntnr, __gnu_pbds::detail::false_type) { Cntnr ret; for (It it = ins_b; it != ins_e; ++it) @@ -182,19 +183,19 @@ namespace pb_ds std::advance(ins_it_e, v); Cntnr c = init(ins_it_b, ins_it_e, Cntnr(), - pb_ds::detail::integral_constant<int,Native>()); + __gnu_pbds::detail::integral_constant<int,Native>()); - pb_ds::test::detail::multimap_find_functor<It, Cntnr, Native> + __gnu_pbds::test::detail::multimap_find_functor<It, Cntnr, Native> fn(c, ins_it_b, ins_it_e); const double res = - pb_ds::test::detail::timing_test_base::operator()(fn); + __gnu_pbds::test::detail::timing_test_base::operator()(fn); res_set_fmt.add_res(v, res / v); } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_insert_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_insert_test.hpp index e911f859483..f35d95217b5 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_insert_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/multimap_insert_test.hpp @@ -52,7 +52,7 @@ #include <common_type/assoc/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -97,7 +97,7 @@ namespace pb_ds { Cntnr cntnr; for (It ins_it = m_ins_it_b; ins_it != m_ins_it_e; ++ins_it) - cntnr.insert((typename Cntnr::const_reference)(*ins_it)); + cntnr.insert((typename Cntnr::const_reference)(*ins_it)); } } @@ -108,7 +108,8 @@ namespace pb_ds } // namespace detail template<typename It, bool Native> - class multimap_insert_test : private pb_ds::test::detail::timing_test_base + class multimap_insert_test + : private __gnu_pbds::test::detail::timing_test_base { public: multimap_insert_test(It b, size_t ins_vn, size_t ins_vs, size_t ins_vm) @@ -122,7 +123,6 @@ namespace pb_ds private: multimap_insert_test(const multimap_insert_test&); - private: const It m_ins_b; const size_t m_ins_vn; const size_t m_ins_vs; @@ -146,16 +146,16 @@ namespace pb_ds It ins_it_e = m_ins_b; std::advance(ins_it_e, v); - pb_ds::test::detail::multimap_insert_functor<It, Cntnr, Native> + __gnu_pbds::test::detail::multimap_insert_functor<It, Cntnr, Native> fn(ins_it_b, ins_it_e); const double res = - pb_ds::test::detail::timing_test_base::operator()(fn); + __gnu_pbds::test::detail::timing_test_base::operator()(fn); res_set_fmt.add_res(v, res / v); } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/subscript_find_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/subscript_find_test.hpp index 6415cd8ece0..af84e9c9436 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/subscript_find_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/subscript_find_test.hpp @@ -51,7 +51,7 @@ #include <common_type/assoc/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -86,7 +86,7 @@ namespace pb_ds } // namespace detail template<typename It> - class subscript_find_test : private pb_ds::test::detail::timing_test_base + class subscript_find_test : private __gnu_pbds::test::detail::timing_test_base { public: subscript_find_test(It ins_b, It b, size_t ins_vn, size_t ins_vs, @@ -138,17 +138,17 @@ namespace pb_ds It fnd_it_e = m_fnd_b; std::advance(fnd_it_e, fnd_size); - pb_ds::test::detail::subscript_find_functor<It, Cntnr> + __gnu_pbds::test::detail::subscript_find_functor<It, Cntnr> fn(test_container, fnd_it_b, fnd_it_e); const double res = - pb_ds::test::detail::timing_test_base::operator()(fn); + __gnu_pbds::test::detail::timing_test_base::operator()(fn); res_set_fmt.add_res(v, res / fnd_size); } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/subscript_insert_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/subscript_insert_test.hpp index 3b9efb02978..c9a9b9fdecc 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/subscript_insert_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/subscript_insert_test.hpp @@ -52,7 +52,7 @@ #include <common_type/assoc/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -85,7 +85,7 @@ namespace pb_ds } // namespace detail template<typename It> - class subscript_insert_test : private pb_ds::test::detail::timing_test_base + class subscript_insert_test : private __gnu_pbds::test::detail::timing_test_base { public: subscript_insert_test(It ins_b, It b, size_t ins_vn, size_t ins_vs, @@ -128,17 +128,17 @@ namespace pb_ds It ins_it_b = m_ins_b; It ins_it_e = m_ins_b; std::advance(ins_it_e, v); - pb_ds::test::detail::subscript_insert_functor<It, Cntnr> + __gnu_pbds::test::detail::subscript_insert_functor<It, Cntnr> fn(ins_it_b, ins_it_e); const double res = - pb_ds::test::detail::timing_test_base::operator()(fn); + __gnu_pbds::test::detail::timing_test_base::operator()(fn); res_set_fmt.add_res(v, res / v); } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/tree_order_statistics_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/tree_order_statistics_test.hpp index fb9b2c043db..8ccbfb95207 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/tree_order_statistics_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/tree_order_statistics_test.hpp @@ -54,7 +54,7 @@ #include <iterator> #include <cstdlib> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -73,7 +73,7 @@ namespace pb_ds enum { support_detected = - pb_ds::test::detail::tree_supports_order_statistics<Cntnr>::value + __gnu_pbds::test::detail::tree_supports_order_statistics<Cntnr>::value }; PB_DS_STATIC_ASSERT(correct_type, support_detected); @@ -126,7 +126,7 @@ namespace pb_ds template<bool Support_Order_Statistics> class tree_order_statistics_test - : private pb_ds::test::detail::timing_test_base + : private __gnu_pbds::test::detail::timing_test_base { public: tree_order_statistics_test(size_t vn, size_t vs, size_t vm) @@ -142,11 +142,11 @@ namespace pb_ds template<typename Cntnr> void - order_statistics(Cntnr& r_container, pb_ds::detail::true_type); + order_statistics(Cntnr& r_container, __gnu_pbds::detail::true_type); template<typename Cntnr> void - order_statistics(Cntnr& r_container, pb_ds::detail::false_type); + order_statistics(Cntnr& r_container, __gnu_pbds::detail::false_type); private: const size_t m_vn; @@ -170,17 +170,17 @@ namespace pb_ds for (size_t ins = 0; ins < v; ++ ins) cntnr.insert((typename Cntnr::value_type)ins); - pb_ds::test::detail::order_statistics_functor<Cntnr, Support_Order_Statistics> + __gnu_pbds::test::detail::order_statistics_functor<Cntnr, Support_Order_Statistics> fn(cntnr); const double res = - pb_ds::test::detail::timing_test_base::operator()(fn); + __gnu_pbds::test::detail::timing_test_base::operator()(fn); res_set_fmt.add_res(v, res / v); } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/assoc/timing/tree_split_join_test.hpp b/libstdc++-v3/testsuite/util/performance/assoc/timing/tree_split_join_test.hpp index 6c906522e37..7595dc2cb0d 100644 --- a/libstdc++-v3/testsuite/util/performance/assoc/timing/tree_split_join_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/assoc/timing/tree_split_join_test.hpp @@ -52,7 +52,7 @@ #include <common_type/assoc/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -111,7 +111,7 @@ namespace pb_ds } // namespace detail template<bool Support_Split_Join> - class tree_split_join_test : private pb_ds::test::detail::timing_test_base + class tree_split_join_test : private __gnu_pbds::test::detail::timing_test_base { public: tree_split_join_test(size_t vn, size_t vs, size_t vm); @@ -153,16 +153,16 @@ namespace pb_ds for (size_t ins = 0; ins < v; ++ ins) cntnr.insert((typename Cntnr::value_type)ins); - pb_ds::test::detail::split_join_functor<Cntnr, Support_Split_Join> + __gnu_pbds::test::detail::split_join_functor<Cntnr, Support_Split_Join> fn(cntnr); const double res = - pb_ds::test::detail::timing_test_base::operator()(fn); + __gnu_pbds::test::detail::timing_test_base::operator()(fn); res_set_fmt.add_res(v, res); } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/io/xml_formatter.hpp b/libstdc++-v3/testsuite/util/performance/io/xml_formatter.hpp index e7d48d7dc48..fdaa65e73c0 100644 --- a/libstdc++-v3/testsuite/util/performance/io/xml_formatter.hpp +++ b/libstdc++-v3/testsuite/util/performance/io/xml_formatter.hpp @@ -51,7 +51,7 @@ #include <iostream> #include <io/xml_test_formatter.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -83,6 +83,6 @@ namespace pb_ds } }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_XML_TEST_PERFORMANCE_FORMATTER_HPP diff --git a/libstdc++-v3/testsuite/util/performance/priority_queue/mem_usage/pop_test.hpp b/libstdc++-v3/testsuite/util/performance/priority_queue/mem_usage/pop_test.hpp index a3b8486f191..4f84fa64b9c 100644 --- a/libstdc++-v3/testsuite/util/performance/priority_queue/mem_usage/pop_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/priority_queue/mem_usage/pop_test.hpp @@ -53,7 +53,7 @@ #include <performance/io/xml_formatter.hpp> #include <common_type/priority_queue/string_form.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -115,7 +115,7 @@ namespace pb_ds } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/priority_queue/timing/join_test.hpp b/libstdc++-v3/testsuite/util/performance/priority_queue/timing/join_test.hpp index d04f9041b3c..e419e4f173a 100644 --- a/libstdc++-v3/testsuite/util/performance/priority_queue/timing/join_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/priority_queue/timing/join_test.hpp @@ -53,7 +53,7 @@ #include <common_type/priority_queue/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -114,7 +114,7 @@ namespace pb_ds } // namespace detail template<typename It> - class join_test : private pb_ds::test::detail::timing_test_base + class join_test : private __gnu_pbds::test::detail::timing_test_base { public: join_test(It ins_b, size_t ins_vn, size_t ins_vs, size_t ins_vm) @@ -125,9 +125,9 @@ namespace pb_ds void operator()(Cntnr) { - using pb_ds::test::detail::double_push_functor; - using pb_ds::test::detail::double_push_join_functor; - typedef pb_ds::test::detail::timing_test_base base_type; + using __gnu_pbds::test::detail::double_push_functor; + using __gnu_pbds::test::detail::double_push_join_functor; + typedef __gnu_pbds::test::detail::timing_test_base base_type; typedef double_push_functor<It, Cntnr> psh_fnct; typedef double_push_join_functor<It, Cntnr> psh_jn_fnct; @@ -171,7 +171,7 @@ namespace pb_ds const size_t m_ins_vm; }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/priority_queue/timing/modify_test.hpp b/libstdc++-v3/testsuite/util/performance/priority_queue/timing/modify_test.hpp index 33c7e58bdd1..1ce1804f297 100644 --- a/libstdc++-v3/testsuite/util/performance/priority_queue/timing/modify_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/priority_queue/timing/modify_test.hpp @@ -53,7 +53,7 @@ #include <common_type/priority_queue/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -126,7 +126,7 @@ namespace pb_ds // Specializations. template<typename It, class Cntnr> - class push_functor<It, Cntnr, pb_ds::binary_heap_tag> + class push_functor<It, Cntnr, __gnu_pbds::binary_heap_tag> { public: push_functor(It ins_it_b, It ins_it_e) @@ -151,7 +151,7 @@ namespace pb_ds }; template<typename It, class Cntnr> - class push_functor<It, Cntnr, pb_ds::test::native_pq_tag> + class push_functor<It, Cntnr, __gnu_pbds::test::native_pq_tag> { public: push_functor(It ins_it_b, It ins_it_e) @@ -178,7 +178,7 @@ namespace pb_ds template<typename It, class Cntnr> - class push_modify_functor<It, Cntnr, pb_ds::binary_heap_tag> + class push_modify_functor<It, Cntnr, __gnu_pbds::binary_heap_tag> { private: typedef typename Cntnr::iterator iterator; @@ -220,7 +220,7 @@ namespace pb_ds }; template<typename It, class Cntnr> - class push_modify_functor<It, Cntnr, pb_ds::test::native_pq_tag> + class push_modify_functor<It, Cntnr, __gnu_pbds::test::native_pq_tag> { private: typedef typename Cntnr::value_type value_type; @@ -253,7 +253,7 @@ namespace pb_ds } // namespace detail template<typename It> - class modify_test : private pb_ds::test::detail::timing_test_base + class modify_test : private __gnu_pbds::test::detail::timing_test_base { public: modify_test(It b, size_t vn, size_t vs, size_t vm, bool modify_up) @@ -333,7 +333,7 @@ namespace pb_ds } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/priority_queue/timing/push_pop_test.hpp b/libstdc++-v3/testsuite/util/performance/priority_queue/timing/push_pop_test.hpp index ef04c3258cc..a2303f9b1b3 100644 --- a/libstdc++-v3/testsuite/util/performance/priority_queue/timing/push_pop_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/priority_queue/timing/push_pop_test.hpp @@ -53,7 +53,7 @@ #include <common_type/priority_queue/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -88,7 +88,7 @@ namespace pb_ds } // namespace detail template<typename It> - class push_pop_test : private pb_ds::test::detail::timing_test_base + class push_pop_test : private __gnu_pbds::test::detail::timing_test_base { public: push_pop_test(It ins_b, size_t ins_vn, size_t ins_vs, size_t ins_vm) @@ -135,17 +135,17 @@ namespace pb_ds It ins_it_e = m_ins_b; std::advance(ins_it_e, v); - pb_ds::test::detail::push_pop_push_pop_functor<It, Cntnr> + __gnu_pbds::test::detail::push_pop_push_pop_functor<It, Cntnr> fn(ins_it_b, ins_it_e); const double res = - pb_ds::test::detail::timing_test_base::operator()(fn); + __gnu_pbds::test::detail::timing_test_base::operator()(fn); res_set_fmt.add_res(v, res / v); } } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/priority_queue/timing/push_test.hpp b/libstdc++-v3/testsuite/util/performance/priority_queue/timing/push_test.hpp index d6f280501dd..961c00ec638 100644 --- a/libstdc++-v3/testsuite/util/performance/priority_queue/timing/push_test.hpp +++ b/libstdc++-v3/testsuite/util/performance/priority_queue/timing/push_test.hpp @@ -53,7 +53,7 @@ #include <common_type/priority_queue/string_form.hpp> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -85,7 +85,7 @@ namespace pb_ds } // namespace detail template<typename It> - class push_test : private pb_ds::test::detail::timing_test_base + class push_test : private __gnu_pbds::test::detail::timing_test_base { public: push_test(It ins_b, size_t ins_vn, size_t ins_vs, size_t ins_vm) @@ -127,11 +127,11 @@ namespace pb_ds It ins_it_e = m_ins_b; std::advance(ins_it_e, v); - pb_ds::test::detail::push_push_functor<It, Cntnr> + __gnu_pbds::test::detail::push_push_functor<It, Cntnr> fn(ins_it_b, ins_it_e); const double res = - pb_ds::test::detail::timing_test_base::operator()(fn); + __gnu_pbds::test::detail::timing_test_base::operator()(fn); res_set_fmt.add_res(v, res / v); } @@ -148,7 +148,7 @@ namespace pb_ds cntnr.push((typename Cntnr::const_reference)(*ins_it)); } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.cc b/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.cc index 39748bf2d8d..e21d14dc61e 100644 --- a/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.cc +++ b/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.cc @@ -46,7 +46,7 @@ #include <util/performance/time/elapsed_timer.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -75,4 +75,4 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds diff --git a/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.hpp b/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.hpp index 06d9b307984..2ab7ac0e310 100644 --- a/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.hpp +++ b/libstdc++-v3/testsuite/util/performance/time/elapsed_timer.hpp @@ -50,7 +50,7 @@ #include <time.h> #include <iosfwd> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -72,6 +72,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_TEST_TIME_HPP diff --git a/libstdc++-v3/testsuite/util/performance/time/timing_test_base.hpp b/libstdc++-v3/testsuite/util/performance/time/timing_test_base.hpp index a56d2c21313..8e4cd99dc0e 100644 --- a/libstdc++-v3/testsuite/util/performance/time/timing_test_base.hpp +++ b/libstdc++-v3/testsuite/util/performance/time/timing_test_base.hpp @@ -50,7 +50,7 @@ #include <performance/time/elapsed_timer.hpp> #include <statistic/result_recorder.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -81,7 +81,7 @@ namespace pb_ds timing_test_base::operator()(Functor& fn) { const std::size_t resolution = get_min_resolution(fn); - pb_ds::test::detail::result_recorder<double> rec; + __gnu_pbds::test::detail::result_recorder<double> rec; double res; do res = run_at_resolution(fn, resolution); @@ -121,7 +121,7 @@ namespace pb_ds } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp b/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp index 0f86f38da3d..61f04a8336d 100644 --- a/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp +++ b/libstdc++-v3/testsuite/util/regression/assoc/common_type.hpp @@ -50,7 +50,7 @@ #include <regression/basic_type.hpp> #include <common_type/assoc/common_type.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -72,15 +72,15 @@ namespace test } }; - typedef pb_ds::string_trie_e_access_traits<basic_type, 'a', 'a' + basic_type::distinct_chars - 1, false, alloc_type> e_access_traits_t; + typedef __gnu_pbds::string_trie_e_access_traits<basic_type, 'a', 'a' + basic_type::distinct_chars - 1, false, alloc_type> e_access_traits_t; template<typename Data_Type> struct tree_types { private: - typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, pb_ds::null_tree_node_update, alloc_type>::regression_tl no_order_statistics_tl_t; + typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, __gnu_pbds::null_tree_node_update, alloc_type>::regression_tl no_order_statistics_tl_t; - typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, pb_ds::tree_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t; + typedef typename tree_common_types<basic_type, Data_Type, std::less<basic_type>, __gnu_pbds::tree_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t; public: typedef typename __gnu_cxx::typelist::append<no_order_statistics_tl_t, order_statistics_tl_t>::type tl_t; @@ -92,11 +92,11 @@ namespace test struct trie_types { private: - typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, pb_ds::pat_trie_tag, pb_ds::null_trie_node_update, alloc_type>::regression_tl no_updates_tl_t; + typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, __gnu_pbds::pat_trie_tag, __gnu_pbds::null_trie_node_update, alloc_type>::regression_tl no_updates_tl_t; - typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, pb_ds::pat_trie_tag, pb_ds::trie_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t; + typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, __gnu_pbds::pat_trie_tag, __gnu_pbds::trie_order_statistics_node_update, alloc_type>::regression_tl order_statistics_tl_t; - typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, pb_ds::pat_trie_tag, pb_ds::trie_prefix_search_node_update, alloc_type>::regression_tl prefix_search_tl_t; + typedef typename trie_common_types<basic_type, Data_Type, e_access_traits_t, __gnu_pbds::pat_trie_tag, __gnu_pbds::trie_prefix_search_node_update, alloc_type>::regression_tl prefix_search_tl_t; public: typedef typename __gnu_cxx::typelist::append<no_updates_tl_t, typename __gnu_cxx::typelist::append<prefix_search_tl_t, order_statistics_tl_t>::type>::type tl_t; @@ -140,6 +140,6 @@ namespace test typedef trie_types<basic_type>::tl_t trie_map_tl_t; typedef trie_types<basic_type>::min_tl_t min_trie_map_tl_t; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/regression/basic_type.hpp b/libstdc++-v3/testsuite/util/regression/basic_type.hpp index ad93bf47142..93a12922ffa 100644 --- a/libstdc++-v3/testsuite/util/regression/basic_type.hpp +++ b/libstdc++-v3/testsuite/util/regression/basic_type.hpp @@ -50,7 +50,7 @@ #include <string> #include <ext/throw_allocator.h> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -99,6 +99,6 @@ namespace test #undef PB_DS_BASE_C_DEC } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/regression/priority_queue/common_type.hpp b/libstdc++-v3/testsuite/util/regression/priority_queue/common_type.hpp index ce5a9e81a01..7740a913852 100644 --- a/libstdc++-v3/testsuite/util/regression/priority_queue/common_type.hpp +++ b/libstdc++-v3/testsuite/util/regression/priority_queue/common_type.hpp @@ -50,7 +50,7 @@ #include <regression/basic_type.hpp> #include <common_type/priority_queue/common_type.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -60,6 +60,6 @@ namespace test typedef pq_tl_t min_pq_tl_t; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp index 3f77c219e00..7eaa3968f9a 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/container_rand_regression_test.hpp @@ -58,7 +58,7 @@ #include <common_type/assoc/string_form.hpp> #include <regression/rand/io/assoc/xml_formatter.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -137,7 +137,7 @@ namespace detail typedef typename test_traits::value_type value_type; typedef typename test_traits::native_type native_type; typedef twister_rand_gen gen; - typedef pb_ds::container_traits<Cntnr> container_traits; + typedef __gnu_pbds::container_traits<Cntnr> container_traits; typedef __gnu_cxx::throw_allocator<char> alloc_t; enum op @@ -173,52 +173,52 @@ namespace detail iterator_defs(); static void - node_iterator_defs(pb_ds::detail::false_type); + node_iterator_defs(__gnu_pbds::detail::false_type); static void - node_iterator_defs(pb_ds::detail::true_type); + node_iterator_defs(__gnu_pbds::detail::true_type); static void policy_defs(); static void - policy_defs(pb_ds::basic_hash_tag); + policy_defs(__gnu_pbds::basic_hash_tag); static void - policy_defs(pb_ds::cc_hash_tag); + policy_defs(__gnu_pbds::cc_hash_tag); static void - policy_defs(pb_ds::gp_hash_tag); + policy_defs(__gnu_pbds::gp_hash_tag); static void - policy_defs(pb_ds::tree_tag); + policy_defs(__gnu_pbds::tree_tag); static void - policy_defs(pb_ds::list_update_tag); + policy_defs(__gnu_pbds::list_update_tag); static void - policy_defs(pb_ds::pat_trie_tag); + policy_defs(__gnu_pbds::pat_trie_tag); void policy_access(); void - policy_access(pb_ds::basic_hash_tag); + policy_access(__gnu_pbds::basic_hash_tag); void - policy_access(pb_ds::cc_hash_tag); + policy_access(__gnu_pbds::cc_hash_tag); void - policy_access(pb_ds::gp_hash_tag); + policy_access(__gnu_pbds::gp_hash_tag); void - policy_access(pb_ds::tree_tag); + policy_access(__gnu_pbds::tree_tag); void - policy_access(pb_ds::list_update_tag); + policy_access(__gnu_pbds::list_update_tag); void - policy_access(pb_ds::pat_trie_tag); + policy_access(__gnu_pbds::pat_trie_tag); void it_copy(); @@ -233,16 +233,16 @@ namespace detail rev_it_assign(); void - rev_it_copy_imp(pb_ds::detail::false_type); + rev_it_copy_imp(__gnu_pbds::detail::false_type); void - rev_it_copy_imp(pb_ds::detail::true_type); + rev_it_copy_imp(__gnu_pbds::detail::true_type); void - rev_it_assign_imp(pb_ds::detail::false_type); + rev_it_assign_imp(__gnu_pbds::detail::false_type); void - rev_it_assign_imp(pb_ds::detail::true_type); + rev_it_assign_imp(__gnu_pbds::detail::true_type); bool default_constructor(); @@ -260,19 +260,19 @@ namespace detail it_constructor(); bool - it_constructor_imp(pb_ds::cc_hash_tag); + it_constructor_imp(__gnu_pbds::cc_hash_tag); bool - it_constructor_imp(pb_ds::gp_hash_tag); + it_constructor_imp(__gnu_pbds::gp_hash_tag); bool - it_constructor_imp(pb_ds::tree_tag); + it_constructor_imp(__gnu_pbds::tree_tag); bool - it_constructor_imp(pb_ds::list_update_tag); + it_constructor_imp(__gnu_pbds::list_update_tag); bool - it_constructor_imp(pb_ds::pat_trie_tag); + it_constructor_imp(__gnu_pbds::pat_trie_tag); bool insert(); @@ -284,19 +284,19 @@ namespace detail erase_it(); bool - erase_it_imp(pb_ds::detail::false_type); + erase_it_imp(__gnu_pbds::detail::false_type); bool - erase_it_imp(pb_ds::detail::true_type); + erase_it_imp(__gnu_pbds::detail::true_type); bool erase_rev_it(); bool - erase_rev_it_imp(pb_ds::detail::false_type); + erase_rev_it_imp(__gnu_pbds::detail::false_type); bool - erase_rev_it_imp(pb_ds::detail::true_type); + erase_rev_it_imp(__gnu_pbds::detail::true_type); bool erase_if(); @@ -308,46 +308,46 @@ namespace detail resize(); bool - resize_imp(pb_ds::detail::true_type); + resize_imp(__gnu_pbds::detail::true_type); bool - resize_imp(pb_ds::detail::false_type); + resize_imp(__gnu_pbds::detail::false_type); bool get_set_loads(); bool - get_set_loads_imp(pb_ds::detail::true_type); + get_set_loads_imp(__gnu_pbds::detail::true_type); bool - get_set_loads_imp(pb_ds::detail::false_type); + get_set_loads_imp(__gnu_pbds::detail::false_type); void get_set_load(); void - get_set_load_imp(pb_ds::detail::true_type); + get_set_load_imp(__gnu_pbds::detail::true_type); void - get_set_load_imp(pb_ds::detail::false_type); + get_set_load_imp(__gnu_pbds::detail::false_type); bool subscript(); bool - subscript_imp(pb_ds::detail::false_type); + subscript_imp(__gnu_pbds::detail::false_type); bool - subscript_imp(pb_ds::detail::true_type); + subscript_imp(__gnu_pbds::detail::true_type); bool split_join(); bool - split_join_imp(pb_ds::detail::false_type); + split_join_imp(__gnu_pbds::detail::false_type); bool - split_join_imp(pb_ds::detail::true_type); + split_join_imp(__gnu_pbds::detail::true_type); void cmp(const Cntnr&, const native_type&, const std::string&); @@ -360,43 +360,43 @@ namespace detail void order_preserving_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::false_type); + __gnu_pbds::detail::false_type); void order_preserving_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::true_type); + __gnu_pbds::detail::true_type); void back_order_preserving_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::false_type); + __gnu_pbds::detail::false_type); void back_order_preserving_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::true_type); + __gnu_pbds::detail::true_type); void reverse_iteration_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::false_type); + __gnu_pbds::detail::false_type); void reverse_iteration_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::true_type); + __gnu_pbds::detail::true_type); void order_statistics_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::false_type); + __gnu_pbds::detail::false_type); void order_statistics_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::true_type); + __gnu_pbds::detail::true_type); void prefix_search_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::false_type); + __gnu_pbds::detail::false_type); void prefix_search_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::true_type); + __gnu_pbds::detail::true_type); template<typename Const_It, class Const_Native_It> void @@ -408,19 +408,19 @@ namespace detail void lower_bound_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::false_type); + __gnu_pbds::detail::false_type); void lower_bound_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::true_type); + __gnu_pbds::detail::true_type); void upper_bound_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::false_type); + __gnu_pbds::detail::false_type); void upper_bound_cmp_imp(const Cntnr&, const native_type&, - pb_ds::detail::true_type); + __gnu_pbds::detail::true_type); void print_container(const native_type&, std::ostream& r_os = std::cerr) const; @@ -495,6 +495,6 @@ namespace detail } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/cmp_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/cmp_fn_imps.hpp index 2b1325f8e51..3b19a752696 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/cmp_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/cmp_fn_imps.hpp @@ -140,50 +140,50 @@ cmp_(const Cntnr& r_c, const native_type& r_native_c) container_traits::order_preserving, back_order_preserving = container_traits::order_preserving&& - !pb_ds::detail::is_same< + !__gnu_pbds::detail::is_same< typename std::iterator_traits< typename cntnr::const_iterator>::iterator_category, std::forward_iterator_tag>::value, reverse_iteration = container_traits::reverse_iteration, order_statistics = test_traits::order_statistics, prefix_search = test_traits::prefix_search, - has_mapped = !pb_ds::detail::is_same< + has_mapped = !__gnu_pbds::detail::is_same< typename Cntnr::mapped_type, - pb_ds::null_mapped_type>::value + __gnu_pbds::null_mapped_type>::value }; order_preserving_cmp_imp(r_c, r_native_c, - pb_ds::detail::integral_constant<int,order_preserving>()); + __gnu_pbds::detail::integral_constant<int,order_preserving>()); back_order_preserving_cmp_imp(r_c, r_native_c, - pb_ds::detail::integral_constant<int,back_order_preserving>()); + __gnu_pbds::detail::integral_constant<int,back_order_preserving>()); order_statistics_cmp_imp(r_c, r_native_c, - pb_ds::detail::integral_constant<int,order_statistics>()); + __gnu_pbds::detail::integral_constant<int,order_statistics>()); prefix_search_cmp_imp(r_c, r_native_c, - pb_ds::detail::integral_constant<int,prefix_search>()); + __gnu_pbds::detail::integral_constant<int,prefix_search>()); reverse_iteration_cmp_imp(r_c, r_native_c, - pb_ds::detail::integral_constant<int,reverse_iteration>()); + __gnu_pbds::detail::integral_constant<int,reverse_iteration>()); lower_bound_cmp_imp(r_c, r_native_c, - pb_ds::detail::integral_constant<int,order_preserving>()); + __gnu_pbds::detail::integral_constant<int,order_preserving>()); upper_bound_cmp_imp(r_c, r_native_c, - pb_ds::detail::integral_constant<int,order_preserving>()); + __gnu_pbds::detail::integral_constant<int,order_preserving>()); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -order_preserving_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, pb_ds::detail::false_type) +order_preserving_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, __gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type) +order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, __gnu_pbds::detail::true_type) { PB_DS_SET_DESTRUCT_PRINT @@ -217,13 +217,13 @@ order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds: PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -back_order_preserving_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, pb_ds::detail::false_type) +back_order_preserving_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, __gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -back_order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type) +back_order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, __gnu_pbds::detail::true_type) { PB_DS_SET_DESTRUCT_PRINT @@ -241,13 +241,13 @@ back_order_preserving_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, p PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -reverse_iteration_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, pb_ds::detail::false_type) +reverse_iteration_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, __gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -reverse_iteration_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type) +reverse_iteration_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, __gnu_pbds::detail::true_type) { PB_DS_SET_DESTRUCT_PRINT @@ -281,13 +281,13 @@ reverse_iteration_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -order_statistics_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, pb_ds::detail::false_type) +order_statistics_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, __gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -order_statistics_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type) +order_statistics_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, __gnu_pbds::detail::true_type) { { m_alloc.set_throw_prob(0); @@ -350,13 +350,13 @@ order_statistics_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds: PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -prefix_search_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, pb_ds::detail::false_type) +prefix_search_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, __gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -prefix_search_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type) +prefix_search_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, __gnu_pbds::detail::true_type) { PB_DS_SET_DESTRUCT_PRINT @@ -495,13 +495,13 @@ back_it_cmp_imp(Const_It b, Const_It e, Const_Native_It native_b, Const_Native_I PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -lower_bound_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, pb_ds::detail::false_type) +lower_bound_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, __gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -lower_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type) +lower_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, __gnu_pbds::detail::true_type) { PB_DS_SET_DESTRUCT_PRINT @@ -548,13 +548,13 @@ lower_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::deta PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -upper_bound_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, pb_ds::detail::false_type) +upper_bound_cmp_imp(const Cntnr& /*r_c*/, const native_type& /*r_native_c*/, __gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -upper_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, pb_ds::detail::true_type) +upper_bound_cmp_imp(const Cntnr& r_c, const native_type& r_native_c, __gnu_pbds::detail::true_type) { PB_DS_SET_DESTRUCT_PRINT diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/constructor_destructor_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/constructor_destructor_fn_imps.hpp index 66a7077470f..c6b02b61a17 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/constructor_destructor_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/constructor_destructor_fn_imps.hpp @@ -162,7 +162,7 @@ it_constructor() PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -it_constructor_imp(pb_ds::cc_hash_tag) +it_constructor_imp(__gnu_pbds::cc_hash_tag) { bool done = true; Cntnr* p_c = NULL; @@ -229,7 +229,7 @@ it_constructor_imp(pb_ds::cc_hash_tag) PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -it_constructor_imp(pb_ds::gp_hash_tag) +it_constructor_imp(__gnu_pbds::gp_hash_tag) { bool done = true; Cntnr* p_c = NULL; @@ -312,7 +312,7 @@ it_constructor_imp(pb_ds::gp_hash_tag) PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -it_constructor_imp(pb_ds::tree_tag) +it_constructor_imp(__gnu_pbds::tree_tag) { bool done = true; Cntnr* p_c = NULL; @@ -348,7 +348,7 @@ it_constructor_imp(pb_ds::tree_tag) PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -it_constructor_imp(pb_ds::list_update_tag) +it_constructor_imp(__gnu_pbds::list_update_tag) { bool done = true; Cntnr* p_c = NULL; @@ -373,7 +373,7 @@ it_constructor_imp(pb_ds::list_update_tag) PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -it_constructor_imp(pb_ds::pat_trie_tag) +it_constructor_imp(__gnu_pbds::pat_trie_tag) { bool done = true; Cntnr* p_c = NULL; diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/defs_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/defs_fn_imps.hpp index 68829d3e187..0acb20cd62e 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/defs_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/defs_fn_imps.hpp @@ -63,7 +63,7 @@ defs() iterator_defs(); - node_iterator_defs(pb_ds::detail::integral_constant<int, + node_iterator_defs(__gnu_pbds::detail::integral_constant<int, container_traits::order_preserving>()); policy_defs(); @@ -124,7 +124,7 @@ void PB_DS_CLASS_C_DEC:: ds_defs() { - typedef pb_ds::container_traits< Cntnr> test_container_traits; + typedef __gnu_pbds::container_traits< Cntnr> test_container_traits; typedef typename test_container_traits::container_category test_container_category; @@ -162,13 +162,13 @@ iterator_defs() PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -node_iterator_defs(pb_ds::detail::false_type) +node_iterator_defs(__gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -node_iterator_defs(pb_ds::detail::true_type) +node_iterator_defs(__gnu_pbds::detail::true_type) { typedef typename Cntnr::node_iterator test_node_iterator; @@ -188,7 +188,7 @@ policy_defs() PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_defs(pb_ds::basic_hash_tag) +policy_defs(__gnu_pbds::basic_hash_tag) { typedef typename Cntnr::hash_fn test_hash_fn; @@ -200,9 +200,9 @@ policy_defs(pb_ds::basic_hash_tag) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_defs(pb_ds::cc_hash_tag) +policy_defs(__gnu_pbds::cc_hash_tag) { - policy_defs(pb_ds::basic_hash_tag()); + policy_defs(__gnu_pbds::basic_hash_tag()); typedef typename Cntnr::comb_hash_fn test_comb_hash_fn; } @@ -210,9 +210,9 @@ policy_defs(pb_ds::cc_hash_tag) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_defs(pb_ds::gp_hash_tag) +policy_defs(__gnu_pbds::gp_hash_tag) { - policy_defs(pb_ds::basic_hash_tag()); + policy_defs(__gnu_pbds::basic_hash_tag()); typedef typename Cntnr::comb_probe_fn test_comb_probe_fn; @@ -222,7 +222,7 @@ policy_defs(pb_ds::gp_hash_tag) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_defs(pb_ds::tree_tag) +policy_defs(__gnu_pbds::tree_tag) { typedef typename Cntnr::cmp_fn test_cmp_fn; @@ -232,7 +232,7 @@ policy_defs(pb_ds::tree_tag) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_defs(pb_ds::list_update_tag) +policy_defs(__gnu_pbds::list_update_tag) { typedef typename Cntnr::eq_fn test_eq_fn; @@ -242,7 +242,7 @@ policy_defs(pb_ds::list_update_tag) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_defs(pb_ds::pat_trie_tag) +policy_defs(__gnu_pbds::pat_trie_tag) { typedef typename Cntnr::e_access_traits e_access_traits; } diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/erase_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/erase_fn_imps.hpp index 0622d9eeef9..0bd39f33bb3 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/erase_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/erase_fn_imps.hpp @@ -166,13 +166,13 @@ erase_it() container_traits::order_preserving }; - return (erase_it_imp(pb_ds::detail::integral_constant<int,erase_iterators>())); + return (erase_it_imp(__gnu_pbds::detail::integral_constant<int,erase_iterators>())); } PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -erase_it_imp(pb_ds::detail::false_type) +erase_it_imp(__gnu_pbds::detail::false_type) { return (true); } @@ -180,7 +180,7 @@ erase_it_imp(pb_ds::detail::false_type) PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -erase_it_imp(pb_ds::detail::true_type) +erase_it_imp(__gnu_pbds::detail::true_type) { PB_DS_TRACE("erase_it"); @@ -222,9 +222,9 @@ erase_it_imp(pb_ds::detail::true_type) m_native_c.erase(native_it); bool range_guarantee = - pb_ds::detail::is_same< + __gnu_pbds::detail::is_same< typename container_traits::invalidation_guarantee, - pb_ds::range_invalidation_guarantee>::value ; + __gnu_pbds::range_invalidation_guarantee>::value ; if (range_guarantee) PB_DS_THROW_IF_FAILED( next_ers_it == next_it, "", m_p_c, & m_native_c); @@ -255,13 +255,13 @@ erase_rev_it() container_traits::reverse_iteration }; - return (erase_rev_it_imp(pb_ds::detail::integral_constant<int,erase_iterators>())); + return (erase_rev_it_imp(__gnu_pbds::detail::integral_constant<int,erase_iterators>())); } PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -erase_rev_it_imp(pb_ds::detail::false_type) +erase_rev_it_imp(__gnu_pbds::detail::false_type) { return (true); } @@ -269,7 +269,7 @@ erase_rev_it_imp(pb_ds::detail::false_type) PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -erase_rev_it_imp(pb_ds::detail::true_type) +erase_rev_it_imp(__gnu_pbds::detail::true_type) { PB_DS_TRACE("erase_rev_it"); diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/get_set_load_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/get_set_load_fn_imps.hpp index 8f58f3e2c46..adc87271c25 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/get_set_load_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/get_set_load_fn_imps.hpp @@ -50,7 +50,7 @@ PB_DS_CLASS_C_DEC:: get_set_load() { typedef - pb_ds::detail::integral_constant<int, + __gnu_pbds::detail::integral_constant<int, test_traits::get_set_load> get_set_load_ind; @@ -60,13 +60,13 @@ get_set_load() PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -get_set_load_imp(pb_ds::detail::false_type) +get_set_load_imp(__gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -get_set_load_imp(pb_ds::detail::true_type) +get_set_load_imp(__gnu_pbds::detail::true_type) { PB_DS_TRACE("get_set_load"); diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/get_set_loads_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/get_set_loads_fn_imps.hpp index cbcac81c631..10ea2aed941 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/get_set_loads_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/get_set_loads_fn_imps.hpp @@ -50,7 +50,7 @@ PB_DS_CLASS_C_DEC:: get_set_loads() { typedef - pb_ds::detail::integral_constant<int, + __gnu_pbds::detail::integral_constant<int, test_traits::get_set_loads> get_set_loads_ind; @@ -60,7 +60,7 @@ get_set_loads() PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -get_set_loads_imp(pb_ds::detail::false_type) +get_set_loads_imp(__gnu_pbds::detail::false_type) { return (true); } @@ -68,7 +68,7 @@ get_set_loads_imp(pb_ds::detail::false_type) PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -get_set_loads_imp(pb_ds::detail::true_type) +get_set_loads_imp(__gnu_pbds::detail::true_type) { PB_DS_TRACE("get_set_loads"); diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/insert_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/insert_fn_imps.hpp index 78fc38907b6..e5bf3be35b0 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/insert_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/insert_fn_imps.hpp @@ -77,7 +77,7 @@ insert() { done = false; } - catch(pb_ds::insert_error&) + catch(__gnu_pbds::insert_error&) { PB_DS_THROW_IF_FAILED(false, "", m_p_c, &m_native_c); } diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/it_conversion_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/it_conversion_fn_imps.hpp index 14d89e1ebf9..2a3c6396e8a 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/it_conversion_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/it_conversion_fn_imps.hpp @@ -195,7 +195,7 @@ rev_it_copy() reverse_iteration = container_traits::reverse_iteration }; - rev_it_copy_imp(pb_ds::detail::integral_constant<int,reverse_iteration>()); + rev_it_copy_imp(__gnu_pbds::detail::integral_constant<int,reverse_iteration>()); } PB_DS_CLASS_T_DEC @@ -208,19 +208,19 @@ rev_it_assign() reverse_iteration = container_traits::reverse_iteration }; - rev_it_assign_imp(pb_ds::detail::integral_constant<int,reverse_iteration>()); + rev_it_assign_imp(__gnu_pbds::detail::integral_constant<int,reverse_iteration>()); } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -rev_it_copy_imp(pb_ds::detail::false_type) +rev_it_copy_imp(__gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -rev_it_copy_imp(pb_ds::detail::true_type) +rev_it_copy_imp(__gnu_pbds::detail::true_type) { { typename cntnr::iterator it = m_p_c->end(); @@ -260,13 +260,13 @@ rev_it_copy_imp(pb_ds::detail::true_type) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -rev_it_assign_imp(pb_ds::detail::false_type) +rev_it_assign_imp(__gnu_pbds::detail::false_type) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -rev_it_assign_imp(pb_ds::detail::true_type) +rev_it_assign_imp(__gnu_pbds::detail::true_type) { { typename cntnr::iterator it = m_p_c->end(); diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/policy_access_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/policy_access_fn_imps.hpp index 7ffd18a77dc..9b4f0927f6f 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/policy_access_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/policy_access_fn_imps.hpp @@ -55,7 +55,7 @@ policy_access() PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_access(pb_ds::basic_hash_tag) +policy_access(__gnu_pbds::basic_hash_tag) { { typename Cntnr::hash_fn& r_t = @@ -97,9 +97,9 @@ policy_access(pb_ds::basic_hash_tag) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_access(pb_ds::cc_hash_tag) +policy_access(__gnu_pbds::cc_hash_tag) { - policy_access(pb_ds::basic_hash_tag()); + policy_access(__gnu_pbds::basic_hash_tag()); { typename Cntnr::comb_hash_fn& r_t = @@ -117,9 +117,9 @@ policy_access(pb_ds::cc_hash_tag) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_access(pb_ds::gp_hash_tag) +policy_access(__gnu_pbds::gp_hash_tag) { - policy_access(pb_ds::basic_hash_tag()); + policy_access(__gnu_pbds::basic_hash_tag()); { typename Cntnr::comb_probe_fn& r_t = @@ -149,7 +149,7 @@ policy_access(pb_ds::gp_hash_tag) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_access(pb_ds::tree_tag) +policy_access(__gnu_pbds::tree_tag) { { typename Cntnr::cmp_fn& r_t = @@ -168,13 +168,13 @@ policy_access(pb_ds::tree_tag) PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_access(pb_ds::list_update_tag) +policy_access(__gnu_pbds::list_update_tag) { } PB_DS_CLASS_T_DEC void PB_DS_CLASS_C_DEC:: -policy_access(pb_ds::pat_trie_tag) +policy_access(__gnu_pbds::pat_trie_tag) { typename Cntnr::e_access_traits& r_t = m_p_c->get_e_access_traits(); diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/resize_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/resize_fn_imps.hpp index 6f5ee79fdd4..77bfcb84c39 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/resize_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/resize_fn_imps.hpp @@ -49,7 +49,7 @@ bool PB_DS_CLASS_C_DEC:: resize() { - typedef pb_ds::detail::integral_constant<int, test_traits::resize> resize_ind; + typedef __gnu_pbds::detail::integral_constant<int, test_traits::resize> resize_ind; return (resize_imp(resize_ind())); } @@ -57,7 +57,7 @@ resize() PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -resize_imp(pb_ds::detail::false_type) +resize_imp(__gnu_pbds::detail::false_type) { return (true); } @@ -65,7 +65,7 @@ resize_imp(pb_ds::detail::false_type) PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -resize_imp(pb_ds::detail::true_type) +resize_imp(__gnu_pbds::detail::true_type) { PB_DS_TRACE("resize"); diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/split_join_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/split_join_fn_imps.hpp index 073fda5666b..8026d7cc200 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/split_join_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/split_join_fn_imps.hpp @@ -54,13 +54,13 @@ split_join() split_join = container_traits::order_preserving }; - return (split_join_imp(pb_ds::detail::integral_constant<int,split_join>())); + return (split_join_imp(__gnu_pbds::detail::integral_constant<int,split_join>())); } PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -split_join_imp(pb_ds::detail::false_type) +split_join_imp(__gnu_pbds::detail::false_type) { return (true); } @@ -68,7 +68,7 @@ split_join_imp(pb_ds::detail::false_type) PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -split_join_imp(pb_ds::detail::true_type) +split_join_imp(__gnu_pbds::detail::true_type) { PB_DS_TRACE("split_join"); diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/subscript_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/subscript_fn_imps.hpp index a2c59e12592..e627595d728 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/subscript_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/detail/subscript_fn_imps.hpp @@ -53,18 +53,18 @@ subscript() enum { - no_data = pb_ds::detail::is_same< + no_data = __gnu_pbds::detail::is_same< typename Cntnr::const_key_reference, typename Cntnr::const_reference>::value }; - return (subscript_imp(pb_ds::detail::integral_constant<int,no_data>())); + return (subscript_imp(__gnu_pbds::detail::integral_constant<int,no_data>())); } PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -subscript_imp(pb_ds::detail::false_type) +subscript_imp(__gnu_pbds::detail::false_type) { bool done = true; @@ -97,7 +97,7 @@ subscript_imp(pb_ds::detail::false_type) PB_DS_CLASS_T_DEC bool PB_DS_CLASS_C_DEC:: -subscript_imp(pb_ds::detail::true_type) +subscript_imp(__gnu_pbds::detail::true_type) { bool done = true; @@ -110,7 +110,7 @@ subscript_imp(pb_ds::detail::true_type) value_type v = test_traits::generate_value(m_g, m_m); m_alloc.set_throw_prob(m_tp); - (*m_p_c)[v] = pb_ds::null_mapped_type(); + (*m_p_c)[v] = __gnu_pbds::null_mapped_type(); m_native_c.insert(test_traits::native_value(v)); } diff --git a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp index 2081c7c8b2d..2f79df56dce 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp @@ -55,7 +55,7 @@ #include <regression/basic_type.hpp> #include <regression/assoc/common_type.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -123,7 +123,7 @@ namespace detail { detail::verify_params(sd, n, m, tp, ip, ep, cp, mp, disp); } - catch (pb_ds::test::illegal_input_error&) + catch (__gnu_pbds::test::illegal_input_error&) { detail::usage(name); return -1; @@ -205,6 +205,6 @@ namespace detail } } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/regression/rand/io/assoc/xml_formatter.hpp b/libstdc++-v3/testsuite/util/regression/rand/io/assoc/xml_formatter.hpp index d5e1f5ba3a4..db9ed28efb8 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/io/assoc/xml_formatter.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/io/assoc/xml_formatter.hpp @@ -49,7 +49,7 @@ #include <regression/rand/io/xml_formatter.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -76,6 +76,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_XML_TEST_REGRESSION_FORMATTER_HPP diff --git a/libstdc++-v3/testsuite/util/regression/rand/io/priority_queue/xml_formatter.hpp b/libstdc++-v3/testsuite/util/regression/rand/io/priority_queue/xml_formatter.hpp index a8ceab4d2ee..af6f5d242b9 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/io/priority_queue/xml_formatter.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/io/priority_queue/xml_formatter.hpp @@ -49,7 +49,7 @@ #include <regression/rand/io/xml_formatter.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -77,6 +77,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_XML_TEST_REGRESSION_FORMATTER_HPP diff --git a/libstdc++-v3/testsuite/util/regression/rand/io/xml_formatter.hpp b/libstdc++-v3/testsuite/util/regression/rand/io/xml_formatter.hpp index 6bc89976c58..7006618bd47 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/io/xml_formatter.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/io/xml_formatter.hpp @@ -51,7 +51,7 @@ #include <iostream> #include <io/xml_test_formatter.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -82,6 +82,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_COMMON_XML_TEST_REGRESSION_FORMATTER_HPP diff --git a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.hpp index 15ff02bba11..eeedc27bdca 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/container_rand_regression_test.hpp @@ -60,7 +60,7 @@ #include <regression/rand/io/priority_queue/xml_formatter.hpp> #include <regression/trait/priority_queue/trait.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -329,6 +329,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_CONTAINER_RAND_REGRESSION_TEST_HPP diff --git a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/detail/split_join_fn_imps.hpp b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/detail/split_join_fn_imps.hpp index 41c302718fe..b25394fa34d 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/detail/split_join_fn_imps.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/detail/split_join_fn_imps.hpp @@ -109,7 +109,7 @@ split_join() { done = false; - PB_DS_THROW_IF_FAILED( pb_ds::container_traits<cntnr>::split_join_can_throw, pb_ds::container_traits<cntnr>::split_join_can_throw, m_p_c, & m_native_c); + PB_DS_THROW_IF_FAILED( __gnu_pbds::container_traits<cntnr>::split_join_can_throw, __gnu_pbds::container_traits<cntnr>::split_join_can_throw, m_p_c, & m_native_c); } PB_DS_COND_COMPARE(*m_p_c, m_native_c); diff --git a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp index 0d4c960fb85..80f941a6db9 100644 --- a/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp +++ b/libstdc++-v3/testsuite/util/regression/rand/priority_queue/rand_regression_test.hpp @@ -55,7 +55,7 @@ #include <regression/basic_type.hpp> #include <regression/priority_queue/common_type.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -125,7 +125,7 @@ namespace detail { detail::verify_params(sd, n, m, tp, ip, dp, ep, cp, mp, disp); } - catch(pb_ds::test::illegal_input_error&) + catch(__gnu_pbds::test::illegal_input_error&) { detail::usage(name); return -1; @@ -209,6 +209,6 @@ namespace detail } } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/get_set_load_trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/get_set_load_trait.hpp index dac0c7f4719..a796b81b732 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/get_set_load_trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/get_set_load_trait.hpp @@ -50,7 +50,7 @@ #include <ext/pb_ds/assoc_container.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -80,14 +80,14 @@ namespace pb_ds template<typename Cntnr> struct regression_test_get_set_load_traits< Cntnr, - pb_ds::cc_hash_tag> : public regression_test_hash_get_set_load_traits< + __gnu_pbds::cc_hash_tag> : public regression_test_hash_get_set_load_traits< Cntnr> { }; template<typename Cntnr> struct regression_test_get_set_load_traits< Cntnr, - pb_ds::gp_hash_tag> : public regression_test_hash_get_set_load_traits< + __gnu_pbds::gp_hash_tag> : public regression_test_hash_get_set_load_traits< Cntnr> { }; @@ -95,6 +95,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_REGRESSION_TEST_SET_LOAD_TRAIT_HPP diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/get_set_loads_trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/get_set_loads_trait.hpp index 17c872ee83e..389ad6467fe 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/get_set_loads_trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/get_set_loads_trait.hpp @@ -50,7 +50,7 @@ #include <ext/pb_ds/assoc_container.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -80,14 +80,14 @@ namespace pb_ds template<typename Cntnr> struct regression_test_get_set_loacontainer_traits< Cntnr, - pb_ds::cc_hash_tag> : public regression_test_hash_get_set_loacontainer_traits< + __gnu_pbds::cc_hash_tag> : public regression_test_hash_get_set_loacontainer_traits< Cntnr> { }; template<typename Cntnr> struct regression_test_get_set_loacontainer_traits< Cntnr, - pb_ds::gp_hash_tag> : public regression_test_hash_get_set_loacontainer_traits< + __gnu_pbds::gp_hash_tag> : public regression_test_hash_get_set_loacontainer_traits< Cntnr> { }; @@ -95,6 +95,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_REGRESSION_TEST_SET_LOADS_TRAIT_HPP diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/native_type_trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/native_type_trait.hpp index 1c65c6c81f8..d70c88339dd 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/native_type_trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/native_type_trait.hpp @@ -48,7 +48,7 @@ #ifndef PB_DS_REGRESSION_TEST_NATIVE_TYPE_TRAIT_HPP #define PB_DS_REGRESSION_TEST_NATIVE_TYPE_TRAIT_HPP -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -133,7 +133,7 @@ namespace pb_ds struct native_type_traits_base< Native_Key_Type, Key_Type, - pb_ds::null_mapped_type, + __gnu_pbds::null_mapped_type, Allocator> { public: @@ -190,6 +190,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_REGRESSION_TEST_NATIVE_TYPE_TRAIT_HPP diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/node_update_trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/node_update_trait.hpp index 9f235116ecb..ff3004279f4 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/node_update_trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/node_update_trait.hpp @@ -53,7 +53,7 @@ #include <common_type/assoc/detail/trie_supports_order_statistics.hpp> #include <common_type/assoc/detail/trie_supports_prefix_search.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -75,7 +75,7 @@ namespace pb_ds template<typename Cntnr> struct regression_test_node_update_traits< Cntnr, - pb_ds::pat_trie_tag> + __gnu_pbds::pat_trie_tag> { enum { @@ -89,7 +89,7 @@ namespace pb_ds template<typename Cntnr> struct regression_test_node_update_traits< Cntnr, - pb_ds::rb_tree_tag> + __gnu_pbds::rb_tree_tag> { enum { @@ -102,7 +102,7 @@ namespace pb_ds template<typename Cntnr> struct regression_test_node_update_traits< Cntnr, - pb_ds::splay_tree_tag> + __gnu_pbds::splay_tree_tag> { enum { @@ -115,7 +115,7 @@ namespace pb_ds template<typename Cntnr> struct regression_test_node_update_traits< Cntnr, - pb_ds::ov_tree_tag> + __gnu_pbds::ov_tree_tag> { enum { @@ -129,6 +129,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_REGRESSION_TEST_NODE_UPDATOR_TRAIT_HPP diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/resize_trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/resize_trait.hpp index 24ee05b15c5..932a0ccbc1a 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/resize_trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/resize_trait.hpp @@ -50,7 +50,7 @@ #include <ext/pb_ds/assoc_container.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -80,14 +80,14 @@ namespace pb_ds template<typename Cntnr> struct regression_test_resize_traits< Cntnr, - pb_ds::cc_hash_tag> : public regression_test_hash_resize_traits< + __gnu_pbds::cc_hash_tag> : public regression_test_hash_resize_traits< Cntnr> { }; template<typename Cntnr> struct regression_test_resize_traits< Cntnr, - pb_ds::gp_hash_tag> : public regression_test_hash_resize_traits< + __gnu_pbds::gp_hash_tag> : public regression_test_hash_resize_traits< Cntnr> { }; @@ -95,6 +95,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_REGRESSION_TEST_RESIZE_TRAIT_HPP diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/to_string.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/to_string.hpp index d07b330cadb..a0ba69388a2 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/to_string.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/to_string.hpp @@ -50,7 +50,7 @@ #include <regression/basic_type.hpp> #include <string> -namespace pb_ds +namespace __gnu_pbds { namespace test @@ -86,6 +86,6 @@ namespace pb_ds } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_REGRESSION_TEST_TO_STRING_HPP diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp index 9f571107df0..e8791a4472a 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/trait.hpp @@ -57,7 +57,7 @@ #include <regression/trait/assoc/node_update_trait.hpp> #include <regression/trait/erase_if_fn.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -214,6 +214,6 @@ namespace detail } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp index df8b66fcbc8..5c0682de38f 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/assoc/type_trait.hpp @@ -50,7 +50,7 @@ #include <regression/basic_type.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -92,7 +92,7 @@ namespace pb_ds template<typename Gen> static value_type - generate_value(Gen& r_gen, size_t max, pb_ds::null_mapped_type) + generate_value(Gen& r_gen, size_t max, __gnu_pbds::null_mapped_type) { return basic_type(r_gen, max); } template<typename Gen> @@ -116,6 +116,6 @@ namespace pb_ds }; } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/regression/trait/erase_if_fn.hpp b/libstdc++-v3/testsuite/util/regression/trait/erase_if_fn.hpp index c583848c630..41618a6843e 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/erase_if_fn.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/erase_if_fn.hpp @@ -50,7 +50,7 @@ #include <functional> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -90,6 +90,6 @@ namespace pb_ds }; } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/regression/trait/priority_queue/trait.hpp b/libstdc++-v3/testsuite/util/regression/trait/priority_queue/trait.hpp index 641d9295cfb..f2875105649 100644 --- a/libstdc++-v3/testsuite/util/regression/trait/priority_queue/trait.hpp +++ b/libstdc++-v3/testsuite/util/regression/trait/priority_queue/trait.hpp @@ -50,7 +50,7 @@ #include <regression/trait/erase_if_fn.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -61,7 +61,7 @@ namespace pb_ds { typedef typename Cntnr::value_type value_type; typedef typename Cntnr::const_reference const_reference; - typedef pb_ds::test::native_priority_queue<std::string, true> native_type; + typedef __gnu_pbds::test::native_priority_queue<std::string, true> native_type; typedef typename native_type::value_type native_value_type; template<typename T> @@ -87,6 +87,6 @@ namespace pb_ds }; } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/rng/twister_rand_gen.cc b/libstdc++-v3/testsuite/util/rng/twister_rand_gen.cc index fbe7e8add95..a0c74586a41 100644 --- a/libstdc++-v3/testsuite/util/rng/twister_rand_gen.cc +++ b/libstdc++-v3/testsuite/util/rng/twister_rand_gen.cc @@ -47,7 +47,7 @@ #include <debug/debug.h> #include <util/rng/twister_rand_gen.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -92,4 +92,4 @@ namespace pb_ds return ret; } } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds diff --git a/libstdc++-v3/testsuite/util/rng/twister_rand_gen.hpp b/libstdc++-v3/testsuite/util/rng/twister_rand_gen.hpp index cbc8d1473b7..0088dac76f7 100644 --- a/libstdc++-v3/testsuite/util/rng/twister_rand_gen.hpp +++ b/libstdc++-v3/testsuite/util/rng/twister_rand_gen.hpp @@ -50,7 +50,7 @@ #include <limits.h> #include <tr1/random> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -81,6 +81,6 @@ namespace pb_ds base_generator_t m_base_generator; }; } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif // #ifndef PB_DS_TWISTER_RAND_GEN_HPP diff --git a/libstdc++-v3/testsuite/util/statistic/result_recorder.hpp b/libstdc++-v3/testsuite/util/statistic/result_recorder.hpp index 2f8eaa5ccd2..438fd845311 100644 --- a/libstdc++-v3/testsuite/util/statistic/result_recorder.hpp +++ b/libstdc++-v3/testsuite/util/statistic/result_recorder.hpp @@ -51,7 +51,7 @@ #include <statistic/sample_variance.hpp> #include <statistic/sample_mean_confidence_checker.hpp> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -102,7 +102,7 @@ namespace pb_ds } } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/statistic/sample_mean.hpp b/libstdc++-v3/testsuite/util/statistic/sample_mean.hpp index 4c6c5613540..98a7784ceff 100644 --- a/libstdc++-v3/testsuite/util/statistic/sample_mean.hpp +++ b/libstdc++-v3/testsuite/util/statistic/sample_mean.hpp @@ -52,7 +52,7 @@ #include <math.h> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -73,7 +73,7 @@ namespace pb_ds } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/statistic/sample_mean_confidence_checker.hpp b/libstdc++-v3/testsuite/util/statistic/sample_mean_confidence_checker.hpp index 074adc961e5..837fd665f0d 100644 --- a/libstdc++-v3/testsuite/util/statistic/sample_mean_confidence_checker.hpp +++ b/libstdc++-v3/testsuite/util/statistic/sample_mean_confidence_checker.hpp @@ -51,7 +51,7 @@ #include <numeric> #include <math.h> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -88,7 +88,7 @@ namespace pb_ds } } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/statistic/sample_variance.hpp b/libstdc++-v3/testsuite/util/statistic/sample_variance.hpp index c2f87407c38..3d7d422c835 100644 --- a/libstdc++-v3/testsuite/util/statistic/sample_variance.hpp +++ b/libstdc++-v3/testsuite/util/statistic/sample_variance.hpp @@ -52,7 +52,7 @@ #include <math.h> #include <iterator> -namespace pb_ds +namespace __gnu_pbds { namespace test { @@ -85,7 +85,7 @@ namespace pb_ds } // namespace detail } // namespace test -} // namespace pb_ds +} // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.cc b/libstdc++-v3/testsuite/util/testsuite_abi.cc index 44e10ac4ba0..cec3ae2f3f9 100644 --- a/libstdc++-v3/testsuite/util/testsuite_abi.cc +++ b/libstdc++-v3/testsuite/util/testsuite_abi.cc @@ -30,10 +30,12 @@ // Benjamin Kosnik <bkoz@redhat.com> #include "testsuite_abi.h" +#include <cstdlib> #include <sstream> #include <fstream> #include <iostream> -#include <cstdlib> +#include <vector> +#include <algorithm> using namespace std; diff --git a/libstdc++-v3/testsuite/util/testsuite_abi.h b/libstdc++-v3/testsuite/util/testsuite_abi.h index 89825a875ab..a659ef4a742 100644 --- a/libstdc++-v3/testsuite/util/testsuite_abi.h +++ b/libstdc++-v3/testsuite/util/testsuite_abi.h @@ -33,7 +33,7 @@ #include <stdexcept> #include <deque> #include <locale> -#include <ext/hash_map> +#include <tr1/unordered_map> #include <cxxabi.h> // Encapsulates symbol characteristics. @@ -75,7 +75,7 @@ struct symbol init(std::string& data); }; -typedef __gnu_cxx::hash_map<std::string, symbol> symbol_objects; +typedef std::tr1::unordered_map<std::string, symbol> symbol_objects; typedef std::deque<std::string> symbol_names; @@ -110,20 +110,3 @@ create_symbols(const char* file); const char* demangle(const std::string& mangled); - - -// Specialization. -namespace __gnu_cxx -{ - using namespace std; - - template<> - struct hash<string> - { - size_t operator()(const string& s) const - { - const collate<char>& c = use_facet<collate<char> >(locale::classic()); - return c.hash(s.c_str(), s.c_str() + s.size()); - } - }; -} diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.cc b/libstdc++-v3/testsuite/util/testsuite_allocator.cc index fdaa647e6fd..8cb95ae8191 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.cc +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.cc @@ -61,5 +61,5 @@ namespace __gnu_test } return ret; } -}; // namespace __cxx_test +} // namespace __cxx_test diff --git a/libstdc++-v3/testsuite/util/testsuite_allocator.h b/libstdc++-v3/testsuite/util/testsuite_allocator.h index d6108cc6064..6411568c26d 100644 --- a/libstdc++-v3/testsuite/util/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/util/testsuite_allocator.h @@ -39,12 +39,13 @@ #include <cstddef> #include <tr1/unordered_map> #include <cassert> +#include <bits/stl_move.h> namespace { bool new_called = false; bool delete_called = false; -}; +} namespace __gnu_test { @@ -153,10 +154,20 @@ namespace __gnu_test void construct(pointer p, const T& value) { - new (p) T(value); + ::new ((void *)p) T(value); counter_type::construct(); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename... Args> + void + construct(pointer p, Args&&... args) + { + ::new((void *)p) T(std::forward<Args>(args)...); + counter_type::construct(); + } +#endif + void destroy(pointer p) { @@ -338,8 +349,15 @@ namespace __gnu_test void construct(pointer p, const Tp& val) - { ::new(p) Tp(val); } - + { ::new((void *)p) Tp(val); } + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<typename... Args> + void + construct(pointer p, Args&&... args) + { ::new((void *)p) Tp(std::forward<Args>(args)...); } +#endif + void destroy(pointer p) { p->~Tp(); } @@ -365,6 +383,6 @@ namespace __gnu_test int personality; }; -}; // namespace __gnu_test +} // namespace __gnu_test #endif // _GLIBCXX_TESTSUITE_ALLOCATOR_H diff --git a/libstdc++-v3/testsuite/util/testsuite_api.h b/libstdc++-v3/testsuite/util/testsuite_api.h index 143ac67eff6..658e2ad168c 100644 --- a/libstdc++-v3/testsuite/util/testsuite_api.h +++ b/libstdc++-v3/testsuite/util/testsuite_api.h @@ -28,10 +28,11 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. +#include <exception> #include <testsuite_hooks.h> -#ifndef _TESTSUITE_EH -#define _TESTSUITE_EH 1 +#ifndef _TESTSUITE_API +#define _TESTSUITE_API 1 namespace __gnu_test { @@ -77,5 +78,61 @@ namespace __gnu_test { VERIFY( false ); } } }; + + // Testing type requirements for template arguments. + struct NonDefaultConstructible + { + NonDefaultConstructible(int) { } + NonDefaultConstructible(const NonDefaultConstructible&) { } + }; + + // See: 20.1.1 Template argument requirements. + inline bool + operator==(const NonDefaultConstructible&, const NonDefaultConstructible&) + { return false; } + + inline bool + operator<(const NonDefaultConstructible&, const NonDefaultConstructible&) + { return false; } + + // For 26 numeric algorithms requirements, need addable, + // subtractable, multiplicable. + inline NonDefaultConstructible + operator+(const NonDefaultConstructible& lhs, + const NonDefaultConstructible& rhs) + { return NonDefaultConstructible(1); } + + inline NonDefaultConstructible + operator-(const NonDefaultConstructible& lhs, + const NonDefaultConstructible& rhs) + { return NonDefaultConstructible(1); } + + inline NonDefaultConstructible + operator*(const NonDefaultConstructible& lhs, + const NonDefaultConstructible& rhs) + { return NonDefaultConstructible(1); } + + // Like unary_function, but takes no argument. (ie, void). + // Used for generator template parameter. + template<typename _Result> + struct void_function + { + typedef _Result result_type; + + result_type + operator()() const + { return result_type(); } + }; + + template<> + struct void_function<NonDefaultConstructible> + { + typedef NonDefaultConstructible result_type; + + result_type + operator()() const + { return result_type(2); } + }; + } #endif diff --git a/libstdc++-v3/testsuite/util/testsuite_character.h b/libstdc++-v3/testsuite/util/testsuite_character.h index 547775bd886..e9dde65c2f3 100644 --- a/libstdc++-v3/testsuite/util/testsuite_character.h +++ b/libstdc++-v3/testsuite/util/testsuite_character.h @@ -46,6 +46,8 @@ namespace __gnu_test int value; }; + // For 20.1 requirements for instantiable type: equality comparable + // and less than comparable. inline bool operator==(const pod_int& lhs, const pod_int& rhs) { return lhs.value == rhs.value; } @@ -54,6 +56,29 @@ namespace __gnu_test operator<(const pod_int& lhs, const pod_int& rhs) { return lhs.value < rhs.value; } + // For 26 numeric algorithms requirements, need addable, + // subtractable, multiplicable. + inline pod_int + operator+(const pod_int& lhs, const pod_int& rhs) + { + pod_int ret = { lhs.value + rhs.value }; + return ret; + } + + inline pod_int + operator-(const pod_int& lhs, const pod_int& rhs) + { + pod_int ret = { lhs.value - rhs.value }; + return ret; + } + + inline pod_int + operator*(const pod_int& lhs, const pod_int& rhs) + { + pod_int ret = { lhs.value * rhs.value }; + return ret; + } + struct pod_state { unsigned long value; @@ -112,7 +137,7 @@ namespace __gnu_cxx inline V2 __gnu_test::pod_uchar::char_type::to(const char_type& c) { return static_cast<V2>(c.value << 5); } -}; // namespace __gnu_test +} // namespace __gnu_test namespace std { diff --git a/libstdc++-v3/testsuite/util/testsuite_common_types.h b/libstdc++-v3/testsuite/util/testsuite_common_types.h index bcb36e71f0f..78fe1fe7fca 100644 --- a/libstdc++-v3/testsuite/util/testsuite_common_types.h +++ b/libstdc++-v3/testsuite/util/testsuite_common_types.h @@ -1,7 +1,7 @@ // -*- C++ -*- // typelist for the C++ library testsuite. // -// Copyright (C) 2005 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2007, 2008 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 @@ -40,6 +40,8 @@ #include <ext/bitmap_allocator.h> #include <ext/pool_allocator.h> +#include <algorithm> + #include <vector> #include <list> #include <deque> @@ -47,8 +49,7 @@ #include <map> #include <set> -#include <ext/hash_map> -#include <ext/hash_set> +#include <tr1/functional> #include <tr1/unordered_map> #include <tr1/unordered_set> @@ -160,7 +161,7 @@ namespace __gnu_test typedef typename append<a1, a2>::type type; }; - // Typelists for map, set, hash_map, hash_set, unordered_set, unordered_map. + // Typelists for map, set, unordered_set, unordered_map. template<typename Tp, bool Thread> struct maps { @@ -182,26 +183,6 @@ namespace __gnu_test }; template<typename Tp, bool Thread> - struct hash_maps - { - typedef Tp value_type; - typedef Tp key_type; - typedef __gnu_cxx::hash<key_type> hash_function; - typedef std::equal_to<key_type> equality_function; - - template<typename Tl> - struct container - { - typedef Tl allocator_type; - typedef __gnu_cxx::hash_map<key_type, value_type, hash_function, equality_function, allocator_type> type; - }; - - typedef allocator_policies<value_type, Thread> allocator_types; - typedef typename allocator_types::type allocator_typelist; - typedef typename transform<allocator_typelist, container>::type type; - }; - - template<typename Tp, bool Thread> struct unordered_maps { typedef Tp value_type; @@ -242,26 +223,6 @@ namespace __gnu_test }; template<typename Tp, bool Thread> - struct hash_sets - { - typedef Tp value_type; - typedef Tp key_type; - typedef __gnu_cxx::hash<key_type> hash_function; - typedef std::equal_to<key_type> equality_function; - - template<typename Tl> - struct container - { - typedef Tl allocator_type; - typedef __gnu_cxx::hash_set<key_type, hash_function, equality_function, allocator_type> type; - }; - - typedef allocator_policies<key_type, Thread> allocator_types; - typedef typename allocator_types::type allocator_typelist; - typedef typename transform<allocator_typelist, container>::type type; - }; - - template<typename Tp, bool Thread> struct unordered_sets { typedef Tp value_type; @@ -291,16 +252,12 @@ namespace __gnu_test typedef typename maps<value_type, Thread>::type map_typelist; typedef typename sets<value_type, Thread>::type set_typelist; - typedef typename hash_maps<value_type, Thread>::type hash_map_typelist; - typedef typename hash_sets<value_type, Thread>::type hash_set_typelist; typedef typename unordered_maps<value_type, Thread>::type unordered_map_typelist; typedef typename unordered_sets<value_type, Thread>::type unordered_set_typelist; - typedef typename append<map_typelist, hash_map_typelist>::type a1; - typedef typename append<a1, unordered_map_typelist>::type a2; - typedef typename append<set_typelist, hash_set_typelist>::type a3; - typedef typename append<a3, unordered_set_typelist>::type a4; - typedef typename append<a2, a4>::type type; + typedef typename append<map_typelist, unordered_map_typelist>::type a1; + typedef typename append<set_typelist, unordered_set_typelist>::type a2; + typedef typename append<a1, a2>::type type; }; } // namespace __gnu_test diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.cc b/libstdc++-v3/testsuite/util/testsuite_hooks.cc index 6ea82f3d908..35ac5b2836f 100644 --- a/libstdc++-v3/testsuite/util/testsuite_hooks.cc +++ b/libstdc++-v3/testsuite/util/testsuite_hooks.cc @@ -92,17 +92,17 @@ namespace __gnu_test setrlimit(RLIMIT_VMEM, &r); #endif - // Virtual memory. - // On x86_64-linux, the default is -z max-page-size=0x200000 - // which means up to 2MB of address space are accounted for - // PROT_NONE mappings between text and data segments of - // each shared library. There are 4 shared libs involved - // in addition to the dynamic linker. Use at least 16MB address space - // limit. + // Virtual memory. On x86_64-linux, the default is -z + // max-page-size=0x200000 which means up to 2MB of address space + // are accounted for PROT_NONE mappings between text and data + // segments of each shared library. There are 4 shared libs + // involved in addition to the dynamic linker, maybe 5 if libgomp + // is being used as well. Use at least 20MB address space limit. #if defined(__x86_64__) && defined(__linux__) - if (limit < 16777216) - limit = 16777216; + if (limit < 20971520) + limit = 20971520; #endif + // On HP-UX 11.23, a trivial C++ program that sets RLIMIT_AS to // anything less than 128MB cannot "malloc" even 1K of memory. // Therefore, we skip RLIMIT_AS on HP-UX. @@ -173,7 +173,6 @@ namespace __gnu_test run_tests_wrapped_locale(const char* name, const func_callback& l) { using namespace std; - bool test = true; // Set the global locale. locale loc_name = locale(name); @@ -202,7 +201,6 @@ namespace __gnu_test const func_callback& l) { using namespace std; - bool test = true; #ifdef _GLIBCXX_HAVE_SETENV // Set the global locale. @@ -334,4 +332,4 @@ namespace __gnu_test tmp.tm_isdst = isdst; return tmp; } -}; // namespace __gnu_test +} // namespace __gnu_test diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.h b/libstdc++-v3/testsuite/util/testsuite_hooks.h index d92eef1500c..cbd876d61fe 100644 --- a/libstdc++-v3/testsuite/util/testsuite_hooks.h +++ b/libstdc++-v3/testsuite/util/testsuite_hooks.h @@ -159,24 +159,6 @@ namespace __gnu_test void run_tests_wrapped_env(const char*, const char*, const func_callback&); - - // For containers (23.1/3). - struct NonDefaultConstructible - { - NonDefaultConstructible(int) { } - }; - - inline bool - operator==(const NonDefaultConstructible&, - const NonDefaultConstructible&) - { return false; } - - inline bool - operator<(const NonDefaultConstructible&, - const NonDefaultConstructible&) - { return false; } - - // Counting. struct counter { diff --git a/libstdc++-v3/testsuite/util/testsuite_io.h b/libstdc++-v3/testsuite/util/testsuite_io.h index 2dc3caded63..d370bb0f921 100644 --- a/libstdc++-v3/testsuite/util/testsuite_io.h +++ b/libstdc++-v3/testsuite/util/testsuite_io.h @@ -321,7 +321,7 @@ namespace __gnu_test #ifdef _GLIBCXX_USE_WCHAR_T typedef fail_num_put<wchar_t> fail_num_put_wchar_t; #endif -}; // namespace __gnu_test +} // namespace __gnu_test #endif // _GLIBCXX_TESTSUITE_IO_H diff --git a/libstdc++-v3/testsuite/util/testsuite_iterators.h b/libstdc++-v3/testsuite/util/testsuite_iterators.h index 073be0beb94..7a124196137 100644 --- a/libstdc++-v3/testsuite/util/testsuite_iterators.h +++ b/libstdc++-v3/testsuite/util/testsuite_iterators.h @@ -38,6 +38,7 @@ #include <testsuite_hooks.h> #include <bits/stl_iterator_base_types.h> +#include <bits/stl_move.h> #ifndef _TESTSUITE_ITERATORS #define _TESTSUITE_ITERATORS @@ -61,8 +62,7 @@ namespace __gnu_test { T* first; T* last; - BoundsContainer(T* _first, T* _last) - : first(_first), last(_last) + BoundsContainer(T* _first, T* _last) : first(_first), last(_last) { } }; @@ -73,7 +73,7 @@ namespace __gnu_test T* incrementedto; bool* writtento; OutputContainer(T* _first, T* _last) - : BoundsContainer<T>(_first, _last), incrementedto(_first) + : BoundsContainer<T>(_first, _last), incrementedto(_first) { writtento = new bool[this->last - this->first]; for(int i = 0; i < this->last - this->first; i++) @@ -104,6 +104,17 @@ namespace __gnu_test SharedInfo->writtento[ptr - SharedInfo->first] = 1; *ptr = new_val; } + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + template<class U> + void + operator=(U&& new_val) + { + ITERATOR_VERIFY(SharedInfo->writtento[ptr - SharedInfo->first] == 0); + SharedInfo->writtento[ptr - SharedInfo->first] = 1; + *ptr = std::move(new_val); + } +#endif }; /** @@ -114,21 +125,21 @@ namespace __gnu_test * instansiated directly, but generated from a test_container */ template<class T> - struct output_iterator_wrapper: public std::iterator - <std::output_iterator_tag, T, ptrdiff_t, T*, T&> + struct output_iterator_wrapper + : public std::iterator<std::output_iterator_tag, T, ptrdiff_t, T*, T&> { typedef OutputContainer<T> ContainerType; T* ptr; ContainerType* SharedInfo; output_iterator_wrapper(T* _ptr, ContainerType* SharedInfo_in) - :ptr(_ptr), SharedInfo(SharedInfo_in) + : ptr(_ptr), SharedInfo(SharedInfo_in) { ITERATOR_VERIFY(ptr >= SharedInfo->first && ptr <= SharedInfo->last); } output_iterator_wrapper(const output_iterator_wrapper& in) - :ptr(in.ptr), SharedInfo(in.SharedInfo) + : ptr(in.ptr), SharedInfo(in.SharedInfo) { } WritableObject<T> @@ -175,8 +186,8 @@ namespace __gnu_test * instansiated directly, but generated from a test_container */ template<class T> - class input_iterator_wrapper:public std::iterator - <std::input_iterator_tag, T, ptrdiff_t, T*, T&> + class input_iterator_wrapper + : public std::iterator<std::input_iterator_tag, T, ptrdiff_t, T*, T&> { protected: input_iterator_wrapper() @@ -188,11 +199,11 @@ namespace __gnu_test ContainerType* SharedInfo; input_iterator_wrapper(T* _ptr, ContainerType* SharedInfo_in) - : ptr(_ptr), SharedInfo(SharedInfo_in) + : ptr(_ptr), SharedInfo(SharedInfo_in) { ITERATOR_VERIFY(ptr >= SharedInfo->first && ptr <= SharedInfo->last); } input_iterator_wrapper(const input_iterator_wrapper& in) - : ptr(in.ptr), SharedInfo(in.SharedInfo) + : ptr(in.ptr), SharedInfo(in.SharedInfo) { } bool @@ -257,16 +268,16 @@ namespace __gnu_test * instansiated directly, but generated from a test_container */ template<class T> - struct forward_iterator_wrapper:public input_iterator_wrapper<T> + struct forward_iterator_wrapper : public input_iterator_wrapper<T> { typedef BoundsContainer<T> ContainerType; typedef std::forward_iterator_tag iterator_category; forward_iterator_wrapper(T* _ptr, ContainerType* SharedInfo_in) - :input_iterator_wrapper<T>(_ptr, SharedInfo_in) + : input_iterator_wrapper<T>(_ptr, SharedInfo_in) { } forward_iterator_wrapper(const forward_iterator_wrapper& in) - :input_iterator_wrapper<T>(in) + : input_iterator_wrapper<T>(in) { } forward_iterator_wrapper() @@ -311,16 +322,16 @@ namespace __gnu_test * instansiated directly, but generated from a test_container */ template<class T> - struct bidirectional_iterator_wrapper:public forward_iterator_wrapper<T> + struct bidirectional_iterator_wrapper : public forward_iterator_wrapper<T> { typedef BoundsContainer<T> ContainerType; typedef std::bidirectional_iterator_tag iterator_category; bidirectional_iterator_wrapper(T* _ptr, ContainerType* SharedInfo_in) - :forward_iterator_wrapper<T>(_ptr, SharedInfo_in) + : forward_iterator_wrapper<T>(_ptr, SharedInfo_in) { } bidirectional_iterator_wrapper(const bidirectional_iterator_wrapper& in) - :forward_iterator_wrapper<T>(in) + : forward_iterator_wrapper<T>(in) { } bidirectional_iterator_wrapper(): forward_iterator_wrapper<T>() @@ -375,16 +386,17 @@ namespace __gnu_test * instansiated directly, but generated from a test_container */ template<class T> - struct random_access_iterator_wrapper:public bidirectional_iterator_wrapper<T> + struct random_access_iterator_wrapper + : public bidirectional_iterator_wrapper<T> { typedef BoundsContainer<T> ContainerType; typedef std::random_access_iterator_tag iterator_category; random_access_iterator_wrapper(T* _ptr, ContainerType* SharedInfo_in) - : bidirectional_iterator_wrapper<T>(_ptr, SharedInfo_in) + : bidirectional_iterator_wrapper<T>(_ptr, SharedInfo_in) { } random_access_iterator_wrapper(const random_access_iterator_wrapper<T>& in) - : bidirectional_iterator_wrapper<T>(in) + : bidirectional_iterator_wrapper<T>(in) { } random_access_iterator_wrapper():bidirectional_iterator_wrapper<T>() diff --git a/libstdc++-v3/testsuite/util/testsuite_performance.h b/libstdc++-v3/testsuite/util/testsuite_performance.h index 7557dfe3b09..ad873ed6d23 100644 --- a/libstdc++-v3/testsuite/util/testsuite_performance.h +++ b/libstdc++-v3/testsuite/util/testsuite_performance.h @@ -258,7 +258,7 @@ namespace __gnu_test out << std::endl; out.close(); } -}; // namespace __gnu_test +} // namespace __gnu_test #endif // _GLIBCXX_PERFORMANCE_H diff --git a/libstdc++-v3/testsuite/util/testsuite_rvalref.h b/libstdc++-v3/testsuite/util/testsuite_rvalref.h new file mode 100644 index 00000000000..55d0e41654f --- /dev/null +++ b/libstdc++-v3/testsuite/util/testsuite_rvalref.h @@ -0,0 +1,197 @@ +// -*- C++ -*- +// Testing utilities for the rvalue reference. +// +// Copyright (C) 2005, 2007 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 2, 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 COPYING. If not, write to the Free +// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +// USA. +// +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#ifndef _GLIBCXX_TESTSUITE_RVALREF_H +#define _GLIBCXX_TESTSUITE_RVALREF_H 1 + +#include <testsuite_hooks.h> + +namespace __gnu_test +{ + + // This class is designed to test libstdc++'s template-based rvalue + // reference support. It should fail at compile-time if there is an attempt + // to copy it (although see note just below). + class rvalstruct + { + bool + operator=(const rvalstruct&); + +// Normally we don't define a copy constructor, as any use of it would +// show an inefficency. In some cases we know it will be aliased away +// by the compiler, but it still insists it is defined, so we provide +// a way of making it public but not giving a body, so any usage would +// instead fail at link-time. +#ifdef _GLIBCXX_TESTSUITE_ALLOW_RVALREF_ALIASING + public: + rvalstruct(const rvalstruct&); +#else + rvalstruct(const rvalstruct&); + + public: +#endif + int val; + bool valid; + + rvalstruct() : valid(false) + { } + + rvalstruct(int inval) : val(inval), valid(true) + { } + + rvalstruct& + operator=(int newval) + { + VERIFY(valid == false); + val = newval; + valid = true; + return *this; + } + + rvalstruct(rvalstruct&& in) + { + VERIFY(in.valid == true); + val = in.val; + in.valid = false; + valid = true; + } + + rvalstruct& + operator=(rvalstruct&& in) + { + VERIFY(in.valid == true); + val = in.val; + in.valid = false; + valid = true; + return *this; + } + }; + + bool + operator==(const rvalstruct& lhs, const rvalstruct& rhs) + { return lhs.val == rhs.val; } + + bool + operator<(const rvalstruct& lhs, const rvalstruct& rhs) + { return lhs.val < rhs.val; } + + void + swap(rvalstruct& lhs, rvalstruct& rhs) + { + VERIFY(lhs.valid && rhs.valid); + int temp = lhs.val; + lhs.val = rhs.val; + rhs.val = temp; + } + + // This is a moveable class which copies how many times it is copied. + // This is mainly of use in the containers, where the an element inserted + // into a container has to be copied once to get there, but we want to check + // nothing else is copied. + struct copycounter + { + static int copycount; + int val; + bool valid; + + copycounter() : val(0), valid(true) + { } + + copycounter(int inval) : val(inval), valid(true) + { } + + copycounter(const copycounter& in) : val(in.val), valid(true) + { + VERIFY(in.valid == true); + ++copycount; + } + + copycounter(copycounter&& in) + { + VERIFY(in.valid == true); + val = in.val; + in.valid = false; + valid = true; + } + + copycounter& + operator=(int newval) + { + val = newval; + valid = true; + return *this; + } + + bool + operator=(const copycounter& in) + { + VERIFY(in.valid == true); + ++copycount; + val = in.val; + valid = true; + return true; + } + + copycounter& + operator=(copycounter&& in) + { + VERIFY(in.valid == true); + val = in.val; + in.valid = false; + valid = true; + return *this; + } + + ~copycounter() + { valid = false; } + }; + + int copycounter::copycount = 0; + + bool + operator==(const copycounter& lhs, const copycounter& rhs) + { return lhs.val == rhs.val; } + + bool + operator<(const copycounter& lhs, const copycounter& rhs) + { return lhs.val < rhs.val; } + + void + swap(copycounter& lhs, copycounter& rhs) + { + VERIFY(lhs.valid && rhs.valid); + int temp = lhs.val; + lhs.val = rhs.val; + rhs.val = temp; + } + +} // namespace __gnu_test + +#endif // _GLIBCXX_TESTSUITE_TR1_H |