Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It should be possible to disable use of std::auto_ptr #1301

Closed
VemundH opened this issue Nov 21, 2020 · 18 comments
Closed

It should be possible to disable use of std::auto_ptr #1301

VemundH opened this issue Nov 21, 2020 · 18 comments

Comments

@VemundH
Copy link

VemundH commented Nov 21, 2020

Inspecting the code, it looks like this is possible with
#define ACE_LACKS_AUTO_PTR
in config.h

This does not work as it prevents ace/Auto_Ptr.h from including <memory>

#if !defined (ACE_LACKS_AUTO_PTR) && \

Use of std::unique_ptr elsewhere in ACE with >= C++11 fails because of this (ACE version 6.5.11)

Quick fix is to unconditionally include <memory> in ace/Auto_Ptr.h
It looks like the project is moving to C++11 for the next major release. Then this is maybe an acceptable change?

@jwillemsen
Copy link
Member

I am in favor of the clean fix, replace Auto_ptr.h with memory where unique_ptr is used

@jwillemsen
Copy link
Member

@ClausKlein
Copy link
Contributor

for clang-tidy you need a compile_commands.json file i.e. generated by cmake!

Claus-iMac:ACE_TAO clausklein$ find ACE -type f \( -name '*.cpp' -o -name '*.h' \) | xargs grep --color -w auto_ptr
ACE/netsvcs/servers/main.cpp:          // ACE_Service_Object_Ptr which is an <auto_ptr> specialized
ACE/tests/Proactor_Timer_Test.cpp:      // The use of auto_ptr<> is optional, ACE uses dangerous memory
ACE/tests/Proactor_Timer_Test.cpp:      // auto_ptr<> ...
ACE/tests/Network_Adapters_Test.cpp:  // The use of auto_ptr<> is optional, ACE uses dangerous memory
ACE/tests/Future_Set_Test.cpp:  // @@ Should make these be <auto_ptr>s...
ACE/tests/Future_Test.cpp:  // @@ Should make these be <auto_ptr>s...
ACE/tests/Reactor_Timer_Test.cpp:      // The use of auto_ptr<> is optional, ACE uses dangerous memory
ACE/tests/Reactor_Timer_Test.cpp:      // auto_ptr<> ...
ACE/tests/Compiler_Features_09_Test.cpp: * std::auto_ptr<> correctly.  The motivation for this test was a discussion
ACE/tests/Compiler_Features_09_Test.cpp:  // ... this works with the ACE version of auto_ptr (well, the
ACE/tests/Compiler_Features_09_Test.cpp:  // ... with a compliant implementation of std::auto_ptr<> you should be
ACE/Kokyu/Default_Dispatcher_Impl.cpp:  //ACE_DEBUG ((LM_DEBUG, "task array auto_ptr set\n" ));
ACE/Kokyu/Kokyu.h://using the auto_ptr<> to store the implementation causes a compile
ACE/Kokyu/Kokyu.h://found. Note that the auto-ptr<T>::~auto_ptr() calls delete on the
ACE/examples/Smart_Pointers/Widget_Impl.h:  /// - We cannot use auto_ptr to manage the objects, since auto_ptr does not
ACE/examples/Web_Crawler/URL_Visitor.h: * This class is similar to an auto_ptr<> and should be used to
ACE/examples/Reactor/WFMO_Reactor/Window_Messages.cpp:  auto_ptr<ACE_Reactor> reactor (new ACE_Reactor (impl, 1));
ACE/examples/Reactor/WFMO_Reactor/Handle_Close.cpp:  auto_ptr<ACE_Reactor> reactor (create_reactor ());
ACE/examples/Reactor/TP_Reactor/client.cpp:    // put someData in a kind of auto_ptr so it gets deleted automatically
ACE/ace/OS_Memory.h:      // screws up auto_ptr.
ACE/ace/Service_Object.h: * auto_ptr. It is used in conjunction with statically linked
ACE/ace/Value_Ptr.h:   * Using a @c std::auto_ptr\<\> as a class member is sometimes
ACE/ace/Value_Ptr.h:     *       for @c auto_ptr\<\>s, but why would one use an @c
ACE/ace/Value_Ptr.h:     *       auto_ptr\<\> as the template argument for this particular
ACE/ace/Refcounted_Auto_Ptr.h: * @brief This class implements support for a reference counted auto_ptr.
ACE/ace/TLI.cpp:  auto_ptr<char> req_opt_buf_p (reinterpret_cast<char*> (req.opt.buf));
ACE/ace/TLI.cpp:  auto_ptr<char> ret_opt_buf_p (reinterpret_cast<char*> (ret.opt.buf));
ACE/ace/TLI.cpp:  auto_ptr<char> req_opt_buf_p (reinterpret_cast<char*> (req.opt.buf));
ACE/ace/TLI.cpp:  auto_ptr<char> ret_opt_buf_p (reinterpret_cast<char*> (ret.opt.buf));
ACE/ace/WFMO_Reactor.cpp:          // (via auto_ptr<> event, above) at function return will
ACE/ace/SString.h: * The class plays the same role as auto_ptr<>
ACE/ace/Auto_Functor.h: * @brief Helper template to implement auto_ptr<>-like classes, but
ACE/ace/Intrusive_Auto_Ptr.h: * auto_ptr. It assumes reference counting abilities of the
ACE/ace/Log_Msg.h:  /// ownership neither std::auto_ptr nor ACE_Strong_Bound_Ptr have the right
ACE/ace/Service_Gestalt.cpp:  auto_ptr<ACE_XML_Svc_Conf> xml_svc_conf (this->get_xml_svc_conf (dll));
ACE/ace/Service_Gestalt.cpp:  auto_ptr<ACE_XML_Svc_Conf>
ACE/ace/Auto_Ptr.h: * @brief Implements the draft C++ standard auto_ptr abstraction.
ACE/ace/Auto_Ptr.h: * @class auto_ptr
ACE/ace/Auto_Ptr.h: * @brief Implements the draft C++ standard auto_ptr abstraction.
ACE/ace/Auto_Ptr.h:class auto_ptr : public ACE_Auto_Basic_Ptr<X>
ACE/ace/Auto_Ptr.h:  explicit auto_ptr (X * p = 0) : ACE_Auto_Basic_Ptr<X> (p) {}
ACE/ace/Auto_Ptr.h:  auto_ptr (auto_ptr<X> & ap) : ACE_Auto_Basic_Ptr<X> (ap.release ()) {}
ACE/ace/Auto_Ptr.h: * @brief Implements the draft C++ standard auto_ptr abstraction.
ACE/ace/Auto_Ptr.h: * This version can be used instead of auto_ptr<T>
ACE/ace/Auto_Ptr.h: * @brief Implements an extension to the draft C++ standard auto_ptr
ACE/ace/Auto_Ptr.h: * @brief Implements an extension to the draft C++ standard auto_ptr
ACE/ace/Auto_Ptr.h: * @brief Reset given @c auto_ptr element to new element.
ACE/ace/Auto_Ptr.h: * Some platforms have an older version of auto_ptr support, which
ACE/ace/Auto_Ptr.h:  // of element type found in auto_ptr.
Claus-iMac:ACE_TAO clausklein$ 

@ClausKlein
Copy link
Contributor

for TAO, it is much more:

Claus-iMac:ACE_TAO clausklein$ find TAO -type f \( -name '*.cpp' -o -name '*.h' \) | xargs grep --color -w auto_ptr
TAO/tests/Oneway_Send_Timeouts/Server_Task.h:  std::auto_ptr<Server> server_;
TAO/tests/Oneway_Send_Timeouts/Server.h:  std::auto_ptr<Test_i> test_i_;
TAO/tests/Oneway_Send_Timeouts/main.cpp:  std::auto_ptr<Server_Task> server_task_;
TAO/tests/Oneway_Send_Timeouts/main.cpp:  std::auto_ptr<Client_Task> client_task_;
TAO/tests/Client_Leaks/child.cpp:          // Paranoia, we should have an auto_ptr-like gadget for
TAO/tests/Compression/RLECompressorTest.cpp:struct ACE_Byte_Array_ptr : std::auto_ptr<ACE_Byte> {
TAO/tests/Compression/RLECompressorTest.cpp:        : std::auto_ptr<ACE_Byte>(_Ptr) {}
TAO/tests/Bug_3251_Regression/DllOrb.h:  auto_ptr < ACE_Thread_Barrier >      ma_barrier_;
TAO/tests/Bug_3542_Regression/DllOrb.h:  auto_ptr < ACE_Thread_Barrier >      ma_barrier_;
TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp:  // NOTE: ACE_NEW is incompatable with auto_ptr
TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp:  auto_ptr<TAO::Fault_Detector_i> detector(pFD);
TAO/orbsvcs/performance-tests/RTEvent/lib/RTServer_Setup.h:  auto_ptr<RTPOA_Setup> rtpoa_setup_;
TAO/orbsvcs/performance-tests/RTEvent/lib/Low_Priority_Setup.h:  typedef auto_ptr<Send_Task_Stopper> Auto_Send_Task_Stopper;
TAO/orbsvcs/performance-tests/RTEvent/lib/RTPOA_Setup.cpp:  // @@ We need an 'auto_ptr for thread pools' here!
TAO/orbsvcs/performance-tests/RTEvent/lib/RTEC_Initializer.cpp:  auto_ptr<TAO_EC_Factory> factory (
TAO/orbsvcs/performance-tests/RTEvent/lib/RTClient_Setup.h:  auto_ptr<RTCORBA_Setup> rtcorba_setup_;
TAO/orbsvcs/performance-tests/RTEvent/lib/Control.cpp:      ACE_Auto_Basic_Array_Ptr<auto_ptr<Loopback_Disconnect> > disconnects (
TAO/orbsvcs/performance-tests/RTEvent/lib/Control.cpp:          new auto_ptr<Loopback_Disconnect>[2*this->peers_count_]
TAO/orbsvcs/performance-tests/RTEvent/lib/Low_Priority_Setup.cpp:  /// Resetting the auto_ptr<> destroys all the objects.  The
TAO/orbsvcs/tests/Notify/Bug_3252_Regression/DllOrb.h:  auto_ptr < ACE_Thread_Barrier > ma_barrier_;
TAO/orbsvcs/tests/FtRtEvent/supplier.cpp:auto_ptr<TAO_FTRTEC::FTEC_Gateway> gateway;
TAO/orbsvcs/tests/FtRtEvent/consumer.cpp:auto_ptr<TAO_FTRTEC::FTEC_Gateway> gateway;
TAO/orbsvcs/tests/Trading/colocated_test.cpp:        auto_ptr<TAO_Trader_Factory::TAO_TRADER> trader (TAO_Trader_Factory::create_trader (argc, argv));
TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventSupplierMain.cpp:    auto_ptr<ACE_Event_Handler> eh;
TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventSupplierMain.cpp:      auto_ptr<TAO_ECG_Mcast_EH> mcast_eh(new TAO_ECG_Mcast_EH (receiver.in()));
TAO/orbsvcs/tests/Event/Mcast/RTEC_MCast_Federated/EchoEventSupplierMain.cpp:      auto_ptr<TAO_ECG_UDP_EH> udp_eh (new TAO_ECG_UDP_EH (receiver.in()));
TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp:  friend class std::auto_ptr< TAO_Notify_Tracker >;
TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp:  static std::auto_ptr< TAO_Notify_Tracker > s_instance;
TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp:std::auto_ptr< TAO_Notify_Tracker > TAO_Notify_Tracker::s_instance;
TAO/orbsvcs/orbsvcs/AV/SCTP_SEQ.h://typedef auto_ptr <Interface_Seq> Interface_Seq_Ptr;
TAO/orbsvcs/orbsvcs/FtRtEvent/EventChannel/replace_key.cpp:/// file conflicts with the use of auto_ptr in the
TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp:          // Use an auto_ptr to ensure that we clean up the factory in the case
TAO/orbsvcs/orbsvcs/Naming/Naming_Server.cpp:            // The activator already took over the factories so we need to release the auto_ptr
TAO/orbsvcs/examples/FaultTolerance/RolyPoly/ReplicaController.h:  auto_ptr<ACE_TMCast::Group> group_;
TAO/orbsvcs/examples/CosEC/RtEC_Based/lib/CosEvent_Utilities.cpp:  auto_ptr<POA_RtecEventChannelAdmin::EventChannel>
TAO/orbsvcs/examples/CosEC/RtEC_Based/lib/CosEvent_Utilities.cpp:  auto_ptr<TAO_CosEC_EventChannel_i>
TAO/orbsvcs/examples/CosEC/RtEC_Based/lib/ProxyPushSupplier_i.cpp:  auto_ptr <TAO_CosEC_PushConsumerWrapper> auto_wrapper (wrapper);
TAO/orbsvcs/examples/CosEC/RtEC_Based/lib/SupplierAdmin_i.cpp:  auto_ptr <TAO_CosEC_ProxyPushConsumer_i>
TAO/orbsvcs/examples/CosEC/RtEC_Based/lib/EventChannel_i.cpp:  auto_ptr <TAO_CosEC_ConsumerAdmin_i> auto_consumer_ (consumer_);
TAO/orbsvcs/examples/CosEC/RtEC_Based/lib/EventChannel_i.cpp:  auto_ptr <TAO_CosEC_SupplierAdmin_i> auto_supplier_ (supplier_);
TAO/orbsvcs/examples/CosEC/RtEC_Based/lib/ProxyPushConsumer_i.cpp:  auto_ptr <TAO_CosEC_PushSupplierWrapper>
TAO/orbsvcs/examples/CosEC/RtEC_Based/lib/ConsumerAdmin_i.cpp:  auto_ptr<TAO_CosEC_ProxyPushSupplier_i>
TAO/orbsvcs/examples/CosEC/Factory/CosEventChannelFactory_i.cpp:      auto_ptr <TAO_CEC_EventChannel> ec (impl);
TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp:    auto_ptr<ACE_Event_Handler> eh;
TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp:      auto_ptr<TAO_ECG_Mcast_EH> mcast_eh(new TAO_ECG_Mcast_EH (receiver.in()));
TAO/orbsvcs/DevGuideExamples/EventServices/RTEC_MCast_Federated/EchoEventSupplierMain.cpp:      auto_ptr<TAO_ECG_UDP_EH> udp_eh (new TAO_ECG_UDP_EH (receiver.in()));
TAO/orbsvcs/DevGuideExamples/NotifyService/EventSequence/Messenger_i.h:  auto_ptr<EventSequenceSupplier_i> supplier_;
TAO/examples/Load_Balancing/Load_Balancer_i.cpp:      // Temporarily put the servant into the auto_ptr.
TAO/examples/Borland/ChatClientWnd.h:  auto_ptr<TORBThread> orb_thread_;
TAO/examples/Borland/ChatClientWnd.cpp:  auto_ptr<TStringList> ior (new TStringList);
TAO/tao/RTCORBA/RT_ORBInitializer.cpp:  //    mapping allocated above will be leaked.  Use an auto_ptr<> or
TAO/tao/default_resource.h: * @brief A simple auto_ptr like class to manage timer queues dynamically
TAO/tao/LF_Event_Binder.h: * @brief Implement an auto_ptr-like class for the TAO_LF_Followers
TAO/tao/Leader_Follower.cpp:        // End artificial scope for auto_ptr like helpers calling:
TAO/tao/Leader_Follower.cpp:  // End artificial scope for auto_ptr like helpers calling:
TAO/tao/ORB_Core_Auto_Ptr.h: * @brief Define a TAO_ORB_Core auto_ptr class.
TAO/tao/CORBALOC_Parser.cpp:      /// auto_ptr.
TAO/tao/LF_Follower_Auto_Ptr.h: * @brief Implement an auto_ptr-like class for the TAO_LF_Followers
TAO/tao/Asynch_Reply_Dispatcher_Base.h:   * heap. We cannot use auto_ptr <> since it calls delete on the
TAO/tao/IORManipulation/IORManipulation.cpp:      // this gets a copy of the MProfile, hence the auto_ptr;
TAO/tao/Messaging/AMH_Response_Handler.h:   * heap. We cannot use auto_ptr <> since it calls delete on the
TAO/tao/Messaging/Asynch_Invocation.cpp:        // NOTE: We don't need to do the auto_ptr <> trick. We got here
TAO/tao/Stub.h:// Define a TAO_Stub auto_ptr class.
TAO/tao/Stub.h: * @brief Implements the draft C++ standard auto_ptr abstraction.
TAO/tao/Load_Protocol_Factory_T.h:      // TAO_Protocol_Factory then we used an auto_ptr<> above, so
TAO/tao/Load_Protocol_Factory_T.h:      // Configurator so an auto_ptr<> wasn't used since the Service
TAO/tao/Load_Protocol_Factory_T.h:      // use an auto_ptr<> in this method.
TAO/tao/PortableServer/Root_POA.cpp:// auto_ptr class
Claus-iMac:ACE_TAO clausklein$ 

@jwillemsen
Copy link
Member

Yes, bear can create a compile_commands.json did use clang-tidy for some cleanup but a lot more can be done. At the moment I tried it on the full tree it didn't work as it should, only when you run it at a lower directory level it works

@jwillemsen
Copy link
Member

Pull request are welcome for cleanup, all together it is a huge job for which we can use assistance and/or funding.

@ClausKlein
Copy link
Contributor

ClausKlein commented Jun 1, 2021

do you mean bear?

@ClausKlein
Copy link
Contributor

ClausKlein commented Jun 1, 2021

Not so easy as it should:

Claus-iMac:TAO clausklein$ run-clang-tidy.py -j 1 -checks='-*,modernize-replace-auto-ptr'  -extra-arg-before='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk' 
Enabled checks:
    modernize-replace-auto-ptr

clang-tidy -checks=-*,modernize-replace-auto-ptr -extra-arg-before=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -p=/Users/clausklein/Workspace/cpp/ACE_TAO/TAO /Users/clausklein/Workspace/cpp/ACE_TAO/TAO/orbsvcs/Event_Service/Event_Service.cpp
/Users/clausklein/Workspace/cpp/ACE_TAO/ACE/ace/config-macosx.h:3:10: error: 'Availability.h' file not found [clang-diagnostic-error]
#include <Availability.h>
         ^
1 warning and 1 error generated.
Error while processing /Users/clausklein/Workspace/cpp/ACE_TAO/TAO/orbsvcs/Event_Service/Event_Service.cpp.
Suppressed 1 warnings (1 with check filters).
Found compiler error(s).

@jwillemsen
Copy link
Member

@ClausKlein
Copy link
Contributor

Oh it is really hard:

+ run-clang-tidy.py -j 1 -fix '-checks=-*,modernize-replace-auto-ptr' '-extra-arg-before=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk' -extra-arg=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include -extra-arg=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1 -extra-arg=-DTARGET_OS_IPHONE=0 ./orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp
Enabled checks:
    modernize-replace-auto-ptr

clang-apply-replacements version 12.0.0
clang-tidy -checks=-*,modernize-replace-auto-ptr -export-fixes /var/folders/wb/ckvxxgls5db7qyhqq4y5_l1c0000gq/T/tmp3s9ii7_a/tmp6m8m3fjw.yaml -extra-arg=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/usr/include -extra-arg=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1 -extra-arg=-DTARGET_OS_IPHONE=0 -extra-arg-before=-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -p=/Users/clausklein/Workspace/cpp/ACE_TAO/TAO /Users/clausklein/Workspace/cpp/ACE_TAO/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp
/Users/clausklein/Workspace/cpp/ACE_TAO/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp:604:36: error: use of undeclared identifier 'detector' [clang-diagnostic-error]
  auto_ptr<TAO::Fault_Detector_i>; detector(pFD);
                                   ^
/Users/clausklein/Workspace/cpp/ACE_TAO/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp:618:5: error: use of undeclared identifier 'detector' [clang-diagnostic-error]
  (*detector).start(this->threadManager_);
    ^
/Users/clausklein/Workspace/cpp/ACE_TAO/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp:620:34: error: use of undeclared identifier 'detector' [clang-diagnostic-error]
  this->detectors_[detectorId] = detector.release();
                                 ^
225 warnings and 3 errors generated.
Error while processing /Users/clausklein/Workspace/cpp/ACE_TAO/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp.
Suppressed 225 warnings (2 in non-user code, 223 with check filters).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
Applying fixes ...
Claus-iMac:TAO clausklein$ 

@jwillemsen
Copy link
Member

Yes, these kind of cleanup tasks sound simple to start with but given the size and complexity of ACE/TAO they are not easy and small tasks.

@ClausKlein
Copy link
Contributor

diff --git a/ACE/ace/Auto_Ptr.h b/ACE/ace/Auto_Ptr.h
index 21365a540d8..c8fbf5691db 100644
--- a/ACE/ace/Auto_Ptr.h
+++ b/ACE/ace/Auto_Ptr.h
@@ -75,6 +75,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL
 #if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) && \
             (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB != 0)
 using std::auto_ptr;
+using std::unique_ptr;
 #endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
 #else /* ACE_HAS_STANDARD_CPP_LIBRARY */
 
diff --git a/ACE/include/makeinclude/platform_macosx_common.GNU b/ACE/include/makeinclude/platform_macosx_common.GNU
index 342883b2855..0fbdf251d3a 100644
--- a/ACE/include/makeinclude/platform_macosx_common.GNU
+++ b/ACE/include/makeinclude/platform_macosx_common.GNU
@@ -23,8 +23,8 @@ endif
 
 with_ld = macosx
 
-CC              ?= gcc
-CXX             ?= g++
+CC              := gcc
+CXX             := g++
 DCCFLAGS        += -g
 DCFLAGS         += -g
 DLD              = $(CXX)
diff --git a/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp b/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp
index 43b7c26e659..c101a39a61b 100644
--- a/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp
+++ b/TAO/orbsvcs/Fault_Detector/FT_FaultDetectorFactory_i.cpp
@@ -601,7 +601,7 @@ CORBA::Object_ptr TAO::FT_FaultDetectorFactory_i::create_object (
       ));
     throw PortableGroup::ObjectNotCreated();
   }
-  auto_ptr<TAO::Fault_Detector_i> detector(pFD);
+  unique_ptr<TAO::Fault_Detector_i> detector(pFD);
 
   ACE_NEW_NORETURN ( factory_creation_id,
     PortableGroup::GenericFactory::FactoryCreationId);
diff --git a/TAO/tests/Bug_3251_Regression/DllOrb.h b/TAO/tests/Bug_3251_Regression/DllOrb.h
index 24dae5c923e..3eb38be605b 100644
--- a/TAO/tests/Bug_3251_Regression/DllOrb.h
+++ b/TAO/tests/Bug_3251_Regression/DllOrb.h
@@ -25,7 +25,7 @@ public:
   virtual int svc ();
 
 private:
-  auto_ptr < ACE_Thread_Barrier >      ma_barrier_;
+  unique_ptr < ACE_Thread_Barrier >    ma_barrier_;
   CORBA::ORB_var                       mv_orb_;
   PortableServer::POA_var              mv_rootPOA_;
   PortableServer::POAManager_var       mv_poaManager_;
diff --git a/TAO/tests/Bug_3542_Regression/DllOrb.h b/TAO/tests/Bug_3542_Regression/DllOrb.h
index 5e320d6f9e9..fba70484da4 100644
--- a/TAO/tests/Bug_3542_Regression/DllOrb.h
+++ b/TAO/tests/Bug_3542_Regression/DllOrb.h
@@ -25,7 +25,7 @@ public:
   virtual int svc ();
 
 private:
-  auto_ptr < ACE_Thread_Barrier >      ma_barrier_;
+  unique_ptr < ACE_Thread_Barrier >    ma_barrier_;
   CORBA::ORB_var                       mv_orb_;
   PortableServer::POA_var              mv_rootPOA_;
   PortableServer::POAManager_var       mv_poaManager_;
diff --git a/TAO/tests/Compression/RLECompressorTest.cpp b/TAO/tests/Compression/RLECompressorTest.cpp
index 930106809cb..962ad5c4ff7 100644
--- a/TAO/tests/Compression/RLECompressorTest.cpp
+++ b/TAO/tests/Compression/RLECompressorTest.cpp
@@ -10,9 +10,9 @@
 #include <memory>
 
 // Older versions of GCC do not support std::unique_ptr!
-struct ACE_Byte_Array_ptr : std::auto_ptr<ACE_Byte> {
+struct ACE_Byte_Array_ptr : std::unique_ptr<ACE_Byte> {
     explicit ACE_Byte_Array_ptr(ACE_Byte *_Ptr = 0)
-        : std::auto_ptr<ACE_Byte>(_Ptr) {}
+        : std::unique_ptr<ACE_Byte>(_Ptr) {}
     ~ACE_Byte_Array_ptr(void) {
         delete [] (this->release());
     }
diff --git a/TAO/tests/Oneway_Send_Timeouts/Server.h b/TAO/tests/Oneway_Send_Timeouts/Server.h
index 09d98a408d7..e5e750d994b 100644
--- a/TAO/tests/Oneway_Send_Timeouts/Server.h
+++ b/TAO/tests/Oneway_Send_Timeouts/Server.h
@@ -29,7 +29,7 @@ class Server
   CORBA::ORB_var management_orb_;
   bool shutdown_;
   TAO_SYNCH_MUTEX mutex_;
-  std::auto_ptr<Test_i> test_i_;
+  std::unique_ptr<Test_i> test_i_;
 };
 
 #endif //_SERVER_
diff --git a/TAO/tests/Oneway_Send_Timeouts/Server_Task.h b/TAO/tests/Oneway_Send_Timeouts/Server_Task.h
index 08862f30111..ea3400a5761 100644
--- a/TAO/tests/Oneway_Send_Timeouts/Server_Task.h
+++ b/TAO/tests/Oneway_Send_Timeouts/Server_Task.h
@@ -63,7 +63,7 @@ class Server_Task : public ACE_Task_Base
 
  private:
   std::string args_;
-  std::auto_ptr<Server> server_;
+  std::unique_ptr<Server> server_;
   TAO_SYNCH_MUTEX mutex_;
 };
 
diff --git a/TAO/tests/Oneway_Send_Timeouts/main.cpp b/TAO/tests/Oneway_Send_Timeouts/main.cpp
index c1153ecbbf8..fb001e50c50 100644
--- a/TAO/tests/Oneway_Send_Timeouts/main.cpp
+++ b/TAO/tests/Oneway_Send_Timeouts/main.cpp
@@ -20,8 +20,8 @@ private:
   bool init_server (const ACE_TCHAR* args);
   bool init_client (const ACE_TCHAR* args);
 
-  std::auto_ptr<Server_Task> server_task_;
-  std::auto_ptr<Client_Task> client_task_;
+  std::unique_ptr<Server_Task> server_task_;
+  std::unique_ptr<Client_Task> client_task_;
 
   bool s_init_;
   bool shutdown_;

@jwillemsen
Copy link
Member

I am not in favor of using std::unique_ptr;, let us not do this in ACE, just use std::unique_ptr where we need it. When you have tested the std::unique_ptr changes feel free to open a pull request

@ClausKlein
Copy link
Contributor

I am not in favor of using std::unique_ptr;, let us not do this in ACE, just use std::unique_ptr where we need it. When you have tested the std::unique_ptr changes feel free to open a pull request

But then ACE and TAO would not longer compile with c++98?

@jwillemsen
Copy link
Member

ACE7 and TAO3 require C++11 support or newer

@ClausKlein
Copy link
Contributor

OK, than im looking forward to c++17, c++20, ... ;-)

@ClausKlein
Copy link
Contributor

what is about this, i.e TAO/tests/Oneway_Send_Timeouts/main.cpp

ACE_auto_ptr_reset (server_, new Server (my_args.argc(), my_args.argv()));
// change to?
server_ = std::make_unique<Server>(my_args.argc(), my_args.argv());

@jwillemsen
Copy link
Member

#2109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants