summaryrefslogtreecommitdiff
path: root/ACE
diff options
context:
space:
mode:
authorAdam Mitz <mitza@objectcomputing.com>2021-11-10 08:33:06 -0600
committerGitHub <noreply@github.com>2021-11-10 08:33:06 -0600
commitd155cf53c6e82d9c9ec1086d18d2db413ae28930 (patch)
tree7db097aa6f3c8ad6ba44be0f02d36a1f22c1e1b5 /ACE
parent0cfb634acbf7e879190307efcbe91b29fc6f360d (diff)
parent05799339af7c3c80b8de34451fec513aa2afc4dd (diff)
downloadATCD-d155cf53c6e82d9c9ec1086d18d2db413ae28930.tar.gz
Merge pull request #1714 from mitza-oci/msvc-langstd-ace6tao2
[ace6tao2] Port to MSVC with /std:c++17 and 20
Diffstat (limited to 'ACE')
-rw-r--r--ACE/ace/Auto_Ptr.h4
-rw-r--r--ACE/ace/Malloc_T.cpp4
-rw-r--r--ACE/ace/OS_NS_Thread.cpp2
-rw-r--r--ACE/ace/Thread_Manager.cpp2
-rw-r--r--ACE/ace/WFMO_Reactor.cpp2
-rw-r--r--ACE/ace/config-win32-msvc-142.h8
-rw-r--r--ACE/tests/Compiler_Features_09_Test.cpp2
-rw-r--r--ACE/tests/Compiler_Features_10_Test.cpp4
-rw-r--r--ACE/tests/DLL_Test.cpp2
-rw-r--r--ACE/tests/Integer_Truncate_Test.cpp5
-rw-r--r--ACE/tests/Reactor_Remove_Resume_Test.cpp5
-rw-r--r--ACE/tests/randomize.h3
12 files changed, 38 insertions, 5 deletions
diff --git a/ACE/ace/Auto_Ptr.h b/ACE/ace/Auto_Ptr.h
index 9f8af214a31..baa3f3c4fa1 100644
--- a/ACE/ace/Auto_Ptr.h
+++ b/ACE/ace/Auto_Ptr.h
@@ -78,6 +78,8 @@ using std::auto_ptr;
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
#else /* ACE_HAS_STANDARD_CPP_LIBRARY */
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
/**
* @class auto_ptr
*
@@ -95,6 +97,8 @@ public:
X *operator-> () const;
};
+ACE_END_VERSIONED_NAMESPACE_DECL
+
#endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
diff --git a/ACE/ace/Malloc_T.cpp b/ACE/ace/Malloc_T.cpp
index 0f966f99c8f..2d8236f0a20 100644
--- a/ACE/ace/Malloc_T.cpp
+++ b/ACE/ace/Malloc_T.cpp
@@ -683,7 +683,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_malloc (size_t nbytes)
// Skip over the MALLOC_HEADER when returning pointer.
return currp + 1;
}
- else if (currp == this->cb_ptr_->freep_)
+ else if (currp == static_cast<MALLOC_HEADER *> (this->cb_ptr_->freep_))
{
// We've wrapped around freelist without finding a
// block. Therefore, we need to ask the memory pool for
@@ -809,7 +809,7 @@ ACE_Malloc_T<ACE_MEM_POOL_2, ACE_LOCK, ACE_CB>::shared_free (void *ap)
}
// Join to upper neighbor.
- if ((blockp + blockp->size_) == currp->next_block_)
+ if (blockp + blockp->size_ == static_cast<MALLOC_HEADER *> (currp->next_block_))
{
ACE_MALLOC_STATS (--this->cb_ptr_->malloc_stats_.nblocks_);
blockp->size_ += currp->next_block_->size_;
diff --git a/ACE/ace/OS_NS_Thread.cpp b/ACE/ace/OS_NS_Thread.cpp
index b7af169c91d..378d6b73382 100644
--- a/ACE/ace/OS_NS_Thread.cpp
+++ b/ACE/ace/OS_NS_Thread.cpp
@@ -21,6 +21,8 @@
# include "ace/OS_NS_sys_resource.h" // syscall for gettid impl
#endif
+#include <memory>
+
extern "C" void
ACE_MUTEX_LOCK_CLEANUP_ADAPTER_NAME (void *args)
{
diff --git a/ACE/ace/Thread_Manager.cpp b/ACE/ace/Thread_Manager.cpp
index 0d6de7694ca..4e3bac66fca 100644
--- a/ACE/ace/Thread_Manager.cpp
+++ b/ACE/ace/Thread_Manager.cpp
@@ -9,6 +9,8 @@
#include "ace/OS_NS_sys_time.h"
#include "ace/Truncate.h"
+#include <memory>
+
#if !defined (__ACE_INLINE__)
#include "ace/Thread_Manager.inl"
#endif /* __ACE_INLINE__ */
diff --git a/ACE/ace/WFMO_Reactor.cpp b/ACE/ace/WFMO_Reactor.cpp
index 5f901b14108..f04d14a46a5 100644
--- a/ACE/ace/WFMO_Reactor.cpp
+++ b/ACE/ace/WFMO_Reactor.cpp
@@ -14,6 +14,8 @@
#include "ace/Auto_Ptr.h"
+#include <memory>
+
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_WFMO_Reactor_Handler_Repository::ACE_WFMO_Reactor_Handler_Repository (ACE_WFMO_Reactor &wfmo_reactor)
diff --git a/ACE/ace/config-win32-msvc-142.h b/ACE/ace/config-win32-msvc-142.h
index af47ad9f722..daed3972259 100644
--- a/ACE/ace/config-win32-msvc-142.h
+++ b/ACE/ace/config-win32-msvc-142.h
@@ -25,5 +25,13 @@
#include "ace/config-win32-msvc-141.h"
+#if _MSVC_LANG >= 202002L
+# define ACE_HAS_CPP20
+#endif /* _MSVC_LANG >= 202002L */
+
+#ifdef ACE_HAS_CPP17
+# define ACE_LACKS_AUTO_PTR
+#endif
+
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_WIN32_MSVC_142_H */
diff --git a/ACE/tests/Compiler_Features_09_Test.cpp b/ACE/tests/Compiler_Features_09_Test.cpp
index eb38413cd6e..3918f865983 100644
--- a/ACE/tests/Compiler_Features_09_Test.cpp
+++ b/ACE/tests/Compiler_Features_09_Test.cpp
@@ -62,6 +62,7 @@ run_main (int, ACE_TCHAR *[])
// failure
int status = 0;
+#ifndef ACE_HAS_CPP17 // There is no auto_ptr in C++17
// ... 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);
@@ -102,6 +103,7 @@ run_main (int, ACE_TCHAR *[])
));
}
+#endif
ACE_END_TEST;
return status;
}
diff --git a/ACE/tests/Compiler_Features_10_Test.cpp b/ACE/tests/Compiler_Features_10_Test.cpp
index 6882b316315..d4ca21624e0 100644
--- a/ACE/tests/Compiler_Features_10_Test.cpp
+++ b/ACE/tests/Compiler_Features_10_Test.cpp
@@ -184,7 +184,11 @@ run_main (int, ACE_TCHAR *[])
{
// ... start the test fresh ...
reset_counts();
+#ifdef ACE_HAS_CPP17
+ const auto b = std::make_unique<Aggregate>();
+#else
std::auto_ptr<Aggregate> b(new Aggregate);
+#endif
never_reached(__FILE__, __LINE__);
}
catch(...)
diff --git a/ACE/tests/DLL_Test.cpp b/ACE/tests/DLL_Test.cpp
index 7b8a39f1f37..1c1b8cda4a3 100644
--- a/ACE/tests/DLL_Test.cpp
+++ b/ACE/tests/DLL_Test.cpp
@@ -18,6 +18,8 @@
#include "ace/OS_NS_dlfcn.h"
#include "DLL_Test.h"
+#include <memory>
+
#if defined (ACE_LD_DECORATOR_STR)
# define OBJ_SUFFIX ACE_LD_DECORATOR_STR ACE_DLL_SUFFIX
#else
diff --git a/ACE/tests/Integer_Truncate_Test.cpp b/ACE/tests/Integer_Truncate_Test.cpp
index 61e5dc9d32e..0cc5a07d05d 100644
--- a/ACE/tests/Integer_Truncate_Test.cpp
+++ b/ACE/tests/Integer_Truncate_Test.cpp
@@ -329,8 +329,11 @@ sizeof_from_gt_sizeof_to (void)
* Test method invocation functor.
*/
template <typename T>
-struct Caller : public std::unary_function<T, void>
+struct Caller
{
+ typedef T argument_type;
+ typedef void result_type;
+
/// Constructor
Caller (void) : success (true) {}
diff --git a/ACE/tests/Reactor_Remove_Resume_Test.cpp b/ACE/tests/Reactor_Remove_Resume_Test.cpp
index 40a2334f103..8463beeccb0 100644
--- a/ACE/tests/Reactor_Remove_Resume_Test.cpp
+++ b/ACE/tests/Reactor_Remove_Resume_Test.cpp
@@ -381,8 +381,11 @@ tp_reactor_factory (void)
*
* Reactor test execution functor.
*/
-struct Run_Test : public std::unary_function<reactor_factory_type, void>
+struct Run_Test
{
+ typedef reactor_factory_type argument_type;
+ typedef void result_type;
+
/// Function call operator overload.
void operator() (reactor_factory_type factory)
{
diff --git a/ACE/tests/randomize.h b/ACE/tests/randomize.h
index bdebd4db5e9..5389814548f 100644
--- a/ACE/tests/randomize.h
+++ b/ACE/tests/randomize.h
@@ -48,9 +48,10 @@ namespace
*/
template<typename T>
class randomize_element
- : public std::unary_function<T &, void>
{
public:
+ typedef T &argument_type;
+ typedef void result_type;
randomize_element (T * array, size_t size, unsigned int seed)
: array_ (array)