From d873810ee491a05240d05d18b43c28a749290ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Lemaignan?= Date: Thu, 14 Jan 2016 09:45:14 +0000 Subject: [PATCH] Add pragma guards around deprecated auto_ptr to prevent GCC warnings Fixes #67 --- dlib/smart_pointers/shared_ptr.h | 6 ++++++ dlib/smart_pointers/shared_ptr_thread_safe.h | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/dlib/smart_pointers/shared_ptr.h b/dlib/smart_pointers/shared_ptr.h index a9b04b483..b37852250 100644 --- a/dlib/smart_pointers/shared_ptr.h +++ b/dlib/smart_pointers/shared_ptr.h @@ -294,6 +294,8 @@ namespace dlib shared_node->ref_count += 1; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template explicit shared_ptr( std::auto_ptr& r @@ -308,6 +310,7 @@ namespace dlib shared_node->del = new default_deleter; data = r.release(); } +#pragma GCC diagnostic pop shared_ptr& operator= ( const shared_ptr& r @@ -326,6 +329,8 @@ namespace dlib return *this; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template shared_ptr& operator= ( std::auto_ptr& r @@ -343,6 +348,7 @@ namespace dlib data = r.release(); return *this; } +#pragma GCC diagnostic pop void reset() { diff --git a/dlib/smart_pointers/shared_ptr_thread_safe.h b/dlib/smart_pointers/shared_ptr_thread_safe.h index 4aaec816d..ae975c1d9 100644 --- a/dlib/smart_pointers/shared_ptr_thread_safe.h +++ b/dlib/smart_pointers/shared_ptr_thread_safe.h @@ -257,7 +257,8 @@ namespace dlib } } - +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template explicit shared_ptr_thread_safe( std::auto_ptr& r @@ -271,6 +272,7 @@ namespace dlib shared_node = new shared_ptr_thread_safe_node; data = r.release(); } +#pragma GCC diagnostic push shared_ptr_thread_safe& operator= ( const shared_ptr_thread_safe& r @@ -289,6 +291,8 @@ namespace dlib return *this; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" template shared_ptr_thread_safe& operator= ( std::auto_ptr& r @@ -305,6 +309,7 @@ namespace dlib data = r.release(); return *this; } +#pragma GCC diagnostic push void reset() {