* [committed] libstdc++: Fix testsuite warnings about new C++23 deprecations
@ 2023-02-06 14:26 Jonathan Wakely
2023-02-07 9:25 ` [committed] testsuite: Expect -Wdeprecated warning in warn/Wstrict-aliasing-bogus-union-2.C for C++23 Jakub Jelinek
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2023-02-06 14:26 UTC (permalink / raw)
To: libstdc++, gcc-patches
Tested powerpc64le-linux. Pushed to trunk.
-- >8 --
With the recent change to deprecate std::aligned_storage and
std::aligned_union we need to adjust some tests that now fail with
-std=c++23.
libstdc++-v3/ChangeLog:
* include/std/type_traits: Add diagnostic pragmas around
references to deprecated std::aligned_storage and
std::aligned_union traits.
* testsuite/20_util/aligned_storage/requirements/alias_decl.cc:
Add dg-warning for et c++23.
* testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc:
Likewise.
* testsuite/20_util/aligned_storage/value.cc: Likewise.
* testsuite/20_util/aligned_union/1.cc: Likewise.
* testsuite/20_util/aligned_union/requirements/alias_decl.cc:
Likewise.
---
libstdc++-v3/include/std/type_traits | 7 +++++++
.../20_util/aligned_storage/requirements/alias_decl.cc | 3 +++
.../aligned_storage/requirements/explicit_instantiation.cc | 3 +++
libstdc++-v3/testsuite/20_util/aligned_storage/value.cc | 2 ++
libstdc++-v3/testsuite/20_util/aligned_union/1.cc | 2 ++
.../20_util/aligned_union/requirements/alias_decl.cc | 3 +++
6 files changed, 20 insertions(+)
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index d13af433a17..2bd607a8b8f 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -2123,6 +2123,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
? sizeof(_Tp) : __strictest_alignment<_Types...>::_S_size;
};
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+
/**
* @brief Provide aligned storage for types.
*
@@ -2155,6 +2158,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <size_t _Len, typename... _Types>
const size_t aligned_union<_Len, _Types...>::alignment_value;
+#pragma GCC diagnostic pop
/// @cond undocumented
@@ -2586,6 +2590,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ } _GLIBCXX17_DEPRECATED_SUGGEST("std::invoke_result");
#if __cplusplus >= 201402L
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/// Alias template for aligned_storage
template<size_t _Len, size_t _Align =
__alignof__(typename __aligned_storage_msa<_Len>::__type)>
@@ -2593,6 +2599,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <size_t _Len, typename... _Types>
using aligned_union_t _GLIBCXX23_DEPRECATED = typename aligned_union<_Len, _Types...>::type;
+#pragma GCC diagnostic pop
/// Alias template for decay
template<typename _Tp>
diff --git a/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/alias_decl.cc b/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/alias_decl.cc
index fc230b66a9d..2e8e90efcd7 100644
--- a/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/alias_decl.cc
+++ b/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/alias_decl.cc
@@ -26,3 +26,6 @@ using namespace std;
static_assert (is_same<typename aligned_storage<4>::type,
aligned_storage_t<4>>(),
"aligned_storage_t" );
+
+// { dg-warning "deprecated" "" { target c++23 } 26 }
+// { dg-warning "deprecated" "" { target c++23 } 27 }
diff --git a/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc
index 36dfe04b083..baec6667f30 100644
--- a/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/20_util/aligned_storage/requirements/explicit_instantiation.cc
@@ -29,3 +29,6 @@ namespace std
template struct aligned_storage<1, alignment_of<test_type>::value>;
template struct aligned_storage<2>;
}
+
+// { dg-warning "deprecated" "" { target c++23 } 29 }
+// { dg-warning "deprecated" "" { target c++23 } 30 }
diff --git a/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc b/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc
index 16a5580a6b7..6e9df7ffc5d 100644
--- a/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc
+++ b/libstdc++-v3/testsuite/20_util/aligned_storage/value.cc
@@ -59,3 +59,5 @@ void test01()
static_assert(sizeof(aligned_storage<5>::type) >= 5, "");
static_assert(__alignof__(aligned_storage<5>::type) == align_msa, "");
}
+
+// { dg-warning "deprecated" "" { target c++23 } 0 }
diff --git a/libstdc++-v3/testsuite/20_util/aligned_union/1.cc b/libstdc++-v3/testsuite/20_util/aligned_union/1.cc
index b779884dcc2..7501529cbf4 100644
--- a/libstdc++-v3/testsuite/20_util/aligned_union/1.cc
+++ b/libstdc++-v3/testsuite/20_util/aligned_union/1.cc
@@ -64,6 +64,8 @@ void test01()
static_assert(sizeof(au_type2::type) >= max_s+100,
"Storage size (at least len)");
}
+// { dg-warning "deprecated" "" { target c++23 } 57 }
+// { dg-warning "deprecated" "" { target c++23 } 62 }
int main()
{
diff --git a/libstdc++-v3/testsuite/20_util/aligned_union/requirements/alias_decl.cc b/libstdc++-v3/testsuite/20_util/aligned_union/requirements/alias_decl.cc
index 6790d2aa828..41f2b0881af 100644
--- a/libstdc++-v3/testsuite/20_util/aligned_union/requirements/alias_decl.cc
+++ b/libstdc++-v3/testsuite/20_util/aligned_union/requirements/alias_decl.cc
@@ -26,3 +26,6 @@ using namespace std;
static_assert (is_same<typename aligned_union<0, char, int>::type,
aligned_union_t<0, char, int>>(),
"aligned_union_t" );
+
+// { dg-warning "deprecated" "" { target c++23 } 26 }
+// { dg-warning "deprecated" "" { target c++23 } 27 }
--
2.39.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [committed] testsuite: Expect -Wdeprecated warning in warn/Wstrict-aliasing-bogus-union-2.C for C++23
2023-02-06 14:26 [committed] libstdc++: Fix testsuite warnings about new C++23 deprecations Jonathan Wakely
@ 2023-02-07 9:25 ` Jakub Jelinek
2023-02-07 16:36 ` Jonathan Wakely
0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2023-02-07 9:25 UTC (permalink / raw)
To: Jonathan Wakely, Jason Merrill; +Cc: gcc-patches
Hi!
On Mon, Feb 06, 2023 at 02:26:01PM +0000, Jonathan Wakely via Gcc-patches wrote:
> With the recent change to deprecate std::aligned_storage and
> std::aligned_union we need to adjust some tests that now fail with
> -std=c++23.
The g++.dg/warn/Wstrict-aliasing-bogus-union-2.C test is also affected:
PASS: g++.dg/warn/Wstrict-aliasing-bogus-union-2.C -std=gnu++2b (test for bogus messages, line 12)
FAIL: g++.dg/warn/Wstrict-aliasing-bogus-union-2.C -std=gnu++2b (test for excess errors)
Excess errors:
.../gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-union-2.C:8:8: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]
The following patch adds dg-warning for it.
Tested on x86_64-linux -m32/-m64 with GXX_TESTSUITE_STDS=98,11,14,17,20,2b ,
committed to trunk as obvious.
2023-02-07 Jakub Jelinek <jakub@redhat.com>
* g++.dg/warn/Wstrict-aliasing-bogus-union-2.C: Expect
-Wdeprecated warning for C++23.
--- gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-union-2.C.jj 2020-01-12 11:54:37.286400238 +0100
+++ gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-union-2.C 2023-02-07 10:21:47.616642483 +0100
@@ -5,7 +5,7 @@
struct foo
{
- std::aligned_storage<sizeof(long), alignof(long)>::type raw;
+ std::aligned_storage<sizeof(long), alignof(long)>::type raw; /* { dg-warning "deprecated" "" { target c++23 } } */
long& cooked()
{
Jakub
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [committed] testsuite: Expect -Wdeprecated warning in warn/Wstrict-aliasing-bogus-union-2.C for C++23
2023-02-07 9:25 ` [committed] testsuite: Expect -Wdeprecated warning in warn/Wstrict-aliasing-bogus-union-2.C for C++23 Jakub Jelinek
@ 2023-02-07 16:36 ` Jonathan Wakely
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2023-02-07 16:36 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jason Merrill, gcc-patches
On Tue, 7 Feb 2023 at 09:25, Jakub Jelinek <jakub@redhat.com> wrote:
>
> Hi!
>
> On Mon, Feb 06, 2023 at 02:26:01PM +0000, Jonathan Wakely via Gcc-patches wrote:
> > With the recent change to deprecate std::aligned_storage and
> > std::aligned_union we need to adjust some tests that now fail with
> > -std=c++23.
>
> The g++.dg/warn/Wstrict-aliasing-bogus-union-2.C test is also affected:
> PASS: g++.dg/warn/Wstrict-aliasing-bogus-union-2.C -std=gnu++2b (test for bogus messages, line 12)
> FAIL: g++.dg/warn/Wstrict-aliasing-bogus-union-2.C -std=gnu++2b (test for excess errors)
> Excess errors:
> .../gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-union-2.C:8:8: warning: 'template<long unsigned int _Len, long unsigned int _Align> struct std::aligned_storage' is deprecated [-Wdeprecated-declarations]
>
> The following patch adds dg-warning for it.
>
> Tested on x86_64-linux -m32/-m64 with GXX_TESTSUITE_STDS=98,11,14,17,20,2b ,
> committed to trunk as obvious.
Oops, sorry about that - I must remember to check the g++ tests for
any header and deprecation changes.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-07 16:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 14:26 [committed] libstdc++: Fix testsuite warnings about new C++23 deprecations Jonathan Wakely
2023-02-07 9:25 ` [committed] testsuite: Expect -Wdeprecated warning in warn/Wstrict-aliasing-bogus-union-2.C for C++23 Jakub Jelinek
2023-02-07 16:36 ` 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).