From caa39b2e842b03226551231688ef7190cbe44f89 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 9 Jan 2020 21:31:50 +0000 Subject: [PATCH] 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. From-SVN: r280066 --- libstdc++-v3/ChangeLog | 13 +++++++++++++ libstdc++-v3/include/experimental/type_traits | 3 +++ libstdc++-v3/include/std/type_traits | 3 +++ .../18_support/max_align_t/requirements/2.cc | 4 ++++ .../is_pod/requirements/explicit_instantiation.cc | 1 + .../20_util/is_pod/requirements/typedefs.cc | 1 + libstdc++-v3/testsuite/20_util/is_pod/value.cc | 1 + .../testsuite/experimental/type_traits/value.cc | 1 + 8 files changed, 27 insertions(+) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5725771bada..721b465b369 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2020-01-09 Jonathan Wakely + + * 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. + 2020-01-09 JeanHeyd "ThePhD" Meneide * include/bits/c++config (_GLIBCXX20_DEPRECATED): Add new macro. 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 constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value; template constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template constexpr bool is_pod_v = is_pod<_Tp>::value; +#pragma GCC diagnostic pop template constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; template 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 is_trivially_copyable<_Tp>::value; template inline constexpr bool is_standard_layout_v = is_standard_layout<_Tp>::value; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template _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 inline constexpr bool is_literal_type_v = is_literal_type<_Tp>::value; template 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 #include +#if __cplusplus <= 201703L static_assert (std::is_pod::value, ""); +#endif +static_assert (std::is_standard_layout::value, ""); +static_assert (std::is_trivial::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 // 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 // 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 // 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. // -- 2.30.2