This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [ PATCH ] [ C++ ] Implementing P0767 - deprecate POD
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: JeanHeyd Meneide <phdofthehouse at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 9 Jan 2020 21:20:50 +0000
- Subject: Re: [ PATCH ] [ C++ ] Implementing P0767 - deprecate POD
- References: <CANHA4OgUjYbXmqN=M0Rvc+=ju2obD0-JH+s8Xbj6AeisCL7Ztw@mail.gmail.com> <20191204214722.GK11522@redhat.com> <CANHA4Ohe0zupZ94HHNobjMnUfp7NmBc9jbe8Fh2U-m5NYm47TA@mail.gmail.com> <20200109195745.GY490107@redhat.com>
On 09/01/20 19:57 +0000, Jonathan Wakely wrote:
I'll commit the attached patch after more testing.
And this follow-up to fix some fallout.
commit 212e166cbeb4c7df38436563c3c51dbd4e0efc0d
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Jan 9 19:55:17 2020 +0000
libstdc++: Fix testsuite failures and warnings due to is_pod deprecation
With -std=gnu++2a and -Wsystem-headers the std::is_pod deprecation
causes some new diagnostics. This suppresses them.
* include/experimental/type_traits (experimental::is_pod_v): Disable
-Wdeprecated-declarations warnings around reference to std::is_pod.
* include/std/type_traits (is_pod_v): Likewise.
* testsuite/18_support/max_align_t/requirements/2.cc: Also check
is_standard_layout and is_trivial. Do not check is_pod for C++20.
* testsuite/20_util/is_pod/requirements/explicit_instantiation.cc:
Add -Wno-deprecated for C++20.
* testsuite/20_util/is_pod/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_pod/value.cc: Likewise.
* testsuite/experimental/type_traits/value.cc: Likewise.
diff --git a/libstdc++-v3/include/experimental/type_traits b/libstdc++-v3/include/experimental/type_traits
index a84ddd45ff1..a92c385c029 100644
--- a/libstdc++-v3/include/experimental/type_traits
+++ b/libstdc++-v3/include/experimental/type_traits
@@ -110,8 +110,11 @@ template <typename _Tp>
constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value;
template <typename _Tp>
constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
template <typename _Tp>
constexpr bool is_pod_v = is_pod<_Tp>::value;
+#pragma GCC diagnostic pop
template <typename _Tp>
constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
template <typename _Tp>
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits
index c69867c2ae0..6aa2cedfa0a 100644
--- a/libstdc++-v3/include/std/type_traits
+++ b/libstdc++-v3/include/std/type_traits
@@ -3079,9 +3079,12 @@ template <typename _Tp>
is_trivially_copyable<_Tp>::value;
template <typename _Tp>
inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
template <typename _Tp>
_GLIBCXX20_DEPRECATED("use is_standard_layout_v && is_trivial_v instead")
inline constexpr bool is_pod_v = is_pod<_Tp>::value;
+#pragma GCC diagnostic pop
template <typename _Tp>
inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value;
template <typename _Tp>
diff --git a/libstdc++-v3/testsuite/18_support/max_align_t/requirements/2.cc b/libstdc++-v3/testsuite/18_support/max_align_t/requirements/2.cc
index 97036ed3134..7e496967156 100644
--- a/libstdc++-v3/testsuite/18_support/max_align_t/requirements/2.cc
+++ b/libstdc++-v3/testsuite/18_support/max_align_t/requirements/2.cc
@@ -20,4 +20,8 @@
#include <cstddef>
#include <type_traits>
+#if __cplusplus <= 201703L
static_assert (std::is_pod<std::max_align_t>::value, "");
+#endif
+static_assert (std::is_standard_layout<std::max_align_t>::value, "");
+static_assert (std::is_trivial<std::max_align_t>::value, "");
diff --git a/libstdc++-v3/testsuite/20_util/is_pod/requirements/explicit_instantiation.cc b/libstdc++-v3/testsuite/20_util/is_pod/requirements/explicit_instantiation.cc
index 7ee41b33d7c..b41a59338bb 100644
--- a/libstdc++-v3/testsuite/20_util/is_pod/requirements/explicit_instantiation.cc
+++ b/libstdc++-v3/testsuite/20_util/is_pod/requirements/explicit_instantiation.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-deprecated" { target { c++2a } } }
// 2010-02-21 Paolo Carlini <paolo.carlini@oracle.com>
// Copyright (C) 2010-2020 Free Software Foundation, Inc.
diff --git a/libstdc++-v3/testsuite/20_util/is_pod/requirements/typedefs.cc b/libstdc++-v3/testsuite/20_util/is_pod/requirements/typedefs.cc
index 492f0ea956f..888895719b7 100644
--- a/libstdc++-v3/testsuite/20_util/is_pod/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/20_util/is_pod/requirements/typedefs.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-deprecated" { target { c++2a } } }
// 2010-02-21 Paolo Carlini <paolo.carlini@oracle.com>
//
diff --git a/libstdc++-v3/testsuite/20_util/is_pod/value.cc b/libstdc++-v3/testsuite/20_util/is_pod/value.cc
index 5a856309ad5..659d9d4d8ae 100644
--- a/libstdc++-v3/testsuite/20_util/is_pod/value.cc
+++ b/libstdc++-v3/testsuite/20_util/is_pod/value.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++11 } }
+// { dg-additional-options "-Wno-deprecated" { target { c++2a } } }
// 2010-02-21 Paolo Carlini <pcarlini@suse.de>
//
diff --git a/libstdc++-v3/testsuite/experimental/type_traits/value.cc b/libstdc++-v3/testsuite/experimental/type_traits/value.cc
index 156753b4b5e..0e1176dd14a 100644
--- a/libstdc++-v3/testsuite/experimental/type_traits/value.cc
+++ b/libstdc++-v3/testsuite/experimental/type_traits/value.cc
@@ -1,4 +1,5 @@
// { dg-do compile { target c++14 } }
+// { dg-additional-options "-Wno-deprecated" { target { c++2a } } }
// Copyright (C) 2014-2020 Free Software Foundation, Inc.
//