public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-5716] libstdc++: Fix testsuite warnings about new C++23 deprecations
Date: Mon,  6 Feb 2023 14:25:37 +0000 (GMT)	[thread overview]
Message-ID: <20230206142537.D9571385417E@sourceware.org> (raw)

https://gcc.gnu.org/g:c76f55bf330e7cb823cb850aa2694b355038625f

commit r13-5716-gc76f55bf330e7cb823cb850aa2694b355038625f
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Feb 4 00:04:55 2023 +0000

    libstdc++: Fix testsuite warnings about new C++23 deprecations
    
    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.

Diff:
---
 libstdc++-v3/include/std/type_traits                               | 7 +++++++
 .../testsuite/20_util/aligned_storage/requirements/alias_decl.cc   | 3 +++
 .../20_util/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 ++
 .../testsuite/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 }

                 reply	other threads:[~2023-02-06 14:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230206142537.D9571385417E@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).