diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-11-07 15:00:34 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-11-08 17:35:15 +0000 |
commit | bbcb84bba0a21ff367c95d3d0970926992b20cdd (patch) | |
tree | eb9ff8ab25c6138126fbd920c2440c0f7cc65c4c /libstdc++-v3/testsuite | |
parent | 8f6d25f19bae521c3d028bcdcd69019540b8c3b9 (diff) | |
download | gcc-bbcb84bba0a21ff367c95d3d0970926992b20cdd.zip gcc-bbcb84bba0a21ff367c95d3d0970926992b20cdd.tar.gz gcc-bbcb84bba0a21ff367c95d3d0970926992b20cdd.tar.bz2 |
libstdc++: Fix -Wsystem-headers warnings in tests
libstdc++-v3/ChangeLog:
* testsuite/18_support/new_nothrow.cc: Add missing noexcept
to operator delete replacements.
* testsuite/20_util/any/cons/92156.cc: Disable
-Winit-list-lifetime warnings from instantiating invalid
specialization of manager function.
* testsuite/20_util/any/modifiers/92156.cc: Likewise.
* testsuite/20_util/default_delete/void_neg.cc: Prune additional
diagnostics.
* testsuite/20_util/headers/memory/synopsis.cc: Add missing
noexcept.
* testsuite/20_util/shared_ptr/cons/void_neg.cc: Prune
additional diagnostic.
* testsuite/20_util/unique_ptr/creation/for_overwrite.cc: Add
missing noexcept to operator delete replacements.
* testsuite/21_strings/basic_string/cons/char/103919.cc:
Likewise.
* testsuite/23_containers/map/modifiers/emplace/92300.cc:
Likewise.
* testsuite/23_containers/map/modifiers/insert/92300.cc:
Likewise.
* testsuite/24_iterators/headers/iterator/range_access_c++11.cc:
Add missing noexcept to synopsis declarations.
* testsuite/24_iterators/headers/iterator/range_access_c++14.cc:
Likewise.
* testsuite/24_iterators/headers/iterator/range_access_c++17.cc:
Likewise.
Diffstat (limited to 'libstdc++-v3/testsuite')
13 files changed, 40 insertions, 27 deletions
diff --git a/libstdc++-v3/testsuite/18_support/new_nothrow.cc b/libstdc++-v3/testsuite/18_support/new_nothrow.cc index d5e7eb5..3780612 100644 --- a/libstdc++-v3/testsuite/18_support/new_nothrow.cc +++ b/libstdc++-v3/testsuite/18_support/new_nothrow.cc @@ -64,7 +64,13 @@ void* operator new (size_t n) } } -void operator delete (void *p) +#if __cplusplus >= 201103L +#define NOEXCEPT noexcept +#else +#define NOEXCEPT +#endif + +void operator delete (void *p) NOEXCEPT { ++delete_called; if (p) @@ -77,18 +83,18 @@ void* operator new[] (size_t n) return operator new(n); } -void operator delete[] (void *p) +void operator delete[] (void *p) NOEXCEPT { ++delete_vec_called; operator delete(p); } #if __cplusplus >= 201402L -void operator delete (void *p, std::size_t) +void operator delete (void *p, std::size_t) noexcept { ::operator delete(p); } -void operator delete[] (void *p, std::size_t) +void operator delete[] (void *p, std::size_t) noexcept { ::operator delete[](p); } diff --git a/libstdc++-v3/testsuite/20_util/any/cons/92156.cc b/libstdc++-v3/testsuite/20_util/any/cons/92156.cc index 71e9dd9..0e768df 100644 --- a/libstdc++-v3/testsuite/20_util/any/cons/92156.cc +++ b/libstdc++-v3/testsuite/20_util/any/cons/92156.cc @@ -1,4 +1,5 @@ // { dg-do run { target c++17 } } +// { dg-options "-Wno-init-list-lifetime" } // Copyright (C) 2020-2022 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/20_util/any/modifiers/92156.cc b/libstdc++-v3/testsuite/20_util/any/modifiers/92156.cc index d8f9893..b98d0e8 100644 --- a/libstdc++-v3/testsuite/20_util/any/modifiers/92156.cc +++ b/libstdc++-v3/testsuite/20_util/any/modifiers/92156.cc @@ -1,4 +1,5 @@ // { dg-do run { target c++17 } } +// { dg-options "-Wno-init-list-lifetime" } // Copyright (C) 2020-2022 Free Software Foundation, Inc. // diff --git a/libstdc++-v3/testsuite/20_util/default_delete/void_neg.cc b/libstdc++-v3/testsuite/20_util/default_delete/void_neg.cc index f6aefc0..04042c2 100644 --- a/libstdc++-v3/testsuite/20_util/default_delete/void_neg.cc +++ b/libstdc++-v3/testsuite/20_util/default_delete/void_neg.cc @@ -27,3 +27,6 @@ void test01() d(nullptr); // { dg-error "here" } // { dg-error "delete pointer to incomplete type" "" { target *-*-* } 0 } } + +// { dg-prune-output "invalid application of 'sizeof' to a void type" } +// { dg-prune-output "deleting 'void*' is undefined" } diff --git a/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc b/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc index 15437c7..b14c427 100644 --- a/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc +++ b/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc @@ -32,7 +32,7 @@ namespace std template<class Ptr> struct pointer_traits; template<class T> struct pointer_traits<T*>; - void* align(size_t alignment, size_t size, void*& ptr, size_t& space); + void* align(size_t alignment, size_t size, void*& ptr, size_t& space) noexcept; struct allocator_arg_t; extern const allocator_arg_t allocator_arg; diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc index 1852f01..215a139 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc @@ -31,3 +31,5 @@ void test01() using std::shared_ptr; using std::is_constructible; static_assert(!is_constructible<shared_ptr<void>, const void*>::value, ""); + +// { dg-prune-output "invalid application of 'sizeof' to a void type" } diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/creation/for_overwrite.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/creation/for_overwrite.cc index 65b5758..2eb3a99 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/creation/for_overwrite.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/creation/for_overwrite.cc @@ -41,8 +41,8 @@ void* operator new(std::size_t n) return p; } -void operator delete(void* p) { std::free(p); } -void operator delete(void* p, std::size_t) { std::free(p); } +void operator delete(void* p) noexcept { std::free(p); } +void operator delete(void* p, std::size_t) noexcept { std::free(p); } void test01() diff --git a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/103919.cc b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/103919.cc index 94400e3..c11036b 100644 --- a/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/103919.cc +++ b/libstdc++-v3/testsuite/21_strings/basic_string/cons/char/103919.cc @@ -14,12 +14,12 @@ void* operator new(std::size_t n) return std::malloc(n); } -void operator delete(void* p) +void operator delete(void* p) noexcept { std::free(p); } -void operator delete(void* p, std::size_t) +void operator delete(void* p, std::size_t) noexcept { std::free(p); } diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/emplace/92300.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/emplace/92300.cc index 937b4d9..ab48386 100644 --- a/libstdc++-v3/testsuite/23_containers/map/modifiers/emplace/92300.cc +++ b/libstdc++-v3/testsuite/23_containers/map/modifiers/emplace/92300.cc @@ -12,12 +12,12 @@ void* operator new(std::size_t n) return std::malloc(n); } -void operator delete(void* p) +void operator delete(void* p) noexcept { std::free(p); } -void operator delete(void* p, std::size_t) +void operator delete(void* p, std::size_t) noexcept { std::free(p); } diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/92300.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/92300.cc index 80abdaf..51c0138 100644 --- a/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/92300.cc +++ b/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/92300.cc @@ -12,12 +12,12 @@ void* operator new(std::size_t n) return std::malloc(n); } -void operator delete(void* p) +void operator delete(void* p) noexcept { std::free(p); } -void operator delete(void* p, std::size_t) +void operator delete(void* p, std::size_t) noexcept { std::free(p); } diff --git a/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++11.cc b/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++11.cc index 819bffa..c6262a5 100644 --- a/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++11.cc +++ b/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++11.cc @@ -28,6 +28,6 @@ namespace std template<class C> auto end(C& c) -> decltype(c.end()); template<class C> auto end(const C& c) -> decltype(c.end()); - template<class T, size_t N> T* begin(T (&array)[N]); - template<class T, size_t N> T* end(T (&array)[N]); + template<class T, size_t N> T* begin(T (&array)[N]) noexcept; + template<class T, size_t N> T* end(T (&array)[N]) noexcept; } diff --git a/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++14.cc b/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++14.cc index 425012f..81e6e84 100644 --- a/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++14.cc +++ b/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++14.cc @@ -28,8 +28,8 @@ namespace std template<class C> auto end(C& c) -> decltype(c.end()); template<class C> auto end(const C& c) -> decltype(c.end()); - template<class T, size_t N> constexpr T* begin(T (&array)[N]); - template<class T, size_t N> constexpr T* end(T (&array)[N]); + template<class T, size_t N> constexpr T* begin(T (&array)[N]) noexcept; + template<class T, size_t N> constexpr T* end(T (&array)[N]) noexcept; template<class C> auto cbegin(const C& c) -> decltype(c.begin()); template<class C> auto cend(const C& c) -> decltype(c.end()); @@ -41,14 +41,14 @@ namespace std template<class C> auto rend(const C& c) -> decltype(c.rend()); template<class T, size_t N> - reverse_iterator<T*> rbegin(T (&array)[N]); + reverse_iterator<T*> rbegin(T (&array)[N]) noexcept; template<class T, size_t N> - reverse_iterator<T*> rend(T (&array)[N]); + reverse_iterator<T*> rend(T (&array)[N]) noexcept; template<class E> - reverse_iterator<const E*> rbegin(initializer_list<E>); + reverse_iterator<const E*> rbegin(initializer_list<E>) noexcept; template<class E> - reverse_iterator<const E*> rend(initializer_list<E>); + reverse_iterator<const E*> rend(initializer_list<E>) noexcept; template<class C> auto crbegin(const C& c) -> decltype(std::rbegin(c)); diff --git a/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++17.cc b/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++17.cc index da65c11..9129594 100644 --- a/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++17.cc +++ b/libstdc++-v3/testsuite/24_iterators/headers/iterator/range_access_c++17.cc @@ -27,8 +27,8 @@ namespace std template<class C> constexpr auto end(C& c) -> decltype(c.end()); template<class C> constexpr auto end(const C& c) -> decltype(c.end()); - template<class T, size_t N> constexpr T* begin(T (&array)[N]); - template<class T, size_t N> constexpr T* end(T (&array)[N]); + template<class T, size_t N> constexpr T* begin(T (&array)[N]) noexcept; + template<class T, size_t N> constexpr T* end(T (&array)[N]) noexcept; template<class C> constexpr auto cbegin(const C& c) -> decltype(c.begin()); template<class C> constexpr auto cend(const C& c) -> decltype(c.end()); @@ -40,14 +40,14 @@ namespace std template<class C> constexpr auto rend(const C& c) -> decltype(c.rend()); template<class T, size_t N> - constexpr reverse_iterator<T*> rbegin(T (&array)[N]); + constexpr reverse_iterator<T*> rbegin(T (&array)[N]) noexcept; template<class T, size_t N> - constexpr reverse_iterator<T*> rend(T (&array)[N]); + constexpr reverse_iterator<T*> rend(T (&array)[N]) noexcept; template<class E> - constexpr reverse_iterator<const E*> rbegin(initializer_list<E>); + constexpr reverse_iterator<const E*> rbegin(initializer_list<E>) noexcept; template<class E> - constexpr reverse_iterator<const E*> rend(initializer_list<E>); + constexpr reverse_iterator<const E*> rend(initializer_list<E>) noexcept; template<class C> constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c)); |