diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index f5c25b9640bcfc10c505266dff6187d174905635..b5a754bd70390c9887cdfe03d9d76193c9cd2b0e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,57 @@ +2005-12-28 Paolo Carlini <pcarlini@suse.de> + + * include/std/std_bitset.h (bitset<>::_M_copy_from_string, + bitset<>::_M_copy_to_string, bitset<>::operator>>): Reverse loop. + + * testsuite/25_algorithms/heap/heap.cc (test01): Always enable + complexity checks. + * testsuite/18_support/numeric_limits/specialization.cc: Avoid + unused parameter warning. + * testsuite/18_support/numeric_limits/traps.cc: Acoid unused variable + warning. + * testsuite/ext/malloc_allocator/deallocate_global.cc: Fix format + string. + * testsuite/ext/malloc_allocator/deallocate_local.cc: Likewise. + * testsuite/ext/array_allocator/2.cc: Remove unused variable. + * testsuite/tr1/3_function_objects/mem_fn.cc: Avoid unused variable + warnings. + * testsuite/tr1/6_containers/unordered/instantiate/set.cc: Just + instantiate. + * testsuite/tr1/6_containers/unordered/instantiate/map.cc: Likewise. + * testsuite/tr1/6_containers/unordered/instantiate/hash.cc: Likewise. + * testsuite/tr1/6_containers/unordered/instantiate/multiset.cc: + Likewise. + * testsuite/tr1/6_containers/unordered/instantiate/multimap.cc: + Likewise. + * testsuite/tr1/6_containers/array/cons/aggregate_initialization.cc: + Avoid unused variable warnings. + * testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc: + Likewise. + * testsuite/thread/18185.cc: Likewise. + * testsuite/27_io/ios_base/storage/11584.cc: Likewise; avoid comparison + between signed and unsigned warning. + * testsuite/27_io/types/1.cc: Avoid unused variable warnings. + * testsuite/testsuite_allocator.h (check_new): Likewise. + (check_deallocate_null): Adjust return type. + * testsuite/testsuite_hooks.h (bitmask_operators): Avoid unused + variable warnings. + * testsuite/21_strings/c_strings/wchar_t/24559.cc: Avoid unused + variable warning. + +2005-12-28 Chris Jefferson <chris@bubblescope.net> + + * include/std/std_bitset.h (bitset<0>::set, bitset<0>::reset, + bitset<0>::flip, bitset<0>::test): Add inline specializations for + bitset<0>. + + * testsuite/tr1/6_containers/unordered/insert/multiset_range.cc + (test01): Add static cast. + * testsuite/tr1/6_containers/unordered/insert/set_range.cc + (test01): Likewise. + * testsuite/testsuite_hooks.h (operator==(NonDefaultConstructible, + NonDefaultConstructible), operator<(NonDefaultConstructible, + NonDefaultConstrictible)): Avoid unused parameter warning. + 2005-12-26 Chris Jefferson <chris@bubblescope.net> * include/ext/mt_allocator.h (__mt_alloc::__mt_alloc): Remove diff --git a/libstdc++-v3/include/std/std_bitset.h b/libstdc++-v3/include/std/std_bitset.h index c1cfadad7bd8918e2e0bf7fdc4aa09eab3ca49ce..ad47238ed6287e2533c7d9438c7ef59fd19581b3 100644 --- a/libstdc++-v3/include/std/std_bitset.h +++ b/libstdc++-v3/include/std/std_bitset.h @@ -1144,19 +1144,20 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) template<size_t _Nb> template<class _CharT, class _Traits, class _Alloc> void - bitset<_Nb>::_M_copy_from_string(const std::basic_string<_CharT, _Traits, - _Alloc>& __s, size_t __pos, size_t __n) + bitset<_Nb>:: + _M_copy_from_string(const std::basic_string<_CharT, _Traits, + _Alloc>& __s, size_t __pos, size_t __n) { reset(); const size_t __nbits = std::min(_Nb, std::min(__n, __s.size() - __pos)); - for (size_t __i = 0; __i < __nbits; ++__i) + for (size_t __i = __nbits; __i > 0; --__i) { - switch(__s[__pos + __nbits - __i - 1]) + switch(__s[__pos + __nbits - __i]) { case '0': break; case '1': - set(__i); + set(__i - 1); break; default: __throw_invalid_argument(__N("bitset::_M_copy_from_string")); @@ -1167,13 +1168,13 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) template<size_t _Nb> template<class _CharT, class _Traits, class _Alloc> void - bitset<_Nb>::_M_copy_to_string(std::basic_string<_CharT, _Traits, - _Alloc>& __s) const + bitset<_Nb>:: + _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>& __s) const { __s.assign(_Nb, '0'); - for (size_t __i = 0; __i < _Nb; ++__i) - if (_Unchecked_test(__i)) - __s[_Nb - 1 - __i] = '1'; + for (size_t __i = _Nb; __i > 0; --__i) + if (_Unchecked_test(__i - 1)) + __s[_Nb - __i] = '1'; } // 23.3.5.3 bitset operations: @@ -1242,7 +1243,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) // 303. Bitset input operator underspecified const char_type __zero = __is.widen('0'); const char_type __one = __is.widen('1'); - for (size_t __i = 0; __i < _Nb; ++__i) + for (size_t __i = _Nb; __i > 0; --__i) { static typename _Traits::int_type __eof = _Traits::eof(); @@ -1290,6 +1291,44 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD) __x._M_copy_to_string(__tmp); return __os << __tmp; } + + // Specializations for zero-sized bitsets, to avoid "unsigned comparison + // with zero" warnings. + template<> + inline bitset<0>& + bitset<0>:: + set(size_t, bool) + { + __throw_out_of_range(__N("bitset::set")); + return *this; + } + + template<> + inline bitset<0>& + bitset<0>:: + reset(size_t) + { + __throw_out_of_range(__N("bitset::reset")); + return *this; + } + + template<> + inline bitset<0>& + bitset<0>:: + flip(size_t) + { + __throw_out_of_range(__N("bitset::flip")); + return *this; + } + + template<> + inline bool + bitset<0>:: + test(size_t) const + { + __throw_out_of_range(__N("bitset::test")); + return false; + } //@} _GLIBCXX_END_NESTED_NAMESPACE diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/specialization.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/specialization.cc index 815b7f5505c53c68e7d3376b75212f34de57d3ae..0a1c8fec353d21bc24edb9fcdb5eb933fb80bc47 100644 --- a/libstdc++-v3/testsuite/18_support/numeric_limits/specialization.cc +++ b/libstdc++-v3/testsuite/18_support/numeric_limits/specialization.cc @@ -3,7 +3,7 @@ // 1999-08-23 bkoz -// Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation +// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005 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 @@ -41,7 +41,7 @@ template<typename T> struct B { - B(int i = 0) { } + B(int = 0) { } }; diff --git a/libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc b/libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc index e9bdd84e4b33edc3baf69c634e0f537cafc22a91..197a2518943a720dd11d55ed45a236c32f9c1c4a 100644 --- a/libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc +++ b/libstdc++-v3/testsuite/18_support/numeric_limits/traps.cc @@ -26,14 +26,14 @@ template<typename T> void - test_traps() + test_traps(T r = T(0)) { typedef T value_type; volatile value_type i(5); volatile value_type j(0); if (!std::numeric_limits<value_type>::traps) - value_type r = i/j; + r = i / j; } // libstdc++/22203 diff --git a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/24559.cc b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/24559.cc index 26f03267855c50feb39b31189b4d623decd706d3..9e2a17dea303040ae0442db3ed7f395327a0a914 100644 --- a/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/24559.cc +++ b/libstdc++-v3/testsuite/21_strings/c_strings/wchar_t/24559.cc @@ -23,10 +23,10 @@ // { dg-do compile } // libstdc++/24559 +void test01(wchar_t* (*) (wchar_t *, const wchar_t*)) { } + int main() { - typedef wchar_t* (*pf)(wchar_t *, const wchar_t*); - pf p1 = std::wcspbrk; - + test01(std::wcspbrk); return 0; } diff --git a/libstdc++-v3/testsuite/25_algorithms/heap/heap.cc b/libstdc++-v3/testsuite/25_algorithms/heap/heap.cc index 6fbd3ed4c06d0b3a23256a627f967ff731fdda63..ba916a8f01e7eb9f5b067fa3502441172cabb0b6 100644 --- a/libstdc++-v3/testsuite/25_algorithms/heap/heap.cc +++ b/libstdc++-v3/testsuite/25_algorithms/heap/heap.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2001 Free Software Foundation, Inc. +// Copyright (C) 2001, 2002, 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 @@ -19,7 +19,6 @@ // 25.3.6 Heap operations [lib.alg.heap.operations] #include <algorithm> -//#include <cmath> #include <testsuite_hooks.h> bool test __attribute__((unused)) = true; @@ -29,24 +28,24 @@ const int B[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17}; const int C[] = {17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; const int N = sizeof(A) / sizeof(int); -// This functor has the equivalent functionality of std::geater<>, +// This functor has the equivalent functionality of std::greater<>, // 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; - } + 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; + static int itsCount; }; int Gt::itsCount = 0; @@ -57,27 +56,27 @@ int Gt::itsCount = 0; void test01() { - // sort array s1 using push_heap/pop_heap - int s1[N]; - std::copy(A, A + N, s1); - VERIFY(std::equal(s1, s1 + N, A)); - - for (int i = 2; i <= N; ++i) { - std::push_heap(s1, s1 + i); - } - for (int i = N; i >= 2; --i) { - std::pop_heap(s1, s1 + i); - } - VERIFY(std::equal(s1, s1 + N, B)); - - // sort array s2 using make_heap/sort_heap - int s2[N]; - std::copy(A, A + N, s2); - VERIFY(std::equal(s2, s2 + N, A)); - - std::make_heap(s2, s2 + N); - std::sort_heap(s2, s2 + N); - VERIFY(std::equal(s2, s2 + N, B)); + // sort array s1 using push_heap/pop_heap + int s1[N]; + std::copy(A, A + N, s1); + VERIFY(std::equal(s1, s1 + N, A)); + + for (int i = 2; i <= N; ++i) + std::push_heap(s1, s1 + i); + + for (int i = N; i >= 2; --i) + std::pop_heap(s1, s1 + i); + + VERIFY(std::equal(s1, s1 + N, B)); + + // sort array s2 using make_heap/sort_heap + int s2[N]; + std::copy(A, A + N, s2); + VERIFY(std::equal(s2, s2 + N, A)); + + std::make_heap(s2, s2 + N); + std::sort_heap(s2, s2 + N); + VERIFY(std::equal(s2, s2 + N, B)); } // Perform same tests as above but with the comparison predicate @@ -85,49 +84,43 @@ test01() void test02() { - Gt gt; + Gt gt; // const int logN = static_cast<int>(std::log(static_cast<double>(N)) + 0.5); - const int logN = 3; - - int s1[N]; - std::copy(A, A + N, s1); - VERIFY(std::equal(s1, s1 + N, A)); - - for (int i = 2; i <= N; ++i) { - std::push_heap(s1, s1 + i, gt); -#ifndef _GLIBCXX_DEBUG - VERIFY(gt.count() <= logN); -#endif - gt.reset(); + const int logN = 3; + + int s1[N]; + std::copy(A, A + N, s1); + VERIFY(std::equal(s1, s1 + N, A)); + + for (int i = 2; i <= N; ++i) + { + std::push_heap(s1, s1 + i, gt); + VERIFY(gt.count() <= logN); + gt.reset(); } - for (int i = N; i >= 2; --i) { - std::pop_heap(s1, s1 + i, gt); -#ifndef _GLIBCXX_DEBUG - VERIFY(gt.count() <= 2 * logN); -#endif - gt.reset(); + for (int i = N; i >= 2; --i) + { + std::pop_heap(s1, s1 + i, gt); + VERIFY(gt.count() <= 2 * logN); + gt.reset(); } - VERIFY(std::equal(s1, s1 + N, C)); - - // sort array s2 using make_heap/sort_heap - int s2[N]; - std::copy(A, A + N, s2); - VERIFY(std::equal(s2, s2 + N, A)); - - std::make_heap(s2, s2 + N, gt); -#ifndef _GLIBCXX_DEBUG - VERIFY(gt.count() <= 3 * N); -#endif - gt.reset(); - - std::sort_heap(s2, s2 + N, gt); -#ifndef _GLIBCXX_DEBUG - VERIFY(gt.count() <= N * logN); -#endif - - VERIFY(std::equal(s2, s2 + N, C)); + VERIFY(std::equal(s1, s1 + N, C)); + + // sort array s2 using make_heap/sort_heap + int s2[N]; + std::copy(A, A + N, s2); + VERIFY(std::equal(s2, s2 + N, A)); + + std::make_heap(s2, s2 + N, gt); + VERIFY(gt.count() <= 3 * N); + gt.reset(); + + std::sort_heap(s2, s2 + N, gt); + VERIFY(gt.count() <= N * logN); + + VERIFY(std::equal(s2, s2 + N, C)); } int @@ -135,6 +128,5 @@ main() { test01(); test02(); - return 0; } diff --git a/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc index a97f2f789cd700834ede4eb432efa276cca04e58..06eae990c80a786d0d3370d08cf386b2e449d255 100644 --- a/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc +++ b/libstdc++-v3/testsuite/27_io/ios_base/storage/11584.cc @@ -1,6 +1,6 @@ // 2004-01-25 jlquinn@gcc.gnu.org -// Copyright (C) 2004 Free Software Foundation +// Copyright (C) 2004, 2005 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 @@ -42,21 +42,22 @@ void operator delete[] (void *p) throw() { operator delete(p); } int main () { bool test __attribute__((unused)) = true; - const int i = std::ios::xalloc (); + const int i = std::ios::xalloc(); + VERIFY( i >= 0 ); new_fails = 1; // Successive accesses to failure storage clears to zero. - std::cout.iword(100) = 0xdeadbeef; - VERIFY(std::cout.iword(100) == 0); + std::cout.iword(100) = 69; + VERIFY( std::cout.iword(100) == 0 ); // Access to pword failure storage shouldn't clear iword pword storage. long& lr = std::cout.iword(100); - lr = 0xdeadbeef; + lr = 69; void* pv = std::cout.pword(100); - VERIFY(pv == 0); - VERIFY(lr == 0xdeadbeef); + VERIFY( pv == 0 ); + VERIFY( lr == 69 ); return 0; } diff --git a/libstdc++-v3/testsuite/27_io/types/1.cc b/libstdc++-v3/testsuite/27_io/types/1.cc index 276c99c7fd3d856e172a3431789e1b350be1cb8d..59965c820ab5e798bf41327556a54815dc8d4a7b 100644 --- a/libstdc++-v3/testsuite/27_io/types/1.cc +++ b/libstdc++-v3/testsuite/27_io/types/1.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2002, 2004 Free Software Foundation +// Copyright (C) 2002, 2003, 2004, 2005 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 @@ -25,8 +25,8 @@ // Annex D, deprecated. void test01() { - std::ios_base::streampos spos; - std::ios_base::streamoff soff; + typedef std::ios_base::streampos streampos_type; + typedef std::ios_base::streamoff streamoff_type; } int main(void) diff --git a/libstdc++-v3/testsuite/ext/array_allocator/2.cc b/libstdc++-v3/testsuite/ext/array_allocator/2.cc index 79f8c5399131f6dc2c2b8f4f769145f2afe829fd..6ec4a1771ee6275d33e96477f6261376979c15e5 100644 --- a/libstdc++-v3/testsuite/ext/array_allocator/2.cc +++ b/libstdc++-v3/testsuite/ext/array_allocator/2.cc @@ -1,7 +1,7 @@ // Expected execution error for PR19495. // { dg-do run { xfail powerpc*-*-linux* } } -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 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 @@ -47,7 +47,6 @@ void test01() typedef __gnu_cxx::array_allocator<char_type, array_type> allocator_type; typedef basic_string<char_type, traits_type, allocator_type> string_type; - size_t index = array_type::_S_index; allocator_type a(&extern_array); string_type s(a); diff --git a/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_global.cc b/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_global.cc index 7e670f0c4cf8b90079ec9cf4e49497362fa357a0..97604735f2029f1f19eb9bde1a6bf80e131687db 100644 --- a/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_global.cc +++ b/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_global.cc @@ -1,5 +1,5 @@ // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 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 @@ -57,7 +57,8 @@ void operator delete(void* p) throw() if (count == 0) printf("All memory released \n"); else - printf("%u allocations to be released \n", count); + printf("%lu allocations to be released \n", + static_cast<unsigned long>(count)); free(p); } diff --git a/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_local.cc b/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_local.cc index 175a833fbc57437532fc01f33d9d9f5cc42f7371..aafffae9d707773021048125ee263676dc3f2511 100644 --- a/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_local.cc +++ b/libstdc++-v3/testsuite/ext/malloc_allocator/deallocate_local.cc @@ -1,5 +1,5 @@ // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 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 @@ -44,7 +44,8 @@ void operator delete(void* p) throw() if (alloc_cnt == 0) printf("All memory released \n"); else - printf("%u allocations to be released \n", alloc_cnt); + printf("%lu allocations to be released \n", + static_cast<unsigned long>(alloc_cnt)); free(p); } diff --git a/libstdc++-v3/testsuite/testsuite_allocator.h b/libstdc++-v3/testsuite/testsuite_allocator.h index 307a0384dc5e36404b51b34979cb4a5ade560b63..3beb29d32b4aafedc69adff4f747dd8cccb3aecc 100644 --- a/libstdc++-v3/testsuite/testsuite_allocator.h +++ b/libstdc++-v3/testsuite/testsuite_allocator.h @@ -184,7 +184,7 @@ namespace __gnu_test check_new(Alloc a = Alloc()) { bool test __attribute__((unused)) = true; - typename Alloc::pointer p = a.allocate(10); + a.allocate(10); test &= ( new_called == uses_global_new ); return test; } @@ -201,7 +201,7 @@ namespace __gnu_test } template<typename Alloc> - bool + void check_deallocate_null() { // Let's not core here... diff --git a/libstdc++-v3/testsuite/testsuite_hooks.h b/libstdc++-v3/testsuite/testsuite_hooks.h index 8a5276f50c243b93a9c09f80d1ea93cabf027aca..38b80630fc232db1172ca68b1b13037e8fe14bde 100644 --- a/libstdc++-v3/testsuite/testsuite_hooks.h +++ b/libstdc++-v3/testsuite/testsuite_hooks.h @@ -104,10 +104,9 @@ namespace __gnu_test // bitmask_operators template<typename bitmask_type> void - bitmask_operators() + bitmask_operators(bitmask_type a = bitmask_type(), + bitmask_type b = bitmask_type()) { - bitmask_type a; - bitmask_type b; a | b; a & b; a ^ b; @@ -168,13 +167,13 @@ namespace __gnu_test }; inline bool - operator==(const NonDefaultConstructible& lhs, - const NonDefaultConstructible& rhs) + operator==(const NonDefaultConstructible&, + const NonDefaultConstructible&) { return false; } inline bool - operator<(const NonDefaultConstructible& lhs, - const NonDefaultConstructible& rhs) + operator<(const NonDefaultConstructible&, + const NonDefaultConstructible&) { return false; } diff --git a/libstdc++-v3/testsuite/thread/18185.cc b/libstdc++-v3/testsuite/thread/18185.cc index 9c2d4adc9d2631c08718c0f35f766d96566e197a..4ec6a6d0b3b602b2343d9e327945cd0a48f3af51 100644 --- a/libstdc++-v3/testsuite/thread/18185.cc +++ b/libstdc++-v3/testsuite/thread/18185.cc @@ -1,5 +1,5 @@ // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 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 @@ -25,8 +25,8 @@ #include <string> #include <pthread.h> -static void * -foo (void *p) +static void* +foo (void*) { typedef std::char_traits<char> traits_type; typedef __gnu_cxx::new_allocator<char> allocator_type; @@ -47,7 +47,7 @@ int main () { pthread_t t; - int j = pthread_create (&t, 0, foo, 0); - int i = pthread_join (t, 0); + pthread_create (&t, 0, foo, 0); + pthread_join (t, 0); return 0; } diff --git a/libstdc++-v3/testsuite/tr1/3_function_objects/mem_fn.cc b/libstdc++-v3/testsuite/tr1/3_function_objects/mem_fn.cc index 74caeef88ab373cd8619fba6a5d28b3b35f81a79..2f780c1a994482ddc70ecfec76d8ab8eab5424d9 100644 --- a/libstdc++-v3/testsuite/tr1/3_function_objects/mem_fn.cc +++ b/libstdc++-v3/testsuite/tr1/3_function_objects/mem_fn.cc @@ -39,7 +39,7 @@ struct dumb_ptr }; // Test mem_fn with a data member -void test01() +void test01(int r = 0) { using std::tr1::mem_fn; @@ -69,6 +69,9 @@ void test01() const int& bypc = mem_fn(&X::bar)(ypc); const int& byd = mem_fn(&X::bar)(yd); const int& bydc = mem_fn(&X::bar)(ydc); + + // Avoid unused variable warnings. + r = bx + bxc + bxp + bxpc + bxd + bxdc + by + byc + byp + bypc + byd + bydc; } int main() 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 a6ebca06691a5f09e474b06a6fb65fb7d56f66ba..1c6c8edd670c32e076c7fa4cd920ebaf89a6c4b1 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 Free Software Foundation, Inc. +// Copyright (C) 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 @@ -31,6 +31,8 @@ test01() array_type a = { 0, 1, 2, 3, 4 }; array_type b = { 0, 1, 2, 3 }; + + a = b; } int main() diff --git a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc index 472524578590b7206881bb7177b2509bda73f055..75b3e97720e5f6581ba03768f0b2096cc1cb9184 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/array/requirements/zero_sized_arrays.cc @@ -1,6 +1,6 @@ // 2004-10-20 Benjamin Kosnik <bkoz@redhat.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 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 @@ -38,6 +38,7 @@ test01() // 3 // begin() == end() + VERIFY( a.begin() == a.end() ); VERIFY( b.begin() == b.end() ); // 4: ? diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/multiset_range.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/multiset_range.cc index ab543e481bd8479e40c704120585b0b5bf84c922..a83fce3cd61bc1b9228efac38712bf69d16ac94a 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/multiset_range.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/multiset_range.cc @@ -27,7 +27,7 @@ #include <iterator> #include <algorithm> #include <tr1/unordered_set> -#include "testsuite_hooks.h" +#include <testsuite_hooks.h> bool test __attribute__((unused)) = true; @@ -42,7 +42,7 @@ void test01() "magenta", "yellow", "orange", "pink", "gray" }; s.insert(A+0, A+N); - VERIFY(s.size() == N); + VERIFY(s.size() == static_cast<unsigned int>(N)); VERIFY(std::distance(s.begin(), s.end()) == N); for (int i = 0; i < N; ++i) { @@ -62,7 +62,7 @@ void test02() const int A[N] = { 3, 7, 4, 8, 2, 4, 6, 7 }; s.insert(A+0, A+N); - VERIFY(s.size() == N); + VERIFY(s.size() == static_cast<unsigned int>(N)); VERIFY(std::distance(s.begin(), s.end()) == N); VERIFY(std::count(s.begin(), s.end(), 2) == 1); diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/set_range.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/set_range.cc index 24f973846b11d732b6d2971fe08df64468ecae86..bfa4f73b1b20f31b7f4adbc51b2b7c298dc32bed 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/set_range.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/insert/set_range.cc @@ -27,7 +27,7 @@ #include <iterator> #include <algorithm> #include <tr1/unordered_set> -#include "testsuite_hooks.h" +#include <testsuite_hooks.h> bool test __attribute__((unused)) = true; @@ -42,7 +42,7 @@ void test01() "magenta", "yellow", "orange", "pink", "gray" }; s.insert(A+0, A+N); - VERIFY(s.size() == N); + VERIFY(s.size() == static_cast<unsigned int>(N)); VERIFY(std::distance(s.begin(), s.end()) == N); for (int i = 0; i < N; ++i) { diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/hash.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/hash.cc index da4515160a5e6620a65151a419e845e642b44546..382d69f715c43deaf2c9eb9e64e1f1e6849ad8a6 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/hash.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/hash.cc @@ -1,6 +1,6 @@ // { dg-do compile } -// 2005-2-17 Matt Austern <austern@apple.com> +// 2005-02-17 Matt Austern <austern@apple.com> // // Copyright (C) 2005 Free Software Foundation, Inc. // @@ -25,30 +25,27 @@ #include <string> #include <tr1/functional> -int main() -{ - using namespace std::tr1; +using namespace std::tr1; - // Verify that we can instantiate hash for every required type. - - hash<bool> hb; - hash<char> hc; - hash<signed char> hsc; - hash<unsigned char> huc; - hash<short> hs; - hash<int> hi; - hash<long> hl; - hash<unsigned short> hus; - hash<unsigned int> hui; - hash<unsigned long> hul; - hash<float> hf; - hash<double> hd; - hash<long double> hld; - hash<void*> hp; - hash<std::string> hstr; +// Verify that we can instantiate hash for every required type. +template class hash<bool>; +template class hash<char>; +template class hash<signed char>; +template class hash<unsigned char>; +template class hash<short>; +template class hash<int>; +template class hash<long>; +template class hash<unsigned short>; +template class hash<unsigned int>; +template class hash<unsigned long>; +template class hash<float>; +template class hash<double>; +template class hash<long double>; +template class hash<void*>; +template class hash<std::string>; #ifdef _GLIBCXX_USE_WCHAR_T - hash<wchar_t> hw; - hash<std::wstring> hwstr; +template class hash<wchar_t>; +template class hash<std::wstring>; #endif -} + diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/map.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/map.cc index adb2913c9a30249b53d799acfd4c1fcb626301cd..cb1cf2fc98e242ee51bd7aced2a16531d84996eb 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/map.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/map.cc @@ -1,8 +1,8 @@ // { dg-do compile } -// 2005-2-17 Matt Austern <austern@apple.com> +// 2005-02-17 Matt Austern <austern@apple.com> // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 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 @@ -25,13 +25,10 @@ #include <string> #include <tr1/unordered_map> -int main() -{ - using namespace std; - using namespace std::tr1; +using namespace std; +using namespace std::tr1; - unordered_map<string, float> m1; - unordered_map<string, float, - hash<string>, equal_to<string>, - allocator<pair<const string, float> >, true> s2; -} +template class unordered_map<string, float>; +template class unordered_map<string, float, + hash<string>, equal_to<string>, + allocator<pair<const string, float> >, true>; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multimap.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multimap.cc index 9225d7974e97cb59b5ec084fe5f6d841e68e2a2f..73282612951f4afcb9740f09e9d2e7bc1f51701d 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multimap.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multimap.cc @@ -1,6 +1,6 @@ // { dg-do compile } -// 2005-2-17 Matt Austern <austern@apple.com> +// 2005-02-17 Matt Austern <austern@apple.com> // // Copyright (C) 2005 Free Software Foundation, Inc. // @@ -25,13 +25,10 @@ #include <string> #include <tr1/unordered_map> -int main() -{ - using namespace std; - using namespace std::tr1; +using namespace std; +using namespace std::tr1; - unordered_multimap<string, float> m1; - unordered_multimap<string, float, - hash<string>, equal_to<string>, - allocator<pair<const string, float> >, true> s2; -} +template class unordered_multimap<string, float>; +template class unordered_multimap<string, float, + hash<string>, equal_to<string>, + allocator<pair<const string, float> >, true>; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multiset.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multiset.cc index ce138c340bb23330d96d35223badcddcc8231b36..e022e8bd8561c9dafc28bcdde28b8a503a999073 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multiset.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/multiset.cc @@ -1,6 +1,6 @@ // { dg-do compile } -// 2005-2-17 Matt Austern <austern@apple.com> +// 2005-02-17 Matt Austern <austern@apple.com> // // Copyright (C) 2005 Free Software Foundation, Inc. // @@ -24,11 +24,9 @@ #include <tr1/unordered_set> -int main() -{ - using namespace std; - using namespace std::tr1; +using namespace std; +using namespace std::tr1; - unordered_multiset<int> s1; - unordered_multiset<int, hash<int>, equal_to<int>, allocator<int>, true> s2; -} +template class unordered_multiset<int>; +template class unordered_multiset<int, hash<int>, equal_to<int>, + allocator<int>, true>; diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/set.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/set.cc index 32bde7165f59da3d3a509a8ceb456a7907d2c554..9bb892eccd6480295680b81d9a59a47e71063a98 100644 --- a/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/set.cc +++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/instantiate/set.cc @@ -1,6 +1,6 @@ // { dg-do compile } -// 2005-2-17 Matt Austern <austern@apple.com> +// 2005-02-17 Matt Austern <austern@apple.com> // // Copyright (C) 2005 Free Software Foundation, Inc. // @@ -24,11 +24,9 @@ #include <tr1/unordered_set> -int main() -{ - using namespace std; - using namespace std::tr1; +using namespace std; +using namespace std::tr1; - unordered_set<int> s1; - unordered_set<int, hash<int>, equal_to<int>, allocator<int>, true> s2; -} +template class unordered_set<int>; +template class unordered_set<int, hash<int>, equal_to<int>, + allocator<int>, true>;