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

commit r15-5760-gbb551f497e72b2c86733144568002ef8a7317ca3
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Wed Nov 27 23:36:03 2024 +0000

    libstdc++: Deprecate std::rel_ops namespace for C++20
    
    This is deprecated in the C++20 standard and will be removed at some
    point.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/stl_relops.h (rel_ops): Add deprecated attribute.
            * testsuite/20_util/headers/utility/using_namespace_std_rel_ops.cc:
            Add dg-warning for -Wdeprecated warnings.
            * testsuite/20_util/rel_ops.cc: Likewise.
            * testsuite/util/testsuite_containers.h: Disable -Wdeprecated
            warnings when using rel_ops.

Diff:
---
 libstdc++-v3/include/bits/stl_relops.h                           | 2 +-
 .../20_util/headers/utility/using_namespace_std_rel_ops.cc       | 2 +-
 libstdc++-v3/testsuite/20_util/rel_ops.cc                        | 2 +-
 libstdc++-v3/testsuite/util/testsuite_containers.h               | 9 +++++++++
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/include/bits/stl_relops.h 
b/libstdc++-v3/include/bits/stl_relops.h
index 06c85ca8da91..29e7af3c2504 100644
--- a/libstdc++-v3/include/bits/stl_relops.h
+++ b/libstdc++-v3/include/bits/stl_relops.h
@@ -63,7 +63,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-  namespace rel_ops
+  namespace rel_ops _GLIBCXX20_DEPRECATED_SUGGEST("<=>")
   {
     /** @namespace std::rel_ops
      *  @brief  The generated relational operators are sequestered here.
diff --git 
a/libstdc++-v3/testsuite/20_util/headers/utility/using_namespace_std_rel_ops.cc 
b/libstdc++-v3/testsuite/20_util/headers/utility/using_namespace_std_rel_ops.cc
index 330bde88d63e..b583eaa4713c 100644
--- 
a/libstdc++-v3/testsuite/20_util/headers/utility/using_namespace_std_rel_ops.cc
+++ 
b/libstdc++-v3/testsuite/20_util/headers/utility/using_namespace_std_rel_ops.cc
@@ -21,5 +21,5 @@
 
 namespace gnu
 {
-  using namespace std::rel_ops;
+  using namespace std::rel_ops; // { dg-warning "deprecated" "" { target c++20 
} }
 }
diff --git a/libstdc++-v3/testsuite/20_util/rel_ops.cc 
b/libstdc++-v3/testsuite/20_util/rel_ops.cc
index 711822966d3a..f84503293e1b 100644
--- a/libstdc++-v3/testsuite/20_util/rel_ops.cc
+++ b/libstdc++-v3/testsuite/20_util/rel_ops.cc
@@ -24,7 +24,7 @@
 #include <utility>
 #include <vector>
 
-using namespace std::rel_ops;
+using namespace std::rel_ops; // { dg-warning "deprecated" "" { target c++20 } 
}
 
 // libstdc++/3628
 void test01()
diff --git a/libstdc++-v3/testsuite/util/testsuite_containers.h 
b/libstdc++-v3/testsuite/util/testsuite_containers.h
index 4dd78d4ec9d7..f48bb54f140a 100644
--- a/libstdc++-v3/testsuite/util/testsuite_containers.h
+++ b/libstdc++-v3/testsuite/util/testsuite_containers.h
@@ -183,9 +183,12 @@ namespace __gnu_test
     {
       forward_members_unordered(const typename _Tp::value_type& v)
       {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
        // Make sure that even if rel_ops is injected there is no ambiguity
        // when comparing iterators.
        using namespace std::rel_ops;
+#pragma GCC diagnostic pop
 
        typedef _Tp                                     test_type;
        test_type container;
@@ -283,9 +286,12 @@ namespace __gnu_test
     {
       forward_members(_Tp& container)
       {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
        // Make sure that even if rel_ops is injected there is no ambiguity
        // when comparing iterators.
        using namespace std::rel_ops;
+#pragma GCC diagnostic pop
 
        typedef traits<_Tp> traits_type;
        iterator_concept_checks<typename _Tp::iterator,
@@ -318,9 +324,12 @@ namespace __gnu_test
       category_members(_Tp& container)
        : forward_members<_Tp>(container)
       {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
        // Make sure that even if rel_ops is injected there is no ambiguity
        // when comparing iterators.
        using namespace std::rel_ops;
+#pragma GCC diagnostic pop
 
        assert( !(container.begin() < container.begin()) );
        assert( !(container.cbegin() < container.cbegin()) );

Reply via email to