From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 5F3B33860C39 for ; Thu, 29 Oct 2020 22:51:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5F3B33860C39 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-275-KfEa7WiMMNqeI3GYyRp3QQ-1; Thu, 29 Oct 2020 18:51:54 -0400 X-MC-Unique: KfEa7WiMMNqeI3GYyRp3QQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A1DD1018F79; Thu, 29 Oct 2020 22:51:53 +0000 (UTC) Received: from localhost (unknown [10.33.36.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id E42D35B4B5; Thu, 29 Oct 2020 22:51:52 +0000 (UTC) Date: Thu, 29 Oct 2020 22:51:51 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Prevent deprecation warnings from Message-ID: <20201029225151.GA2466074@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="k1lZvvs/B4yU6o8G" Content-Disposition: inline X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2020 22:51:58 -0000 --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. Tested powerpc64le-linux. Committed to trunk. --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit 52ddf0d458f063f6c9e07e726f9b46206f71e4c4 Author: Jonathan Wakely Date: Thu Oct 29 22:47:22 2020 libstdc++: Prevent deprecation warnings from 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 --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 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 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 @@ -629,6 +636,8 @@ namespace tr1 } #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template __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 explicit shared_ptr(std::auto_ptr<_Tp1>& __r) : __shared_ptr<_Tp>(__r) { } +#pragma GCC diagnostic pop #endif template @@ -1033,6 +1046,8 @@ namespace tr1 } #if (__cplusplus < 201103L) || _GLIBCXX_USE_DEPRECATED +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template 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 p1(px); // { dg-error "here" } - // { dg-error "incomplete" "" { target *-*-* } 554 } + // { dg-error "incomplete" "" { target *-*-* } 559 } std::tr1::shared_ptr p9(ap()); // { dg-error "here" } - // { dg-error "incomplete" "" { target *-*-* } 593 } + // { dg-error "incomplete" "" { target *-*-* } 600 } } // Ignore additional diagnostic given with -Wsystem-headers: --k1lZvvs/B4yU6o8G--