summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2020-12-08 08:45:09 +0100
committerJohnny Willemsen <jwillemsen@remedy.nl>2020-12-08 08:45:09 +0100
commit4584f1597edc14464b396c712b517543d18fb0b6 (patch)
treead48b7f6b1a05a6f22fb5962d06383d46471a3de
parentecffd1e315cf811a5a6575843bc0775e81778bb7 (diff)
downloadATCD-4584f1597edc14464b396c712b517543d18fb0b6.tar.gz
Replace auto_ptr with unique_ptr
-rw-r--r--ACE/tests/Bug_1890_Regression_Test.cpp2
-rw-r--r--ACE/tests/Compiler_Features_09_Test.cpp9
-rw-r--r--ACE/tests/Compiler_Features_10_Test.cpp2
-rw-r--r--ACE/tests/Future_Set_Test.cpp2
-rw-r--r--ACE/tests/Future_Test.cpp2
-rw-r--r--ACE/tests/Malloc_Test.cpp2
-rw-r--r--ACE/tests/Network_Adapters_Test.cpp2
-rw-r--r--ACE/tests/Notify_Performance_Test.cpp10
-rw-r--r--ACE/tests/Priority_Reactor_Test.cpp10
-rw-r--r--ACE/tests/Proactor_Timer_Test.cpp2
-rw-r--r--ACE/tests/Reactor_Notify_Test.cpp4
-rw-r--r--ACE/tests/Reactor_Performance_Test.cpp22
-rw-r--r--ACE/tests/Reactor_Remove_Resume_Test.cpp8
-rw-r--r--ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp8
-rw-r--r--ACE/tests/Reactor_Timer_Test.cpp2
-rw-r--r--ACE/tests/Refcounted_Auto_Ptr_Test.cpp4
-rw-r--r--ACE/tests/UUID_Test.cpp4
17 files changed, 51 insertions, 44 deletions
diff --git a/ACE/tests/Bug_1890_Regression_Test.cpp b/ACE/tests/Bug_1890_Regression_Test.cpp
index c49399f95d5..492b246937d 100644
--- a/ACE/tests/Bug_1890_Regression_Test.cpp
+++ b/ACE/tests/Bug_1890_Regression_Test.cpp
@@ -101,7 +101,7 @@ run_main (int, ACE_TCHAR *[])
// regardless of platform.
ACE_Select_Reactor *impl_ptr = 0;
ACE_NEW_RETURN (impl_ptr, ACE_Select_Reactor, -1);
- auto_ptr<ACE_Select_Reactor> auto_impl (impl_ptr);
+ unique_ptr<ACE_Select_Reactor> auto_impl (impl_ptr);
ACE_Reactor reactor (impl_ptr);
diff --git a/ACE/tests/Compiler_Features_09_Test.cpp b/ACE/tests/Compiler_Features_09_Test.cpp
index eb38413cd6e..c765724237a 100644
--- a/ACE/tests/Compiler_Features_09_Test.cpp
+++ b/ACE/tests/Compiler_Features_09_Test.cpp
@@ -14,6 +14,7 @@
// The first part of the test is to compile this line. If the program
// does not compile the platform is just too broken.
#include <memory>
+#include <utility>
// For extra challenge, we use the anonymous namespace
namespace
@@ -64,8 +65,8 @@ run_main (int, ACE_TCHAR *[])
// ... this works with the ACE version of auto_ptr (well, the
// namespace is broken, but you get the idea) ...
- std::auto_ptr<Base> x(new Base);
- std::auto_ptr<Derived> y(new Derived);
+ std::unique_ptr<Base> x(new Base);
+ std::unique_ptr<Derived> y(new Derived);
// ... with a compliant implementation of std::auto_ptr<> you should be
// able to write:
@@ -85,8 +86,8 @@ run_main (int, ACE_TCHAR *[])
Base::destructors));
}
- std::auto_ptr<Base> z;
- z = x;
+ std::unique_ptr<Base> z;
+ z = std::move(x);
if (Base::destructors != 1)
{
status = 1;
diff --git a/ACE/tests/Compiler_Features_10_Test.cpp b/ACE/tests/Compiler_Features_10_Test.cpp
index 6882b316315..5c5ed2a6b60 100644
--- a/ACE/tests/Compiler_Features_10_Test.cpp
+++ b/ACE/tests/Compiler_Features_10_Test.cpp
@@ -184,7 +184,7 @@ run_main (int, ACE_TCHAR *[])
{
// ... start the test fresh ...
reset_counts();
- std::auto_ptr<Aggregate> b(new Aggregate);
+ std::unique_ptr<Aggregate> b(new Aggregate);
never_reached(__FILE__, __LINE__);
}
catch(...)
diff --git a/ACE/tests/Future_Set_Test.cpp b/ACE/tests/Future_Set_Test.cpp
index f2040536dfd..bd5706e3da7 100644
--- a/ACE/tests/Future_Set_Test.cpp
+++ b/ACE/tests/Future_Set_Test.cpp
@@ -283,7 +283,7 @@ Prime_Scheduler::svc (void)
{
// Dequeue the next method request (we use an auto pointer in
// case an exception is thrown in the <call>).
- auto_ptr<ACE_Method_Request> mo (this->activation_queue_.dequeue ());
+ unique_ptr<ACE_Method_Request> mo (this->activation_queue_.dequeue ());
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) calling method request\n")));
diff --git a/ACE/tests/Future_Test.cpp b/ACE/tests/Future_Test.cpp
index dc2b9e014f2..55f170d0e37 100644
--- a/ACE/tests/Future_Test.cpp
+++ b/ACE/tests/Future_Test.cpp
@@ -289,7 +289,7 @@ Prime_Scheduler::svc (void)
{
// Dequeue the next method request (we use an auto pointer in
// case an exception is thrown in the <call>).
- auto_ptr<ACE_Method_Request> mo (this->activation_queue_.dequeue ());
+ unique_ptr<ACE_Method_Request> mo (this->activation_queue_.dequeue ());
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) calling method request\n")));
diff --git a/ACE/tests/Malloc_Test.cpp b/ACE/tests/Malloc_Test.cpp
index 02b6854d416..450f881a727 100644
--- a/ACE/tests/Malloc_Test.cpp
+++ b/ACE/tests/Malloc_Test.cpp
@@ -87,7 +87,7 @@ static const void *CHILD_BASE_ADDR =
static MALLOC *
myallocator (const void *base_addr = 0)
{
- static auto_ptr<MALLOC> static_allocator;
+ static unique_ptr<MALLOC> static_allocator;
if (static_allocator.get () == 0)
{
diff --git a/ACE/tests/Network_Adapters_Test.cpp b/ACE/tests/Network_Adapters_Test.cpp
index 395b49cf117..efedaba8c77 100644
--- a/ACE/tests/Network_Adapters_Test.cpp
+++ b/ACE/tests/Network_Adapters_Test.cpp
@@ -1046,7 +1046,7 @@ run_main (int argc, ACE_TCHAR *argv[])
// to do it right in at least one test. Notice the lack of
// ACE_NEW_RETURN, that monstrosity has no business in proper C++
// code ...
- auto_ptr<ACE_Timer_Heap_Variable_Time_Source> tq(
+ unique_ptr<ACE_Timer_Heap_Variable_Time_Source> tq(
new ACE_Timer_Heap_Variable_Time_Source);
// ... notice how the policy is in the derived timer queue type.
// The abstract timer queue does not have a time policy ...
diff --git a/ACE/tests/Notify_Performance_Test.cpp b/ACE/tests/Notify_Performance_Test.cpp
index 032fd219027..5d30ca5f166 100644
--- a/ACE/tests/Notify_Performance_Test.cpp
+++ b/ACE/tests/Notify_Performance_Test.cpp
@@ -13,6 +13,8 @@
//=============================================================================
+#include <utility>
+
#include "test_config.h"
#include "ace/Profile_Timer.h"
#include "ace/Get_Opt.h"
@@ -191,15 +193,15 @@ run_main (int argc, ACE_TCHAR *argv[])
create_reactor ();
// Manage memory automagically.
- auto_ptr<ACE_Reactor> reactor (ACE_Reactor::instance ());
- auto_ptr<ACE_Reactor_Impl> impl;
+ unique_ptr<ACE_Reactor> reactor (ACE_Reactor::instance ());
+ unique_ptr<ACE_Reactor_Impl> impl;
// If we are using other that the default implementation, we must
// clean up.
if (opt_select_reactor || opt_wfmo_reactor || opt_dev_poll_reactor)
{
- auto_ptr<ACE_Reactor_Impl> auto_impl (ACE_Reactor::instance ()->implementation ());
- impl = auto_impl;
+ unique_ptr<ACE_Reactor_Impl> auto_impl (ACE_Reactor::instance ()->implementation ());
+ impl = std::move(auto_impl);
}
// Callback object
diff --git a/ACE/tests/Priority_Reactor_Test.cpp b/ACE/tests/Priority_Reactor_Test.cpp
index 37fd07c07da..493be83e9ff 100644
--- a/ACE/tests/Priority_Reactor_Test.cpp
+++ b/ACE/tests/Priority_Reactor_Test.cpp
@@ -28,8 +28,10 @@
#include "ace/Auto_Ptr.h"
#include "ace/Priority_Reactor.h"
#include "Priority_Reactor_Test.h"
+
#include "ace/OS_NS_sys_wait.h"
#include "ace/OS_NS_unistd.h"
+#include <utility>
@@ -271,19 +273,19 @@ run_main (int argc, ACE_TCHAR *argv[])
// Note: If opt_priority_reactor is false, the default ACE_Reactor is used
// and we don't need to set one up.
ACE_Reactor *orig_reactor = 0;
- auto_ptr<ACE_Reactor> reactor;
+ unique_ptr<ACE_Reactor> reactor;
if (opt_priority_reactor)
{
ACE_Select_Reactor *impl_ptr;
ACE_NEW_RETURN (impl_ptr, ACE_Priority_Reactor, -1);
- auto_ptr<ACE_Select_Reactor> auto_impl (impl_ptr);
+ unique_ptr<ACE_Select_Reactor> auto_impl (impl_ptr);
ACE_Reactor *reactor_ptr;
ACE_NEW_RETURN (reactor_ptr, ACE_Reactor (impl_ptr, 1), -1);
auto_impl.release (); // ACE_Reactor dtor will take it from here
- auto_ptr<ACE_Reactor> auto_reactor (reactor_ptr);
- reactor = auto_reactor;
+ unique_ptr<ACE_Reactor> auto_reactor (reactor_ptr);
+ reactor = std::move(auto_reactor);
orig_reactor = ACE_Reactor::instance (reactor_ptr);
}
diff --git a/ACE/tests/Proactor_Timer_Test.cpp b/ACE/tests/Proactor_Timer_Test.cpp
index e13b01b9ff4..a1504f02f5c 100644
--- a/ACE/tests/Proactor_Timer_Test.cpp
+++ b/ACE/tests/Proactor_Timer_Test.cpp
@@ -310,7 +310,7 @@ run_main (int argc, ACE_TCHAR *[])
// code ...
typedef ACE_Timer_Heap_T<ACE_Handler*,ACE_Proactor_Handle_Timeout_Upcall,ACE_SYNCH_RECURSIVE_MUTEX,ACE_FPointer_Time_Policy> Timer_Queue;
- auto_ptr<Timer_Queue> tq(new Timer_Queue);
+ unique_ptr<Timer_Queue> tq(new Timer_Queue);
// ... notice how the policy is in the derived timer queue type.
// The abstract timer queue does not have a time policy ...
tq->set_time_policy(&ACE_High_Res_Timer::gettimeofday_hr);
diff --git a/ACE/tests/Reactor_Notify_Test.cpp b/ACE/tests/Reactor_Notify_Test.cpp
index 38207bf6aff..41ff9e0b573 100644
--- a/ACE/tests/Reactor_Notify_Test.cpp
+++ b/ACE/tests/Reactor_Notify_Test.cpp
@@ -364,7 +364,7 @@ run_test (int disable_notify_pipe,
-1);
// Make sure this stuff gets cleaned up when this function exits.
- auto_ptr<ACE_Reactor> r (reactor);
+ unique_ptr<ACE_Reactor> r (reactor);
// Set the Singleton Reactor.
ACE_Reactor *orig_reactor = ACE_Reactor::instance (reactor);
@@ -465,7 +465,7 @@ run_notify_purge_test (void)
Purged_Notify *n2;
ACE_NEW_RETURN (n2, Purged_Notify, -1);
- auto_ptr<Purged_Notify> ap (n2);
+ unique_ptr<Purged_Notify> ap (n2);
// First test:
// Notify EXCEPT, and purge ALL
diff --git a/ACE/tests/Reactor_Performance_Test.cpp b/ACE/tests/Reactor_Performance_Test.cpp
index c241ebfeb3c..6d72c2fad47 100644
--- a/ACE/tests/Reactor_Performance_Test.cpp
+++ b/ACE/tests/Reactor_Performance_Test.cpp
@@ -13,16 +13,18 @@
#include "test_config.h"
#include "Reactor_Performance_Test.h"
-#include "ace/Profile_Timer.h"
-#include "ace/Get_Opt.h"
-#include "ace/SOCK_Connector.h"
-#include "ace/SOCK_Acceptor.h"
+
#include "ace/Acceptor.h"
+#include "ace/Auto_Ptr.h"
#include "ace/Connector.h"
+#include "ace/Get_Opt.h"
+#include "ace/Profile_Timer.h"
#include "ace/Reactor.h"
-#include "ace/WFMO_Reactor.h"
+#include "ace/SOCK_Acceptor.h"
+#include "ace/SOCK_Connector.h"
#include "ace/Select_Reactor.h"
-#include "ace/Auto_Ptr.h"
+#include "ace/WFMO_Reactor.h"
+#include <utility>
#if defined (ACE_HAS_THREADS) && !defined ACE_LACKS_ACCEPT
@@ -333,15 +335,15 @@ run_main (int argc, ACE_TCHAR *argv[])
create_reactor ();
// Manage memory automagically.
- auto_ptr<ACE_Reactor> reactor (ACE_Reactor::instance ());
- auto_ptr<ACE_Reactor_Impl> impl;
+ unique_ptr<ACE_Reactor> reactor (ACE_Reactor::instance ());
+ unique_ptr<ACE_Reactor_Impl> impl;
// If we are using other that the default implementation, we must
// clean up.
if (opt_select_reactor || opt_wfmo_reactor)
{
- auto_ptr<ACE_Reactor_Impl> auto_impl (ACE_Reactor::instance ()->implementation ());
- impl = auto_impl;
+ unique_ptr<ACE_Reactor_Impl> auto_impl (ACE_Reactor::instance ()->implementation ());
+ impl = std::move(auto_impl);
}
Read_Handler::set_countdown (opt_nconnections);
diff --git a/ACE/tests/Reactor_Remove_Resume_Test.cpp b/ACE/tests/Reactor_Remove_Resume_Test.cpp
index ff2bd3898ad..b36ebe18cd2 100644
--- a/ACE/tests/Reactor_Remove_Resume_Test.cpp
+++ b/ACE/tests/Reactor_Remove_Resume_Test.cpp
@@ -362,15 +362,15 @@ handle_events (ACE_Reactor & reactor,
// ------------------------------------------------------------
-typedef auto_ptr<ACE_Reactor_Impl> (*reactor_factory_type) (void);
+typedef unique_ptr<ACE_Reactor_Impl> (*reactor_factory_type) (void);
-auto_ptr<ACE_Reactor_Impl>
+unique_ptr<ACE_Reactor_Impl>
tp_reactor_factory (void)
{
ACE_DEBUG ((LM_INFO,
ACE_TEXT ("Creating ACE_TP_Reactor.\n")));
- return auto_ptr<ACE_Reactor_Impl> (new ACE_TP_Reactor);
+ return unique_ptr<ACE_Reactor_Impl> (new ACE_TP_Reactor);
}
// ------------------------------------------------------------
@@ -412,7 +412,7 @@ struct Run_Test : public std::unary_function<reactor_factory_type, void>
ACE_TEXT ("** Running removal test **\n")));
}
- auto_ptr<ACE_Reactor_Impl> the_factory (factory ());
+ unique_ptr<ACE_Reactor_Impl> the_factory (factory ());
ACE_Reactor reactor (the_factory.get ());
// In this test, it's only okay to close the Bogus_Handler
diff --git a/ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp b/ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp
index 083dda5e5ff..0295bdd08a8 100644
--- a/ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp
+++ b/ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp
@@ -366,15 +366,15 @@ handle_events (ACE_Reactor & reactor,
// ------------------------------------------------------------
-typedef auto_ptr<ACE_Reactor_Impl> (*reactor_factory_type) (void);
+typedef unique_ptr<ACE_Reactor_Impl> (*reactor_factory_type) (void);
-auto_ptr<ACE_Reactor_Impl>
+unique_ptr<ACE_Reactor_Impl>
dev_poll_reactor_factory (void)
{
ACE_DEBUG ((LM_INFO,
ACE_TEXT ("Creating ACE_Dev_Poll_Reactor.\n")));
- return auto_ptr<ACE_Reactor_Impl> (new ACE_Dev_Poll_Reactor);
+ return unique_ptr<ACE_Reactor_Impl> (new ACE_Dev_Poll_Reactor);
}
// ------------------------------------------------------------
@@ -416,7 +416,7 @@ struct Run_Test : public std::unary_function<reactor_factory_type, void>
ACE_TEXT ("** Running removal test **\n")));
}
- auto_ptr<ACE_Reactor_Impl> the_factory (factory ());
+ unique_ptr<ACE_Reactor_Impl> the_factory (factory ());
ACE_Reactor reactor (the_factory.get ());
// In this test, it's only okay to close the Bogus_Handler
diff --git a/ACE/tests/Reactor_Timer_Test.cpp b/ACE/tests/Reactor_Timer_Test.cpp
index a3c2a3def0c..28db2c61a08 100644
--- a/ACE/tests/Reactor_Timer_Test.cpp
+++ b/ACE/tests/Reactor_Timer_Test.cpp
@@ -255,7 +255,7 @@ run_main (int argc, ACE_TCHAR *[])
// to do it right in at least one test. Notice the lack of
// ACE_NEW_RETURN, that monstrosity has no business in proper C++
// code ...
- auto_ptr<ACE_Timer_Heap_Variable_Time_Source> tq(
+ unique_ptr<ACE_Timer_Heap_Variable_Time_Source> tq(
new ACE_Timer_Heap_Variable_Time_Source);
// ... notice how the policy is in the derived timer queue type.
// The abstract timer queue does not have a time policy ...
diff --git a/ACE/tests/Refcounted_Auto_Ptr_Test.cpp b/ACE/tests/Refcounted_Auto_Ptr_Test.cpp
index a8b8049fdb7..af5b8d89fab 100644
--- a/ACE/tests/Refcounted_Auto_Ptr_Test.cpp
+++ b/ACE/tests/Refcounted_Auto_Ptr_Test.cpp
@@ -238,7 +238,7 @@ Scheduler::svc (void)
ACE_TEXT ("(%t) activation queue shut down\n")));
break;
}
- auto_ptr<ACE_Method_Request> mo (mo_p);
+ unique_ptr<ACE_Method_Request> mo (mo_p);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) calling method request\n")));
@@ -486,7 +486,7 @@ run_main (int, ACE_TCHAR *[])
Scheduler (),
-1);
- auto_ptr<Scheduler> scheduler(scheduler_ptr);
+ unique_ptr<Scheduler> scheduler(scheduler_ptr);
if (scheduler->open () == -1)
ACE_ERROR_RETURN ((LM_ERROR,
diff --git a/ACE/tests/UUID_Test.cpp b/ACE/tests/UUID_Test.cpp
index 7585d6b173e..d8447548419 100644
--- a/ACE/tests/UUID_Test.cpp
+++ b/ACE/tests/UUID_Test.cpp
@@ -26,7 +26,7 @@ Tester::test (void)
int retval = 0;
// Generate UUID
- auto_ptr <ACE_Utils::UUID> uuid (ACE_Utils::UUID_GENERATOR::instance ()->generate_UUID ());
+ unique_ptr <ACE_Utils::UUID> uuid (ACE_Utils::UUID_GENERATOR::instance ()->generate_UUID ());
ACE_CString uuid_str (uuid->to_string ()->c_str ());
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Generated UUID\n %C\n"),
@@ -107,7 +107,7 @@ Tester::test (void)
-1);
// Generate UUID with process and thread ids.
- auto_ptr <ACE_Utils::UUID>
+ unique_ptr <ACE_Utils::UUID>
uuid_with_tp_id (ACE_Utils::UUID_GENERATOR::instance ()->generate_UUID (0x0001, 0xc0));
ACE_DEBUG ((LM_DEBUG,