public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3818] libstdc++: Fix -Wsystem-headers warnings in tests
@ 2022-11-08 17:46 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-11-08 17:46 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:bbcb84bba0a21ff367c95d3d0970926992b20cdd
commit r13-3818-gbbcb84bba0a21ff367c95d3d0970926992b20cdd
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Nov 7 15:00:34 2022 +0000
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.
Diff:
---
libstdc++-v3/testsuite/18_support/new_nothrow.cc | 14 ++++++++++----
libstdc++-v3/testsuite/20_util/any/cons/92156.cc | 1 +
libstdc++-v3/testsuite/20_util/any/modifiers/92156.cc | 1 +
libstdc++-v3/testsuite/20_util/default_delete/void_neg.cc | 3 +++
| 2 +-
libstdc++-v3/testsuite/20_util/shared_ptr/cons/void_neg.cc | 2 ++
.../testsuite/20_util/unique_ptr/creation/for_overwrite.cc | 4 ++--
.../testsuite/21_strings/basic_string/cons/char/103919.cc | 4 ++--
.../testsuite/23_containers/map/modifiers/emplace/92300.cc | 4 ++--
.../testsuite/23_containers/map/modifiers/insert/92300.cc | 4 ++--
| 4 ++--
| 12 ++++++------
| 12 ++++++------
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 d5e7eb58782..37806122bd0 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 71e9dd94090..0e768df9a00 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 d8f9893667b..b98d0e8e92a 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 f6aefc0a7ff..04042c2d745 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" }
--git a/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc b/libstdc++-v3/testsuite/20_util/headers/memory/synopsis.cc
index 15437c72ee0..b14c4278cd3 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 1852f01e606..215a1393f57 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 65b5758b2ab..2eb3a9980a5 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 94400e319ff..c11036b49c5 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 937b4d9a103..ab48386bd8b 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 80abdaf1f30..51c0138e1a3 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);
}
--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 819bffa9c65..c6262a5a3be 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;
}
--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 425012f2d08..81e6e84819f 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));
--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 da65c11f3a7..91295943682 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));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-08 17:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 17:46 [gcc r13-3818] libstdc++: Fix -Wsystem-headers warnings in tests Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).