From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../testsuite/ext/mt_allocator/22309_thread.cc | 99 ++++++++++++++++++ .../mt_allocator/check_allocate_big_per_type.cc | 54 ++++++++++ .../ext/mt_allocator/check_allocate_max_size.cc | 30 ++++++ .../ext/mt_allocator/check_deallocate_null.cc | 33 ++++++ .../mt_allocator/check_deallocate_null_thread.cc | 33 ++++++ .../testsuite/ext/mt_allocator/check_delete.cc | 31 ++++++ .../testsuite/ext/mt_allocator/check_new.cc | 32 ++++++ .../ext/mt_allocator/deallocate_global-2.cc | 46 +++++++++ .../ext/mt_allocator/deallocate_global-4.cc | 46 +++++++++ .../ext/mt_allocator/deallocate_global_thread-1.cc | 46 +++++++++ .../ext/mt_allocator/deallocate_global_thread-3.cc | 46 +++++++++ .../ext/mt_allocator/deallocate_local-2.cc | 43 ++++++++ .../ext/mt_allocator/deallocate_local-4.cc | 44 ++++++++ .../ext/mt_allocator/deallocate_local-6.cc | 55 ++++++++++ .../ext/mt_allocator/deallocate_local-8.cc | 56 +++++++++++ .../ext/mt_allocator/deallocate_local_thread-1.cc | 43 ++++++++ .../ext/mt_allocator/deallocate_local_thread-3.cc | 44 ++++++++ .../ext/mt_allocator/deallocate_local_thread-5.cc | 54 ++++++++++ .../ext/mt_allocator/deallocate_local_thread-7.cc | 56 +++++++++++ .../ext/mt_allocator/explicit_instantiation.cc | 34 +++++++ libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc | 70 +++++++++++++ libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc | 72 +++++++++++++ libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc | 94 +++++++++++++++++ libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc | 111 +++++++++++++++++++++ .../ext/mt_allocator/variadic_construct.cc | 45 +++++++++ 25 files changed, 1317 insertions(+) create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/22309_thread.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_big_per_type.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_max_size.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null_thread.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/check_delete.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/check_new.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global-2.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global-4.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-1.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-2.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-4.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-6.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-8.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-1.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-3.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-5.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-7.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/explicit_instantiation.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc create mode 100644 libstdc++-v3/testsuite/ext/mt_allocator/variadic_construct.cc (limited to 'libstdc++-v3/testsuite/ext/mt_allocator') diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/22309_thread.cc b/libstdc++-v3/testsuite/ext/mt_allocator/22309_thread.cc new file mode 100644 index 000000000..609f188aa --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/22309_thread.cc @@ -0,0 +1,99 @@ +// { dg-require-sharedlib "" } +// { dg-options "-g -O2 -pthread -ldl" { target *-*-linux* } } + +// Copyright (C) 2004, 2005, 2009, 2010 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include +#include + +void +check_dlopen(void*& h) +{ + dlerror(); + void* tmp = dlopen("./testsuite_shared.so", RTLD_LAZY); + if (!tmp) + { + try + { + // Throws std::logic_error on NULL string. + std::string error(dlerror()); + throw std::runtime_error(error); + } + catch (const std::logic_error&) + { } + } + h = tmp; +} + +void +check_dlsym(void*& h) +{ + dlerror(); + + typedef void (*function_type) (void); + function_type fn; + fn = reinterpret_cast(dlsym(h, "try_allocation")); + + try + { + std::string error(dlerror()); + throw std::runtime_error(error); + } + catch (const std::logic_error&) + { } + + fn(); +} + +void +check_dlclose(void*& h) +{ + dlerror(); + if (dlclose(h) != 0) + { + try + { + std::string error(dlerror()); + throw std::runtime_error(error); + } + catch (const std::logic_error&) + { } + } +} + +void* +tf(void* arg) +{ + void* h; + check_dlopen(h); + check_dlsym(h); + check_dlclose(h); + return 0; +} + +// libstdc++/22309 +int +main (void) +{ + pthread_t th; + pthread_create(&th, 0, tf, 0); + pthread_join(th, 0); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_big_per_type.cc b/libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_big_per_type.cc new file mode 100644 index 000000000..eaea215a0 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_big_per_type.cc @@ -0,0 +1,54 @@ +// 2005-01-26 Paolo Carlini +// +// Copyright (C) 2005, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include +#include + +struct big { char array[256]; }; + +// __per_type_pool_policy +void test01() +{ + bool test __attribute__((unused)) = true; + + typedef big value_type; + + using __gnu_cxx::__pool; + using __gnu_cxx::__per_type_pool_policy; + +#ifdef __GTHREADS + typedef __per_type_pool_policy policy_type; +#else + typedef __per_type_pool_policy policy_type; +#endif + typedef __gnu_cxx::__mt_alloc allocator_type; + + allocator_type a; + allocator_type::pointer p1 = a.allocate(64); + std::memset((void*)p1, 0, sizeof(big) * 64); + a.deallocate(p1, 64); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_max_size.cc b/libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_max_size.cc new file mode 100644 index 000000000..9cde43b8e --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_max_size.cc @@ -0,0 +1,30 @@ +// +// Copyright (C) 2004, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include + +int main() +{ + typedef int value_type; + typedef __gnu_cxx::__mt_alloc allocator_type; + __gnu_test::check_allocate_max_size(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null.cc b/libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null.cc new file mode 100644 index 000000000..46d1d8548 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null.cc @@ -0,0 +1,33 @@ +// +// Copyright (C) 2004, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include + +int main() +{ + typedef int value_type; + using __gnu_cxx::__pool; + typedef __gnu_cxx::__common_pool_policy<__pool, false> policy_type; + typedef __gnu_cxx::__mt_alloc allocator_type; + __gnu_test::check_deallocate_null(); + return 0; +} + diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null_thread.cc b/libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null_thread.cc new file mode 100644 index 000000000..94000ab98 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/check_deallocate_null_thread.cc @@ -0,0 +1,33 @@ +// +// Copyright (C) 2004, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include + +int main() +{ + typedef int value_type; + using __gnu_cxx::__pool; + typedef __gnu_cxx::__common_pool_policy<__pool, true> policy_type; + typedef __gnu_cxx::__mt_alloc allocator_type; + __gnu_test::check_deallocate_null(); + return 0; +} + diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/check_delete.cc b/libstdc++-v3/testsuite/ext/mt_allocator/check_delete.cc new file mode 100644 index 000000000..374c56706 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/check_delete.cc @@ -0,0 +1,31 @@ +// 2001-11-25 Phil Edwards +// +// Copyright (C) 2001, 2003, 2004, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include + +int main() +{ + typedef __gnu_cxx::__mt_alloc allocator_type; + __gnu_test::check_delete(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/check_new.cc b/libstdc++-v3/testsuite/ext/mt_allocator/check_new.cc new file mode 100644 index 000000000..527932640 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/check_new.cc @@ -0,0 +1,32 @@ +// 2001-11-25 Phil Edwards +// +// Copyright (C) 2001, 2003, 2004, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include + +int main() +{ + // Uses new but delete only optionally. + typedef __gnu_cxx::__mt_alloc allocator_type; + __gnu_test::check_new(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global-2.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global-2.cc new file mode 100644 index 000000000..fcc5006bd --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global-2.cc @@ -0,0 +1,46 @@ +// +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include +#include + +typedef std::string value_type; +using __gnu_cxx::__pool; +using __gnu_cxx::__common_pool_policy; +typedef __common_pool_policy<__pool, false> policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::char_traits traits_type; +typedef std::list list_type; + +list_type l; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + l.push_back("bayou bend"); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global-4.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global-4.cc new file mode 100644 index 000000000..cafbffb34 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global-4.cc @@ -0,0 +1,46 @@ +// +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include +#include + +typedef std::string value_t; +using __gnu_cxx::__pool; +using __gnu_cxx::__per_type_pool_policy; +typedef __per_type_pool_policy policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::char_traits traits_type; +typedef std::list list_type; + +list_type l; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + l.push_back("bayou bend"); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-1.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-1.cc new file mode 100644 index 000000000..f61cd38b7 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-1.cc @@ -0,0 +1,46 @@ +// +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include +#include + +typedef std::string value_type; +using __gnu_cxx::__pool; +using __gnu_cxx::__common_pool_policy; +typedef __common_pool_policy<__pool, true> policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::char_traits traits_type; +typedef std::list list_type; + +list_type l; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + l.push_back("bayou bend"); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc new file mode 100644 index 000000000..62074f0a4 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_global_thread-3.cc @@ -0,0 +1,46 @@ +// +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include +#include + +typedef std::string value_type; +using __gnu_cxx::__pool; +using __gnu_cxx::__per_type_pool_policy; +typedef __per_type_pool_policy policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::char_traits traits_type; +typedef std::list list_type; + +list_type l; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + l.push_back("bayou bend"); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-2.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-2.cc new file mode 100644 index 000000000..9ccebd57e --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-2.cc @@ -0,0 +1,43 @@ +// +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include + +typedef char value_type; +typedef std::char_traits traits_type; +using __gnu_cxx::__pool; +typedef __gnu_cxx::__common_pool_policy<__pool, false> policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::basic_string string_type; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + string_type s; + s += "bayou bend"; + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-4.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-4.cc new file mode 100644 index 000000000..9265a15a9 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-4.cc @@ -0,0 +1,44 @@ +// +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include + +typedef char value_type; +typedef std::char_traits traits_type; +using __gnu_cxx::__pool; +using __gnu_cxx::__per_type_pool_policy; +typedef __per_type_pool_policy policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::basic_string string_type; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + string_type s; + s += "bayou bend"; + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-6.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-6.cc new file mode 100644 index 000000000..017557138 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-6.cc @@ -0,0 +1,55 @@ +// { dg-require-cxa-atexit "" } + +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include + +template + struct cleanup_pool : public __gnu_cxx::__pool + { + cleanup_pool() : __gnu_cxx::__pool() { } + + cleanup_pool(const __gnu_cxx::__pool_base::_Tune& t) + : __gnu_cxx::__pool(t) { } + + ~cleanup_pool() throw() { this->_M_destroy(); } + }; + + +typedef char value_type; +typedef std::char_traits traits_type; +typedef __gnu_cxx::__common_pool_policy policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::basic_string string_type; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + string_type s; + s += "bayou bend"; + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-8.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-8.cc new file mode 100644 index 000000000..34005e4b0 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local-8.cc @@ -0,0 +1,56 @@ +// { dg-require-cxa-atexit "" } + +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include + +template + struct cleanup_pool : public __gnu_cxx::__pool + { + cleanup_pool() : __gnu_cxx::__pool() { } + + cleanup_pool(const __gnu_cxx::__pool_base::_Tune& t) + : __gnu_cxx::__pool(t) { } + + ~cleanup_pool() throw() { this->_M_destroy(); } + }; + +typedef char value_type; +typedef std::char_traits traits_type; +using __gnu_cxx::__pool; +using __gnu_cxx::__per_type_pool_policy; +typedef __per_type_pool_policy policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::basic_string string_type; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + string_type s; + s += "bayou bend"; + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-1.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-1.cc new file mode 100644 index 000000000..012a7585a --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-1.cc @@ -0,0 +1,43 @@ +// +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include + +typedef char value_type; +typedef std::char_traits traits_type; +using __gnu_cxx::__pool; +typedef __gnu_cxx::__common_pool_policy<__pool, true> policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::basic_string string_type; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + string_type s; + s += "bayou bend"; + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-3.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-3.cc new file mode 100644 index 000000000..0a9fde02b --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-3.cc @@ -0,0 +1,44 @@ +// +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include + +typedef char value_type; +typedef std::char_traits traits_type; +using __gnu_cxx::__pool; +using __gnu_cxx::__per_type_pool_policy; +typedef __per_type_pool_policy policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::basic_string string_type; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + string_type s; + s += "bayou bend"; + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-5.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-5.cc new file mode 100644 index 000000000..a812aecf2 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-5.cc @@ -0,0 +1,54 @@ +// { dg-require-cxa-atexit "" } + +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include + +template + struct cleanup_pool : public __gnu_cxx::__pool + { + cleanup_pool() : __gnu_cxx::__pool() { } + + cleanup_pool(const __gnu_cxx::__pool_base::_Tune& t) + : __gnu_cxx::__pool(t) { } + + ~cleanup_pool() throw() { this->_M_destroy(); } + }; + +typedef char value_type; +typedef std::char_traits traits_type; +typedef __gnu_cxx::__common_pool_policy policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::basic_string string_type; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + string_type s; + s += "bayou bend"; + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-7.cc b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-7.cc new file mode 100644 index 000000000..ac8426ee9 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/deallocate_local_thread-7.cc @@ -0,0 +1,56 @@ +// { dg-require-cxa-atexit "" } + +// Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 +// Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include +#include +#include +#include + +template + struct cleanup_pool : public __gnu_cxx::__pool + { + cleanup_pool() : __gnu_cxx::__pool() { } + + cleanup_pool(const __gnu_cxx::__pool_base::_Tune& t) + : __gnu_cxx::__pool(t) { } + + ~cleanup_pool() throw() { this->_M_destroy(); } + }; + +typedef char value_type; +typedef std::char_traits traits_type; +using __gnu_cxx::__pool; +using __gnu_cxx::__per_type_pool_policy; +typedef __per_type_pool_policy policy_type; +typedef __gnu_cxx::__mt_alloc allocator_type; +typedef std::basic_string string_type; + +int main() +{ + // NB: __mt_allocator doesn't clean itself up. Thus, the count will + // not be zero. + __gnu_test::counter::exceptions(false); + string_type s; + s += "bayou bend"; + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/explicit_instantiation.cc b/libstdc++-v3/testsuite/ext/mt_allocator/explicit_instantiation.cc new file mode 100644 index 000000000..03be65d01 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/explicit_instantiation.cc @@ -0,0 +1,34 @@ +// { dg-do compile } + +// 2001-11-25 Phil Edwards +// +// Copyright (C) 2001, 2003, 2004, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 20.4.1.1 allocator members + +#include +#include + +using namespace __gnu_cxx; +template class __mt_alloc; +template class __mt_alloc >; +template class __mt_alloc >; +#ifdef __GTHREADS +template class __mt_alloc >; +template class __mt_alloc >; +#endif diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc new file mode 100644 index 000000000..9630accbe --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc @@ -0,0 +1,70 @@ +// 2004-08-25 Benjamin Kosnik +// +// Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include +#include + +#ifdef __GTHREADS +#define __cxxthread true +#else +#define __cxxthread false +#endif + +// Tune characteristics. +// __common_pool_policy +void test01() +{ + bool test __attribute__((unused)) = true; + + using __gnu_cxx::__pool; + using __gnu_cxx::__common_pool_policy; + + typedef __gnu_test::pod_int value_type; + typedef __common_pool_policy<__pool, __cxxthread> policy_type; + typedef __gnu_cxx::__mt_alloc allocator_type; + typedef __gnu_cxx::__pool_base::_Tune tune_type; + + allocator_type a; + tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + + tune_type t1 = t_default; + a._M_set_options(t_opt); + tune_type t2 = a._M_get_options(); + VERIFY( t1._M_align != t2._M_align ); + + allocator_type::pointer p1 = a.allocate(128); + allocator_type::pointer p2 = a.allocate(5128); + a._M_set_options(t_small); + tune_type t3 = a._M_get_options(); + VERIFY( t3._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t3._M_chunk_size == t_opt._M_chunk_size ); + + a.deallocate(p1, 128); + a.deallocate(p2, 5128); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc new file mode 100644 index 000000000..c3f6b3b68 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc @@ -0,0 +1,72 @@ +// 2004-08-25 Benjamin Kosnik +// +// Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include +#include + +#ifdef __GTHREADS +#define __cxxthread true +#else +#define __cxxthread false +#endif + +// Tune characteristics. +// __per_type_pool_policy +void test02() +{ + bool test __attribute__((unused)) = true; + + typedef __gnu_test::pod_int value_type; + + using __gnu_cxx::__pool; + using __gnu_cxx::__per_type_pool_policy; + + typedef __per_type_pool_policy policy_type; + typedef __gnu_cxx::__mt_alloc allocator_type; + typedef __gnu_cxx::__pool_base::_Tune tune_type; + + allocator_type a; + tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + + tune_type t1 = t_default; + a._M_set_options(t_opt); + tune_type t2 = a._M_get_options(); + VERIFY( t1._M_align != t2._M_align ); + + allocator_type::pointer p1 = a.allocate(128); + allocator_type::pointer p2 = a.allocate(5128); + a._M_set_options(t_small); + tune_type t3 = a._M_get_options(); + VERIFY( t3._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t3._M_chunk_size == t_opt._M_chunk_size ); + + a.deallocate(p1, 128); + a.deallocate(p2, 5128); +} + +int main() +{ + test02(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc new file mode 100644 index 000000000..b4e822d27 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc @@ -0,0 +1,94 @@ +// 2004-08-25 Benjamin Kosnik +// +// Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +// Tune characteristics, two of same type +template +struct test_policy +{ static bool per_type() { return true; } }; + +using __gnu_cxx::__pool; +using __gnu_cxx::__common_pool_policy; + +template<> +struct test_policy<__common_pool_policy<__pool, true> > +{ static bool per_type() { return false; } }; + +template<> +struct test_policy<__common_pool_policy<__pool, false> > +{ static bool per_type() { return false; } }; + +// Tune characteristics, two of different types +template +void test03() +{ + bool test __attribute__((unused)) = true; + + typedef __gnu_cxx::__pool_base::_Tune tune_type; + typedef _Tp value_type; + typedef _Cp policy_type; + typedef __gnu_cxx::__mt_alloc allocator_type; + + allocator_type a; + tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + + // First instances assured. + tune_type t1 = t_default; + if (test_policy::per_type()) + { + a._M_set_options(t_opt); + t1 = a._M_get_options(); + VERIFY( t1._M_align != t_default._M_align ); + } + + // Lock tune settings. + typename allocator_type::pointer p1 = a.allocate(128); + + allocator_type a2; + tune_type t2 = a2._M_get_options(); + VERIFY( t2._M_chunk_size == t1._M_chunk_size ); + + typename allocator_type::pointer p2 = a2.allocate(5128); + + a2._M_set_options(t_small); + tune_type t3 = a2._M_get_options(); + VERIFY( t3._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t3._M_chunk_size == t2._M_chunk_size ); + + a.deallocate(p1, 128); + a2.deallocate(p2, 5128); +} + +int main() +{ +#ifdef __GTHREADS + test03 >(); + test03 >(); +#endif + + test03 >(); + test03 >(); + + return 0; +} diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc new file mode 100644 index 000000000..4d3c81181 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc @@ -0,0 +1,111 @@ +// 2004-08-25 Benjamin Kosnik +// +// Copyright (C) 2004, 2005, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +// Tune characteristics, two of same type +template +struct test_policy +{ static bool per_type() { return true; } }; + +using __gnu_cxx::__pool; +using __gnu_cxx::__common_pool_policy; + +template<> +struct test_policy<__common_pool_policy<__pool, true> > +{ static bool per_type() { return false; } }; + +template<> +struct test_policy<__common_pool_policy<__pool, false> > +{ static bool per_type() { return false; } }; + +struct pod2 +{ + int i; + int j; + int k; +}; + +// Tune characteristics, two of different instantiations +template +void test04() +{ + bool test __attribute__((unused)) = true; + + typedef __gnu_cxx::__pool_base::_Tune tune_type; + typedef _Tp value_type; + typedef _Cp policy_type; + typedef __gnu_cxx::__mt_alloc allocator_type; + + allocator_type a; + tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + + // First instance of local type assured. + tune_type t1 = t_default; + if (test_policy::per_type()) + { + a._M_set_options(t_opt); + t1 = a._M_get_options(); + VERIFY( t1._M_align != t_default._M_align ); + } + + // Lock tune settings. + typename allocator_type::pointer p1 = a.allocate(128); + + typedef pod2 value2_type; + typedef typename allocator_type::template rebind::other rebind_type; + + rebind_type a2; + tune_type t2 = a2._M_get_options(); + + // Both policy_type and rebind_type::policy_type have same characteristics. + if (test_policy::per_type()) + { + a2._M_set_options(t_opt); + tune_type t = a2._M_get_options(); + VERIFY( t2._M_align != t._M_align ); + t2 = t; + } + + typename rebind_type::pointer p2 = a2.allocate(5128); + + a2._M_set_options(t_small); + tune_type t4 = a2._M_get_options(); + VERIFY( t4._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t4._M_chunk_size == t2._M_chunk_size ); + + a.deallocate(p1, 128); + a2.deallocate(p2, 5128); +} + +int main() +{ +#ifdef __GTHREADS + test04 >(); + test04 >(); +#endif + test04 >(); + test04 >(); + + 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 000000000..d4c2315f3 --- /dev/null +++ b/libstdc++-v3/testsuite/ext/mt_allocator/variadic_construct.cc @@ -0,0 +1,45 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-26 Paolo Carlini + +// Copyright (C) 2007, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + typedef std::pair pair_type; + __gnu_cxx::__mt_alloc 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; +} -- cgit v1.2.3