From b192a376446da1af90f068873b147c0b1fe25e29 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Tue, 22 Aug 2023 18:12:19 +0200 Subject: [PATCH 1/3] Replace std::unary_function<> with std::function<> (deprecated in C++11) and removed in C++17 Add missing #include Make the hack clear: respect review comment ace/Auto_Ptr.h must still include --- ACE/ace/Auto_Ptr.h | 11 +++++++++-- ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp | 2 +- .../orbsvcs/Event/ECG_CDR_Message_Receiver.cpp | 2 ++ TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp | 7 ++++--- TAO/tests/Any/Recursive/client.cpp | 2 +- TAO/tests/Bug_2804_Regression/client.cpp | 2 +- TAO/tests/Bug_2844_Regression/client.cpp | 2 +- TAO/tests/Bug_2918_Regression/client.cpp | 2 +- TAO/tests/Bug_3919_Regression/client.cpp | 2 +- 9 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ACE/ace/Auto_Ptr.h b/ACE/ace/Auto_Ptr.h index 43b704e02bbf8..2ea646eb60eea 100644 --- a/ACE/ace/Auto_Ptr.h +++ b/ACE/ace/Auto_Ptr.h @@ -68,9 +68,16 @@ class ACE_Auto_Basic_Ptr ACE_END_VERSIONED_NAMESPACE_DECL +// NOTE: ACE7 and TAO3 require C++11 support or newer; jwillemsen commented on Jun 1, 2021 #if !defined (ACE_LACKS_AUTO_PTR) -#include -using std::auto_ptr; +# include + +# ifdef ACE_HAS_CPP17 +// NOTE: we must only use std::unique_ptr; CK +# else +// FIXME: we are still using std::auto_ptr; +# endif + #else /* !ACE_LACKS_AUTO_PTR */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp b/ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp index e591a9b015931..61a46779914d2 100644 --- a/ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp +++ b/ACE/tests/Reactor_Remove_Resume_Test_Dev_Poll.cpp @@ -375,7 +375,7 @@ dev_poll_reactor_factory () * * Reactor test execution functor. */ -struct Run_Test : public std::unary_function +struct Run_Test : public std::function { /// Function call operator overload. void operator() (reactor_factory_type factory) diff --git a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.cpp b/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.cpp index aca8953f5dce0..1e3cd5c23ab82 100644 --- a/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/ECG_CDR_Message_Receiver.cpp @@ -8,6 +8,8 @@ #include "ace/ACE.h" #include "ace/OS_NS_string.h" +#include + #if !defined(__ACE_INLINE__) #include "orbsvcs/Event/ECG_CDR_Message_Receiver.inl" #endif /* __ACE_INLINE__ */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp index b39aded25c992..82d21b7eb6f1d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp @@ -7,6 +7,7 @@ #include #include +#include #include TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -44,8 +45,8 @@ class TAO_Notify_Tracker TAO_Notify_Tracker(); ~TAO_Notify_Tracker(); - friend class std::auto_ptr< TAO_Notify_Tracker >; - static std::auto_ptr< TAO_Notify_Tracker > s_instance; + friend class std::unique_ptr< TAO_Notify_Tracker >; + static std::unique_ptr< TAO_Notify_Tracker > s_instance; mutable TAO_SYNCH_MUTEX lock_; typedef std::map EntityMap; EntityMap map_; @@ -133,7 +134,7 @@ TAO_Notify_Refcountable::_decr_refcnt () #if (TAO_NOTIFY_REFCOUNT_DIAGNOSTICS != 0) -std::auto_ptr< TAO_Notify_Tracker > TAO_Notify_Tracker::s_instance; +std::unique_ptr< TAO_Notify_Tracker > TAO_Notify_Tracker::s_instance; TAO_Notify_Tracker::TAO_Notify_Tracker() : id_counter_(0) diff --git a/TAO/tests/Any/Recursive/client.cpp b/TAO/tests/Any/Recursive/client.cpp index 142d5ac6e53dc..e030acbe37695 100644 --- a/TAO/tests/Any/Recursive/client.cpp +++ b/TAO/tests/Any/Recursive/client.cpp @@ -399,7 +399,7 @@ directly_recursive_valuetype_typecodefactory_test (CORBA::ORB_ptr /* orb */, * Test method invocation functor. */ template -struct Caller : public std::unary_function +struct Caller : public std::function { /// Constructor. Caller (CORBA::ORB_ptr o, Test::Hello_ptr h) diff --git a/TAO/tests/Bug_2804_Regression/client.cpp b/TAO/tests/Bug_2804_Regression/client.cpp index d852e043aa653..abee937b71120 100644 --- a/TAO/tests/Bug_2804_Regression/client.cpp +++ b/TAO/tests/Bug_2804_Regression/client.cpp @@ -97,7 +97,7 @@ recursive_union_test (CORBA::ORB_ptr /* orb */, * Test method invocation functor. */ template -struct Caller : public std::unary_function +struct Caller : public std::function { /// Constructor. Caller (CORBA::ORB_ptr o, Test::Hello_ptr h) diff --git a/TAO/tests/Bug_2844_Regression/client.cpp b/TAO/tests/Bug_2844_Regression/client.cpp index 29fe9fa32c282..7021b6ff0d991 100644 --- a/TAO/tests/Bug_2844_Regression/client.cpp +++ b/TAO/tests/Bug_2844_Regression/client.cpp @@ -96,7 +96,7 @@ nested_recursive_struct_test (CORBA::ORB_ptr /* orb */, * Test method invocation functor. */ template -struct Caller : public std::unary_function +struct Caller : public std::function { /// Constructor. Caller (CORBA::ORB_ptr o, Test::Hello_ptr h) diff --git a/TAO/tests/Bug_2918_Regression/client.cpp b/TAO/tests/Bug_2918_Regression/client.cpp index 14f608c2f68b3..7a4d6ed1b5e01 100644 --- a/TAO/tests/Bug_2918_Regression/client.cpp +++ b/TAO/tests/Bug_2918_Regression/client.cpp @@ -97,7 +97,7 @@ repeated_struct_test (CORBA::ORB_ptr /* orb */, * Test method invocation functor. */ template -struct Caller : public std::unary_function +struct Caller : public std::function { /// Constructor. Caller (CORBA::ORB_ptr o, Test::Hello_ptr h) diff --git a/TAO/tests/Bug_3919_Regression/client.cpp b/TAO/tests/Bug_3919_Regression/client.cpp index 959d9b79f0162..83e67ab411b6e 100644 --- a/TAO/tests/Bug_3919_Regression/client.cpp +++ b/TAO/tests/Bug_3919_Regression/client.cpp @@ -168,7 +168,7 @@ nested_recursive_typecode_test (CORBA::ORB_ptr /* orb */, * Test method invocation functor. */ template -struct Caller : public std::unary_function +struct Caller : public std::function { /// Constructor. Caller (CORBA::ORB_ptr o, Test::Hello_ptr h) From e09f240025d1e876504d2e2faf1de3a4ffaed405 Mon Sep 17 00:00:00 2001 From: ClausKlein Date: Wed, 23 Aug 2023 19:21:00 +0200 Subject: [PATCH 2/3] This does NOT compile with c++17 or newer! --- ACE/ace/Auto_Ptr.h | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/ACE/ace/Auto_Ptr.h b/ACE/ace/Auto_Ptr.h index 2ea646eb60eea..4b3f1f23ec09d 100644 --- a/ACE/ace/Auto_Ptr.h +++ b/ACE/ace/Auto_Ptr.h @@ -68,16 +68,9 @@ class ACE_Auto_Basic_Ptr ACE_END_VERSIONED_NAMESPACE_DECL -// NOTE: ACE7 and TAO3 require C++11 support or newer; jwillemsen commented on Jun 1, 2021 #if !defined (ACE_LACKS_AUTO_PTR) -# include - -# ifdef ACE_HAS_CPP17 -// NOTE: we must only use std::unique_ptr; CK -# else -// FIXME: we are still using std::auto_ptr; -# endif - +# include // NOTE: Workaround only, still needed! 2023-08-23 CK +using std::auto_ptr; // FIXME(CK): This does NOT compile with c++17 or newer!!! #else /* !ACE_LACKS_AUTO_PTR */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL From 6c256ad581fa75de4ccd3bbabb5a117b0c374112 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 28 Aug 2023 09:36:49 +0200 Subject: [PATCH 3/3] Update Auto_Ptr.h --- ACE/ace/Auto_Ptr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ACE/ace/Auto_Ptr.h b/ACE/ace/Auto_Ptr.h index 4b3f1f23ec09d..7fa3de4a2ce18 100644 --- a/ACE/ace/Auto_Ptr.h +++ b/ACE/ace/Auto_Ptr.h @@ -69,8 +69,8 @@ class ACE_Auto_Basic_Ptr ACE_END_VERSIONED_NAMESPACE_DECL #if !defined (ACE_LACKS_AUTO_PTR) -# include // NOTE: Workaround only, still needed! 2023-08-23 CK -using std::auto_ptr; // FIXME(CK): This does NOT compile with c++17 or newer!!! +# include +using std::auto_ptr; #else /* !ACE_LACKS_AUTO_PTR */ ACE_BEGIN_VERSIONED_NAMESPACE_DECL