public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-4551] libstdc++: Prevent deprecation warnings from <tr1/shared_ptr>
@ 2020-10-29 22:50 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-10-29 22:50 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:52ddf0d458f063f6c9e07e726f9b46206f71e4c4

commit r11-4551-g52ddf0d458f063f6c9e07e726f9b46206f71e4c4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Oct 29 22:47:22 2020 +0000

    libstdc++: Prevent deprecation warnings from <tr1/shared_ptr>
    
    libstdc++-v3/ChangeLog:
    
            * include/tr1/shared_ptr.h (__shared_count, __shared_ptr)
            (shared_ptr): Add diagnostic pragmas around uses of auto_ptr.
            * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc:
            Adust dg-error line numbers.

Diff:
---
 libstdc++-v3/include/tr1/shared_ptr.h                  | 18 +++++++++++++++++-
 .../2_general_utilities/shared_ptr/cons/43820_neg.cc   |  4 ++--
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/include/tr1/shared_ptr.h b/libstdc++-v3/include/tr1/shared_ptr.h
index 4c9372de11a..4d018df7da8 100644
--- a/libstdc++-v3/include/tr1/shared_ptr.h
+++ b/libstdc++-v3/include/tr1/shared_ptr.h
@@ -321,6 +321,9 @@ namespace tr1
 	    }
 	}
 
+#if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
       // Special case for auto_ptr<_Tp> to provide the strong guarantee.
       template<typename _Tp>
         explicit
@@ -328,6 +331,8 @@ namespace tr1
 	: _M_pi(new _Sp_counted_base_impl<_Tp*,
 		_Sp_deleter<_Tp>, _Lp >(__r.get(), _Sp_deleter<_Tp>()))
         { __r.release(); }
+#pragma GCC diagnostic pop
+#endif
 
       // Throw bad_weak_ptr when __r._M_get_use_count() == 0.
       explicit
@@ -583,6 +588,8 @@ namespace tr1
 	}
 
 #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
       // Postcondition: use_count() == 1 and __r.get() == 0
       template<typename _Tp1>
         explicit
@@ -595,7 +602,7 @@ namespace tr1
 	  _M_refcount = __shared_count<_Lp>(__r);
 	  __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);
 	}
-
+#pragma GCC diagnostic pop
 #endif
 
       template<typename _Tp1>
@@ -629,6 +636,8 @@ namespace tr1
 	}
 
 #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
       template<typename _Tp1>
         __shared_ptr&
         operator=(std::auto_ptr<_Tp1>& __r)
@@ -636,6 +645,7 @@ namespace tr1
 	  __shared_ptr(__r).swap(*this);
 	  return *this;
 	}
+#pragma GCC diagnostic pop
 #endif
 
       void
@@ -1006,10 +1016,13 @@ namespace tr1
 	: __shared_ptr<_Tp>(__r) { }
 
 #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
       template<typename _Tp1>
         explicit
         shared_ptr(std::auto_ptr<_Tp1>& __r)
 	: __shared_ptr<_Tp>(__r) { }
+#pragma GCC diagnostic pop
 #endif
 
       template<typename _Tp1>
@@ -1033,6 +1046,8 @@ namespace tr1
 	}
 
 #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
       template<typename _Tp1>
         shared_ptr&
         operator=(std::auto_ptr<_Tp1>& __r)
@@ -1040,6 +1055,7 @@ namespace tr1
 	  this->__shared_ptr<_Tp>::operator=(__r);
 	  return *this;
 	}
+#pragma GCC diagnostic pop
 #endif
     };
 
diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc
index c1c503022c1..6310be7a2a5 100644
--- a/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc
+++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc
@@ -32,10 +32,10 @@ void test01()
 {
   X* px = 0;
   std::tr1::shared_ptr<X> p1(px);   // { dg-error "here" }
-  // { dg-error "incomplete" "" { target *-*-* } 554 }
+  // { dg-error "incomplete" "" { target *-*-* } 559 }
 
   std::tr1::shared_ptr<X> p9(ap());  // { dg-error "here" }
-  // { dg-error "incomplete" "" { target *-*-* } 593 }
+  // { dg-error "incomplete" "" { target *-*-* } 600 }
 }
 
 // Ignore additional diagnostic given with -Wsystem-headers:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-29 22:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 22:50 [gcc r11-4551] libstdc++: Prevent deprecation warnings from <tr1/shared_ptr> 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).