summaryrefslogtreecommitdiff
path: root/ACE
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2021-06-07 21:22:22 +0200
committerGitHub <noreply@github.com>2021-06-07 21:22:22 +0200
commit072c0939cc2a824ced1fb3ab7091b74c3bb092c3 (patch)
tree434d62446c8d490c0309774d510b39e9c4150a81 /ACE
parent6f6f7ea0c8fcde679ef21a59a4686043b02d3057 (diff)
parentd8971212c4f9e3ddef1965d93e55a9814f0161a4 (diff)
downloadATCD-072c0939cc2a824ced1fb3ab7091b74c3bb092c3.tar.gz
Merge branch 'master' into jwi-ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB
Diffstat (limited to 'ACE')
-rw-r--r--ACE/ace/Bound_Ptr.inl23
-rw-r--r--ACE/ace/CORBA_macros.h53
-rw-r--r--ACE/ace/Future.cpp8
-rw-r--r--ACE/ace/OS_Memory.h189
-rw-r--r--ACE/ace/README3
-rw-r--r--ACE/ace/Refcounted_Auto_Ptr.inl8
-rw-r--r--ACE/ace/Svc_Handler.cpp13
-rw-r--r--ACE/ace/Svc_Handler.h6
-rw-r--r--ACE/ace/config-all.h12
-rw-r--r--ACE/ace/config-g++-common.h2
-rw-r--r--ACE/ace/config-hpux-11.00.h5
-rw-r--r--ACE/ace/config-icc-common.h2
-rw-r--r--ACE/ace/config-integritySCA.h1
-rw-r--r--ACE/ace/config-lynxos.h1
-rw-r--r--ACE/ace/config-mqx.h1
-rw-r--r--ACE/ace/config-openvms.h1
-rw-r--r--ACE/ace/config-suncc-common.h2
-rw-r--r--ACE/ace/config-sunos5.4-sunc++-4.x.h4
-rw-r--r--ACE/ace/config-sunos5.5.h5
-rw-r--r--ACE/ace/config-win32-borland.h1
-rw-r--r--ACE/ace/config-win32-msvc-14.h8
-rw-r--r--ACE/ace/config-win32-msvc.h18
-rw-r--r--ACE/examples/DLL/Newsweek.cpp8
-rw-r--r--ACE/examples/DLL/Newsweek.h6
-rw-r--r--ACE/examples/DLL/Today.cpp8
-rw-r--r--ACE/examples/DLL/Today.h6
-rw-r--r--ACE/examples/Shared_Malloc/test_persistence.cpp6
-rw-r--r--ACE/tests/DLL_Test_Impl.cpp9
-rw-r--r--ACE/tests/DLL_Test_Impl.h7
-rw-r--r--ACE/tests/Dynamic_Test.cpp16
-rw-r--r--ACE/tests/New_Fail_Test.cpp5
31 files changed, 83 insertions, 354 deletions
diff --git a/ACE/ace/Bound_Ptr.inl b/ACE/ace/Bound_Ptr.inl
index c5699e84030..5a7de11982a 100644
--- a/ACE/ace/Bound_Ptr.inl
+++ b/ACE/ace/Bound_Ptr.inl
@@ -1,8 +1,5 @@
/* -*- C++ -*- */
#include "ace/Guard_T.h"
-#if !defined (ACE_NEW_THROWS_EXCEPTIONS)
-# include "ace/Log_Category.h"
-#endif /* ACE_NEW_THROWS_EXCEPTIONS */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -21,17 +18,11 @@ ACE_Bound_Ptr_Counter<ACE_LOCK>::create_strong ()
{
// Set initial object reference count to 1.
ACE_Bound_Ptr_Counter<ACE_LOCK> *temp = internal_create (1);
-#if defined (ACE_NEW_THROWS_EXCEPTIONS)
- if (temp == 0)
- ACE_throw_bad_alloc;
-#else
- ACE_ASSERT (temp != 0);
-#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+ if (!temp)
+ throw std::bad_alloc ();
return temp;
}
-
-
template <class ACE_LOCK> inline long
ACE_Bound_Ptr_Counter<ACE_LOCK>::attach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK>* counter)
{
@@ -41,7 +32,7 @@ ACE_Bound_Ptr_Counter<ACE_LOCK>::attach_strong (ACE_Bound_Ptr_Counter<ACE_LOCK>*
if (counter->obj_ref_count_ == -1)
return -1;
- long new_obj_ref_count = ++counter->obj_ref_count_;
+ long const new_obj_ref_count = ++counter->obj_ref_count_;
++counter->self_ref_count_;
return new_obj_ref_count;
@@ -82,12 +73,8 @@ ACE_Bound_Ptr_Counter<ACE_LOCK>::create_weak ()
// Set initial object reference count to 0.
ACE_Bound_Ptr_Counter<ACE_LOCK> *temp = internal_create (0);
-#if defined (ACE_NEW_THROWS_EXCEPTIONS)
- if (temp == 0)
- ACE_throw_bad_alloc;
-#else
- ACE_ASSERT (temp != 0);
-#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+ if (!temp)
+ throw std::bad_alloc ();
return temp;
}
diff --git a/ACE/ace/CORBA_macros.h b/ACE/ace/CORBA_macros.h
index 995aa2e9c80..e79f3e61501 100644
--- a/ACE/ace/CORBA_macros.h
+++ b/ACE/ace/CORBA_macros.h
@@ -24,62 +24,27 @@
#include /**/ "ace/config-all.h"
-# if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-# endif /* ACE_LACKS_PRAGMA_ONCE */
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
-// The Windows MFC exception mechanism requires that a caught CException
-// (including the CMemoryException in use here) be freed using its Delete()
-// method. Thus, when MFC is in use and we're catching exceptions as a result
-// of new(), the exception's Delete() method has to be called. No other
-// platform imposes this sort of restriction/requirement. The Windows
-// config stuff (at least for MSVC/MFC) defines a ACE_del_bad_alloc macro
-// that works with its ACE_bad_alloc macro to implement this cleanup
-// requirement. Since no other platform requires this, define it as
-// empty here.
-#if !defined (ACE_del_bad_alloc)
-# define ACE_del_bad_alloc
-#endif
-
-#if defined(ACE_NEW_THROWS_EXCEPTIONS)
-
-# if defined (ACE_HAS_NEW_NOTHROW)
-
-# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
- do { POINTER = new (ACE_nothrow) CONSTRUCTOR; \
- if (POINTER == 0) { throw EXCEPTION; } \
- } while (0)
-
-# else
-
-# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
- do { try { POINTER = new CONSTRUCTOR; } \
- catch (ACE_bad_alloc) { ACE_del_bad_alloc throw EXCEPTION; } \
+#define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
+ do { POINTER = new (std::nothrow) CONSTRUCTOR; \
+ if (POINTER == nullptr) { throw EXCEPTION; } \
} while (0)
-# endif /* ACE_HAS_NEW_NOTHROW */
-
-#else /* ! ACE_NEW_THROWS_EXCEPTIONS */
-
-# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \
- do { POINTER = new CONSTRUCTOR; \
- if (POINTER == 0) { throw EXCEPTION; } \
- } while (0)
-
-#endif /* ACE_NEW_THROWS_EXCEPTIONS */
-
// FUZZ: disable check_for_ACE_Guard
# define ACE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
ACE_Guard< MUTEX > OBJ (LOCK); \
- if (OBJ.locked () == 0) throw EXCEPTION;
+ if (!OBJ.locked ()) throw EXCEPTION;
# define ACE_READ_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
ACE_Read_Guard< MUTEX > OBJ (LOCK); \
- if (OBJ.locked () == 0) throw EXCEPTION;
+ if (!OBJ.locked ()) throw EXCEPTION;
# define ACE_WRITE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \
ACE_Write_Guard< MUTEX > OBJ (LOCK); \
- if (OBJ.locked () == 0) throw EXCEPTION;
+ if (!OBJ.locked ()) throw EXCEPTION;
// FUZZ: enable check_for_ACE_Guard
#include /**/ "ace/post.h"
diff --git a/ACE/ace/Future.cpp b/ACE/ace/Future.cpp
index 7b4a37d414f..d77b8c0a28c 100644
--- a/ACE/ace/Future.cpp
+++ b/ACE/ace/Future.cpp
@@ -86,12 +86,8 @@ ACE_Future_Rep<T>::create (void)
{
// Yes set ref count to zero.
ACE_Future_Rep<T> *temp = internal_create ();
-#if defined (ACE_NEW_THROWS_EXCEPTIONS)
- if (temp == 0)
- ACE_throw_bad_alloc;
-#else
- ACE_ASSERT (temp != 0);
-#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+ if (!temp)
+ throw std::bad_alloc ();
return temp;
}
diff --git a/ACE/ace/OS_Memory.h b/ACE/ace/OS_Memory.h
index 5effb926954..fd8262de6ae 100644
--- a/ACE/ace/OS_Memory.h
+++ b/ACE/ace/OS_Memory.h
@@ -60,183 +60,28 @@ typedef void * ACE_MALLOC_T;
ACE_END_VERSIONED_NAMESPACE_DECL
-// ============================================================================
-// ACE_NEW macros
-//
-// A useful abstraction for expressions involving operator new since
-// we can change memory allocation error handling policies (e.g.,
-// depending on whether ANSI/ISO exception handling semantics are
-// being used).
-// ============================================================================
-
-// If new(std::nothrow) is defined then, by definition, new throws exceptions.
-#if defined (ACE_HAS_NEW_NOTHROW)
-# if !defined (ACE_NEW_THROWS_EXCEPTIONS)
-# define ACE_NEW_THROWS_EXCEPTIONS
-# endif
-#endif
-
-// The Windows MFC exception mechanism requires that a caught CException
-// (including the CMemoryException in use here) be freed using its Delete()
-// method. Thus, when MFC is in use and we're catching exceptions as a result
-// of new(), the exception's Delete() method has to be called. No other
-// platform imposes this sort of restriction/requirement. The Windows
-// config stuff (at least for MSVC/MFC) defines a ACE_del_bad_alloc macro
-// that works with its ACE_bad_alloc macro to implement this cleanup
-// requirement. Since no other platform requires this, define it as
-// empty here.
-#if !defined (ACE_del_bad_alloc)
-# define ACE_del_bad_alloc
-#endif
-
-#if defined (ACE_NEW_THROWS_EXCEPTIONS)
-
-// Since new() throws exceptions, we need a way to avoid passing
-// exceptions past the call to new because ACE counts on having a 0
-// return value for a failed allocation. Some compilers offer the
-// new (nothrow) version, which does exactly what we want. Others
-// do not. For those that do not, this sets up what exception is thrown,
-// and then below we'll do a try/catch around the new to catch it and
-// return a 0 pointer instead.
-
-# if defined (__HP_aCC)
- // I know this works for HP aC++... if <stdexcept> is used, it
- // introduces other stuff that breaks things, like <memory>, which
- // screws up auto_ptr.
-# include /**/ <new>
- // _HP_aCC was first defined at aC++ 03.13 on HP-UX 11. Prior to that
- // (03.10 and before) a failed new threw bad_alloc. After that (03.13
- // and above) the exception thrown is dependent on the below settings.
-# if (HPUX_VERS >= 1100)
-# if ((__HP_aCC < 32500 && !defined (RWSTD_NO_NAMESPACE)) || \
- defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB))
-# define ACE_bad_alloc ::std::bad_alloc
-# define ACE_nothrow ::std::nothrow
-# define ACE_nothrow_t ::std::nothrow_t
-# else
-# define ACE_bad_alloc bad_alloc
-# define ACE_nothrow nothrow
-# define ACE_nothrow_t nothrow_t
-# endif /* __HP_aCC */
-# elif ((__HP_aCC < 12500 && !defined (RWSTD_NO_NAMESPACE)) || \
- defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB))
-# define ACE_bad_alloc ::std::bad_alloc
-# define ACE_nothrow ::std::nothrow
-# define ACE_nothrow_t ::std::nothrow_t
-# else
-# define ACE_bad_alloc bad_alloc
-# define ACE_nothrow nothrow
-# define ACE_nothrow_t nothrow_t
-# endif /* HPUX_VERS < 1100 */
-# define ACE_throw_bad_alloc throw ACE_bad_alloc ()
-# elif defined (__SUNPRO_CC)
-# if (__SUNPRO_CC < 0x500) || (__SUNPRO_CC_COMPAT == 4)
-# include /**/ <exception.h>
- // Note: we catch ::xalloc rather than just xalloc because of
- // a name clash with unsafe_ios::xalloc()
-# define ACE_bad_alloc ::xalloc
-# define ACE_throw_bad_alloc throw ACE_bad_alloc ("no more memory")
-# else
-# include /**/ <new>
-# define ACE_bad_alloc ::std::bad_alloc
-# if defined (ACE_HAS_NEW_NOTHROW)
-# if defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
-# define ACE_nothrow ::std::nothrow
-# define ACE_nothrow_t ::std::nothrow_t
-# else
-# define ACE_nothrow nothrow
-# define ACE_nothrow_t nothrow_t
-# endif /* ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB */
-# endif /* ACE_HAS_NEW_NOTHROW */
-# define ACE_throw_bad_alloc throw ACE_bad_alloc ()
-# endif /* __SUNPRO_CC < 0x500 */
-# elif defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB)
-# include /**/ <new>
-# if !defined (ACE_bad_alloc)
-# define ACE_bad_alloc ::std::bad_alloc
-# endif
-# define ACE_nothrow ::std::nothrow
-# define ACE_nothrow_t ::std::nothrow_t
- // MFC changes the behavior of operator new at all MSVC versions from 6 up.
-# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC == 1)
-# define ACE_throw_bad_alloc AfxThrowMemoryException ()
-# else
-# define ACE_throw_bad_alloc throw ACE_bad_alloc ()
-# endif
-# else
-# include /**/ <new>
-# if !defined (ACE_bad_alloc)
-# define ACE_bad_alloc bad_alloc
-# endif
-# define ACE_nothrow nothrow
-# define ACE_nothrow_t nothrow_t
- // MFC changes the behavior of operator new at all MSVC versions from 6 up.
-# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC == 1)
-# define ACE_throw_bad_alloc AfxThrowMemoryException ()
-# else
-# define ACE_throw_bad_alloc throw ACE_bad_alloc ()
-# endif
-# endif /* __HP_aCC */
-
-# if defined (ACE_HAS_NEW_NOTHROW)
-# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \
- do { POINTER = new (ACE_nothrow) CONSTRUCTOR; \
- if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \
- } while (0)
-# define ACE_NEW(POINTER,CONSTRUCTOR) \
- do { POINTER = new(ACE_nothrow) CONSTRUCTOR; \
- if (POINTER == 0) { errno = ENOMEM; return; } \
- } while (0)
-# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \
- do { POINTER = new(ACE_nothrow) CONSTRUCTOR; \
- if (POINTER == 0) { errno = ENOMEM; } \
- } while (0)
-
-# else
-
-# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \
- do { try { POINTER = new CONSTRUCTOR; } \
- catch (ACE_bad_alloc) { ACE_del_bad_alloc errno = ENOMEM; POINTER = 0; return RET_VAL; } \
- } while (0)
-
-# define ACE_NEW(POINTER,CONSTRUCTOR) \
- do { try { POINTER = new CONSTRUCTOR; } \
- catch (ACE_bad_alloc) { ACE_del_bad_alloc errno = ENOMEM; POINTER = 0; return; } \
- } while (0)
+// For backwards compatibility, we except all compilers to support these
+#include /**/ <new>
+#define ACE_bad_alloc std::bad_alloc
+#define ACE_nothrow std::nothrow
+#define ACE_nothrow_t std::nothrow_t
+#define ACE_del_bad_alloc
+#define ACE_throw_bad_alloc throw std::bad_alloc ()
-# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \
- do { try { POINTER = new CONSTRUCTOR; } \
- catch (ACE_bad_alloc) { ACE_del_bad_alloc errno = ENOMEM; POINTER = 0; } \
- } while (0)
-# endif /* ACE_HAS_NEW_NOTHROW */
-
-#else /* ACE_NEW_THROWS_EXCEPTIONS */
-
-# define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \
- do { POINTER = new CONSTRUCTOR; \
- if (POINTER == 0) { errno = ENOMEM; return RET_VAL; } \
+// ACE_NEW macros
+#define ACE_NEW_RETURN(POINTER,CONSTRUCTOR,RET_VAL) \
+ do { POINTER = new (std::nothrow) CONSTRUCTOR; \
+ if (POINTER == nullptr) { errno = ENOMEM; return RET_VAL; } \
} while (0)
-# define ACE_NEW(POINTER,CONSTRUCTOR) \
- do { POINTER = new CONSTRUCTOR; \
- if (POINTER == 0) { errno = ENOMEM; return; } \
+#define ACE_NEW(POINTER,CONSTRUCTOR) \
+ do { POINTER = new(std::nothrow) CONSTRUCTOR; \
+ if (POINTER == nullptr) { errno = ENOMEM; return; } \
} while (0)
-# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \
- do { POINTER = new CONSTRUCTOR; \
- if (POINTER == 0) { errno = ENOMEM; } \
+#define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \
+ do { POINTER = new(std::nothrow) CONSTRUCTOR; \
+ if (POINTER == nullptr) { errno = ENOMEM; } \
} while (0)
-# if !defined (ACE_bad_alloc)
- class ACE_bad_alloc_class {};
-# define ACE_bad_alloc ACE_bad_alloc_class
-# endif
-# if defined (ACE_HAS_MFC) && (ACE_HAS_MFC == 1)
-# define ACE_throw_bad_alloc AfxThrowMemoryException ()
-# else
-# define ACE_throw_bad_alloc return 0
-# endif
-
-#endif /* ACE_NEW_THROWS_EXCEPTIONS */
-
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
//@{
/**
diff --git a/ACE/ace/README b/ACE/ace/README
index 1e8ec6c77de..fbd2c53c2ab 100644
--- a/ACE/ace/README
+++ b/ACE/ace/README
@@ -64,8 +64,6 @@ ACE_MKDIR_LACKS_MODE This platform has a mkdir function with
a mode argument
ACE_MT_SAFE Compile using multi-thread libraries
ACE_NDEBUG Turns off debugging features
-ACE_NEW_THROWS_EXCEPTIONS Compiler's 'new' throws exception on
- failure (ANSI C++ behavior).
ACE_NLOGGING Turns off the LM_DEBUG and
LM_ERROR logging macros...
ACE_NTRACE Turns off the tracing feature when = 1.
@@ -354,7 +352,6 @@ ACE_HAS_MT_SAFE_MKTIME Platform supports MT safe
ACE_HAS_MUTEX_TIMEOUTS Compiler supports timed mutex
acquisitions
(e.g. pthread_mutex_timedlock()).
-ACE_HAS_NEW_NOTHROW Compiler offers new (nothrow).
ACE_HAS_NONCONST_CHDIR Platform uses non-const char *
in call to chdir
ACE_HAS_NONCONST_CLOCK_SETTIME Platform uses non-const
diff --git a/ACE/ace/Refcounted_Auto_Ptr.inl b/ACE/ace/Refcounted_Auto_Ptr.inl
index 0cd7925716c..f4710b42688 100644
--- a/ACE/ace/Refcounted_Auto_Ptr.inl
+++ b/ACE/ace/Refcounted_Auto_Ptr.inl
@@ -37,12 +37,8 @@ ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK>::create (X *p)
{
// Yes set ref count to zero.
ACE_Refcounted_Auto_Ptr_Rep<X, ACE_LOCK> *temp = internal_create (p);
-#if defined (ACE_NEW_THROWS_EXCEPTIONS)
- if (temp == 0)
- ACE_throw_bad_alloc;
-#else
- ACE_ASSERT (temp != 0);
-#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+ if (!temp)
+ throw std::bad_alloc ();
return temp;
}
diff --git a/ACE/ace/Svc_Handler.cpp b/ACE/ace/Svc_Handler.cpp
index c5830ed950c..9d5234f2cc5 100644
--- a/ACE/ace/Svc_Handler.cpp
+++ b/ACE/ace/Svc_Handler.cpp
@@ -35,14 +35,14 @@ ACE_Svc_Handler<PEER_STREAM, SYNCH_TRAITS>::operator new (size_t n)
ACE_Dynamic *const dynamic_instance = ACE_Dynamic::instance ();
- if (dynamic_instance == 0)
+ if (!dynamic_instance)
{
// If this ACE_ASSERT fails, it may be due to running of out TSS
// keys. Try using ACE_HAS_TSS_EMULATION, or increasing
// ACE_DEFAULT_THREAD_KEYS if already using TSS emulation.
ACE_ASSERT (dynamic_instance != 0);
- ACE_throw_bad_alloc;
+ throw std::bad_alloc ();
}
else
{
@@ -54,10 +54,9 @@ ACE_Svc_Handler<PEER_STREAM, SYNCH_TRAITS>::operator new (size_t n)
}
}
-#if defined (ACE_HAS_NEW_NOTHROW)
template <typename PEER_STREAM, typename SYNCH_TRAITS> void *
ACE_Svc_Handler<PEER_STREAM, SYNCH_TRAITS>::operator new (size_t n,
- const ACE_nothrow_t&) throw()
+ const std::nothrow_t&) throw()
{
ACE_TRACE ("ACE_Svc_Handler<PEER_STREAM, SYNCH_TRAITS>::operator new(nothrow)");
@@ -78,20 +77,18 @@ ACE_Svc_Handler<PEER_STREAM, SYNCH_TRAITS>::operator new (size_t n,
// storage, depending on config flags).
dynamic_instance->set ();
- return ::new(ACE_nothrow) char[n];
+ return ::new(std::nothrow) char[n];
}
}
template <typename PEER_STREAM, typename SYNCH_TRAITS> void
ACE_Svc_Handler<PEER_STREAM, SYNCH_TRAITS>::operator delete (void *p,
- const ACE_nothrow_t&) throw()
+ const std::nothrow_t&) throw()
{
ACE_TRACE("ACE_Svc_Handler<PEER_STREAM, SYNCH_TRAITS>::operator delete(nothrow)");
::delete [] static_cast <char *> (p);
}
-#endif /* ACE_HAS_NEW_NOTHROW */
-
template <typename PEER_STREAM, typename SYNCH_TRAITS> void
ACE_Svc_Handler<PEER_STREAM, SYNCH_TRAITS>::destroy ()
{
diff --git a/ACE/ace/Svc_Handler.h b/ACE/ace/Svc_Handler.h
index a02ac24c15a..f4db11ea9a5 100644
--- a/ACE/ace/Svc_Handler.h
+++ b/ACE/ace/Svc_Handler.h
@@ -170,14 +170,12 @@ public:
/// dynamically.
void *operator new (size_t n);
-#if defined (ACE_HAS_NEW_NOTHROW)
/// Overloaded new operator, nothrow_t variant. Unobtrusively records if a
/// <Svc_Handler> is allocated dynamically, which allows it to clean
/// itself up correctly whether or not it's allocated statically or
/// dynamically.
- void *operator new (size_t n, const ACE_nothrow_t&) throw();
- void operator delete (void *p, const ACE_nothrow_t&) throw ();
-#endif
+ void *operator new (size_t n, const std::nothrow_t&) throw();
+ void operator delete (void *p, const std::nothrow_t&) throw ();
/// This operator permits "placement new" on a per-object basis.
void * operator new (size_t n, void *p);
diff --git a/ACE/ace/config-all.h b/ACE/ace/config-all.h
index e2d162e9f21..e16e80c0c8f 100644
--- a/ACE/ace/config-all.h
+++ b/ACE/ace/config-all.h
@@ -92,6 +92,18 @@
# define ACE_HAS_STANDARD_CPP_LIBRARY 1
#endif
+// Define ACE_NEW_THROWS_EXCEPTIONS for all compilers, we
+// expect all compilers to do so
+#if !defined (ACE_NEW_THROWS_EXCEPTIONS)
+# define ACE_NEW_THROWS_EXCEPTIONS
+#endif /* ACE_NEW_THROWS_EXCEPTIONS */
+
+// Define ACE_HAS_NEW_NOTHROW for all compilers, we
+// except all compilers to support this
+#if !defined (ACE_HAS_NEW_NOTHROW)
+# define ACE_HAS_NEW_NOTHROW
+#endif /* ACE_HAS_NEW_NOTHROW */
+
// These includes are here to avoid circular dependencies.
// Keep this at the bottom of the file. It contains the main macros.
#include "ace/OS_main.h"
diff --git a/ACE/ace/config-g++-common.h b/ACE/ace/config-g++-common.h
index 170ec74030c..0548fc1ce43 100644
--- a/ACE/ace/config-g++-common.h
+++ b/ACE/ace/config-g++-common.h
@@ -16,8 +16,6 @@
#define ACE_TEMPLATES_REQUIRE_SOURCE
#define ACE_EXPLICIT_TEMPLATE_DESTRUCTOR_TAKES_ARGS
-#define ACE_NEW_THROWS_EXCEPTIONS
-#define ACE_HAS_NEW_NOTHROW
#if __cplusplus >= 201103L
# define ACE_HAS_CPP11
diff --git a/ACE/ace/config-hpux-11.00.h b/ACE/ace/config-hpux-11.00.h
index 63932a83bc3..3d1775532c6 100644
--- a/ACE/ace/config-hpux-11.00.h
+++ b/ACE/ace/config-hpux-11.00.h
@@ -27,11 +27,6 @@
// Platform lacks streambuf "linebuffered ()".
# define ACE_LACKS_LINEBUFFERED_STREAMBUF 1
-// Compiler's 'new' throws exceptions on failure, regardless of whether or
-// not exception handling is enabled in the compiler options. Fortunately,
-// new(nothrow_t) is offered.
-# define ACE_NEW_THROWS_EXCEPTIONS
-# define ACE_HAS_NEW_NOTHROW
# define ACE_HAS_NEW_NO_H 1
// Compiler's template mechanism must see source code (i.e., .C files).
diff --git a/ACE/ace/config-icc-common.h b/ACE/ace/config-icc-common.h
index a426425c4c8..1f4438550f5 100644
--- a/ACE/ace/config-icc-common.h
+++ b/ACE/ace/config-icc-common.h
@@ -42,8 +42,6 @@
# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE<CLASS, LOCK>;
#endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */
-#define ACE_NEW_THROWS_EXCEPTIONS
-
#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE)
# define ACE_SIZEOF_LONG_DOUBLE 12
#endif /* i386 */
diff --git a/ACE/ace/config-integritySCA.h b/ACE/ace/config-integritySCA.h
index f7c4a68d366..7c48856e50f 100644
--- a/ACE/ace/config-integritySCA.h
+++ b/ACE/ace/config-integritySCA.h
@@ -24,7 +24,6 @@
#define ACE_LACKS_GETEGID
#define ACE_LACKS_GETGID
-#define ACE_NEW_THROWS_EXCEPTIONS
#define ACE_TEMPLATES_REQUIRE_SOURCE 1
#define TAO_USE_SEQUENCE_TEMPLATES
#define _REENTRANT
diff --git a/ACE/ace/config-lynxos.h b/ACE/ace/config-lynxos.h
index e2f6a3f93c6..b45bc08388d 100644
--- a/ACE/ace/config-lynxos.h
+++ b/ACE/ace/config-lynxos.h
@@ -55,7 +55,6 @@
#define ACE_HAS_MKDIR
#define ACE_HAS_MSG
#define ACE_HAS_NANOSLEEP
-#define ACE_HAS_NEW_NOTHROW
#define ACE_HAS_NONCONST_CLOCK_SETTIME
#define ACE_HAS_NONCONST_MSGSND
#define ACE_HAS_NONCONST_READV
diff --git a/ACE/ace/config-mqx.h b/ACE/ace/config-mqx.h
index e419bbc5f57..b27de279666 100644
--- a/ACE/ace/config-mqx.h
+++ b/ACE/ace/config-mqx.h
@@ -331,7 +331,6 @@ inline int puts(const char* str) {
#define ACE_HAS_SOCKLEN_T
#define ACE_HAS_DIRENT
-#define ACE_NEW_THROWS_EXCEPTIONS
#define ACE_TEXT_WIN32_FIND_DATA MFS_SEARCH_DATA
#define ACE_LACKS_UNIX_SIGNALS
diff --git a/ACE/ace/config-openvms.h b/ACE/ace/config-openvms.h
index 5b42e4f1e30..e6b38678af2 100644
--- a/ACE/ace/config-openvms.h
+++ b/ACE/ace/config-openvms.h
@@ -151,7 +151,6 @@
#define ACE_HAS_PTHREAD_SCHEDPARAM 1
/* language/platform conformance */
-#define ACE_NEW_THROWS_EXCEPTIONS 1
#define ACE_TEMPLATES_REQUIRE_SOURCE 1
#define ACE_HAS_AUTOMATIC_INIT_FINI 1
#define ACE_LACKS_UNIX_SIGNALS 1
diff --git a/ACE/ace/config-suncc-common.h b/ACE/ace/config-suncc-common.h
index 8927208d361..737d7723514 100644
--- a/ACE/ace/config-suncc-common.h
+++ b/ACE/ace/config-suncc-common.h
@@ -21,8 +21,6 @@
# define ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) __extension__ extern template class SINGLETON_TYPE<CLASS, LOCK>;
#endif /* ACE_HAS_CUSTOM_EXPORT_MACROS == 0 */
-#define ACE_NEW_THROWS_EXCEPTIONS
-
#if (defined (i386) || defined (__i386__)) && !defined (ACE_SIZEOF_LONG_DOUBLE)
# define ACE_SIZEOF_LONG_DOUBLE 12
#endif /* i386 */
diff --git a/ACE/ace/config-sunos5.4-sunc++-4.x.h b/ACE/ace/config-sunos5.4-sunc++-4.x.h
index c4c7fa4bcc1..4bcec509c33 100644
--- a/ACE/ace/config-sunos5.4-sunc++-4.x.h
+++ b/ACE/ace/config-sunos5.4-sunc++-4.x.h
@@ -168,9 +168,5 @@
#define ACE_HAS_GPERF
#define ACE_HAS_DIRENT
-// If exceptions are enabled and we are using Sun/CC then
-// <operator new> throws an exception instead of returning 0.
-#define ACE_NEW_THROWS_EXCEPTIONS
-
#include /**/ "ace/post.h"
#endif /* ACE_CONFIG_H */
diff --git a/ACE/ace/config-sunos5.5.h b/ACE/ace/config-sunos5.5.h
index e0b5e0213dd..2e4c2d28451 100644
--- a/ACE/ace/config-sunos5.5.h
+++ b/ACE/ace/config-sunos5.5.h
@@ -44,7 +44,6 @@
# if (__SUNPRO_CC_COMPAT >= 5)
# define ACE_HAS_THR_C_DEST
# endif /* __SUNPRO_CC_COMPAT >= 5 */
-# define ACE_HAS_NEW_NOTHROW
# endif /* __SUNPRO_CC >= 0x500 */
# endif /* __SUNPRO_CC >= 0x420 */
@@ -55,10 +54,6 @@
# define ACE_LACKS_LINEBUFFERED_STREAMBUF
# define ACE_LACKS_SIGNED_CHAR
-// If exceptions are enabled and we are using Sun/CC then
-// <operator new> throws an exception instead of returning 0.
-#define ACE_NEW_THROWS_EXCEPTIONS
-
/* If you want to disable threading with Sun CC, remove -mt
from your CFLAGS, e.g., using make threads=0. */
diff --git a/ACE/ace/config-win32-borland.h b/ACE/ace/config-win32-borland.h
index 14e0e2f213a..69923890d2b 100644
--- a/ACE/ace/config-win32-borland.h
+++ b/ACE/ace/config-win32-borland.h
@@ -121,7 +121,6 @@
#define ACE_HAS_USER_MODE_MASKS 1
#define ACE_LACKS_ACE_IOSTREAM 1
#define ACE_LACKS_LINEBUFFERED_STREAMBUF 1
-#define ACE_HAS_NEW_NOTHROW
#define ACE_TEMPLATES_REQUIRE_SOURCE 1
#if defined (ACE_HAS_BCC32)
# define ACE_UINT64_FORMAT_SPECIFIER_ASCII "%Lu"
diff --git a/ACE/ace/config-win32-msvc-14.h b/ACE/ace/config-win32-msvc-14.h
index c9fce1bc734..4cdd59b7226 100644
--- a/ACE/ace/config-win32-msvc-14.h
+++ b/ACE/ace/config-win32-msvc-14.h
@@ -76,8 +76,12 @@
# define ACE_LACKS_ACE_IOSTREAM
# endif /* ! ACE_USES_OLD_IOSTREAMS */
-#define ACE_NEW_THROWS_EXCEPTIONS
-#define ACE_HAS_NEW_NOTHROW
+#else
+
+// iostream header lacks ipfx (), isfx (), etc., declarations
+# define ACE_LACKS_IOSTREAM_FX
+
+#endif
// There are too many instances of this warning to fix it right now.
// Maybe in the future.
diff --git a/ACE/ace/config-win32-msvc.h b/ACE/ace/config-win32-msvc.h
index 63004ef78ce..58d44eb8019 100644
--- a/ACE/ace/config-win32-msvc.h
+++ b/ACE/ace/config-win32-msvc.h
@@ -49,24 +49,6 @@
#endif
//FUZZ: enable check_for_msc_ver
-// MFC changes the behavior of operator new at all MSVC versions from 6 up
-// by throwing a static CMemoryException* instead of std::bad_alloc
-// (see ace/OS_Memory.h). This MFC exception object needs to be cleaned up
-// by calling its Delete() method.
-#if defined (ACE_HAS_MFC) && (ACE_HAS_MFC == 1)
-# if !defined (ACE_NEW_THROWS_EXCEPTIONS)
-# define ACE_NEW_THROWS_EXCEPTIONS
-# endif
-# if defined (ACE_bad_alloc)
-# undef ACE_bad_alloc
-# endif
-# define ACE_bad_alloc CMemoryException *e
-# if defined (ACE_del_bad_alloc)
-# undef ACE_del_bad_alloc
-# endif
-# define ACE_del_bad_alloc e->Delete();
-#endif /* ACE_HAS_MFC && ACE_HAS_MFC==1 */
-
#if defined(ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
// must have _MT defined to include multithreading
// features from win32 headers
diff --git a/ACE/examples/DLL/Newsweek.cpp b/ACE/examples/DLL/Newsweek.cpp
index f93c57acf01..65856fe18c6 100644
--- a/ACE/examples/DLL/Newsweek.cpp
+++ b/ACE/examples/DLL/Newsweek.cpp
@@ -18,18 +18,16 @@ Newsweek::operator new (size_t bytes)
{
return ::new char[bytes];
}
-#if defined (ACE_HAS_NEW_NOTHROW)
void *
-Newsweek::operator new (size_t bytes, const ACE_nothrow_t&)
+Newsweek::operator new (size_t bytes, const std::nothrow_t&)
{
- return ::new (ACE_nothrow) char[bytes];
+ return ::new (std::nothrow) char[bytes];
}
void
-Newsweek::operator delete (void *p, const ACE_nothrow_t&) throw ()
+Newsweek::operator delete (void *p, const std::nothrow_t&) throw ()
{
delete [] static_cast <char *> (p);
}
-#endif
void
Newsweek::operator delete (void *ptr)
{
diff --git a/ACE/examples/DLL/Newsweek.h b/ACE/examples/DLL/Newsweek.h
index 32124b6a04c..dad7ce52fdb 100644
--- a/ACE/examples/DLL/Newsweek.h
+++ b/ACE/examples/DLL/Newsweek.h
@@ -41,11 +41,9 @@ public:
// created/deleted using the memory allocator associated with the
// DLL/SO.
void *operator new (size_t bytes);
-#if defined (ACE_HAS_NEW_NOTHROW)
// Overloaded new operator, nothrow_t variant.
- void *operator new (size_t bytes, const ACE_nothrow_t&);
- void operator delete (void *p, const ACE_nothrow_t&) throw ();
-#endif
+ void *operator new (size_t bytes, const std::nothrow_t&);
+ void operator delete (void *p, const std::nothrow_t&) throw ();
void operator delete (void *ptr);
};
diff --git a/ACE/examples/DLL/Today.cpp b/ACE/examples/DLL/Today.cpp
index 78dc766ce1f..2c48b1053b8 100644
--- a/ACE/examples/DLL/Today.cpp
+++ b/ACE/examples/DLL/Today.cpp
@@ -19,18 +19,16 @@ Today::operator new (size_t bytes)
{
return ::new char[bytes];
}
-#if defined (ACE_HAS_NEW_NOTHROW)
void *
-Today::operator new (size_t bytes, const ACE_nothrow_t&)
+Today::operator new (size_t bytes, const std::nothrow_t&)
{
- return ::new (ACE_nothrow) char[bytes];
+ return ::new (std::nothrow) char[bytes];
}
void
-Today::operator delete (void *p, const ACE_nothrow_t&) throw ()
+Today::operator delete (void *p, const std::nothrow_t&) throw ()
{
delete [] static_cast <char *> (p);
}
-#endif
void
Today::operator delete (void *ptr)
{
diff --git a/ACE/examples/DLL/Today.h b/ACE/examples/DLL/Today.h
index 8a74299420d..b59fb1ff505 100644
--- a/ACE/examples/DLL/Today.h
+++ b/ACE/examples/DLL/Today.h
@@ -42,11 +42,9 @@ public:
// created/deleted using the memory allocator associated with the
// DLL/SO.
void *operator new (size_t bytes);
-#if defined (ACE_HAS_NEW_NOTHROW)
// Overloaded new operator, nothrow_t variant.
- void *operator new (size_t bytes, const ACE_nothrow_t&);
- void operator delete (void *p, const ACE_nothrow_t&) throw ();
-#endif
+ void *operator new (size_t bytes, const std::nothrow_t&);
+ void operator delete (void *p, const std::nothrow_t&) throw ();
void operator delete (void *ptr);
};
diff --git a/ACE/examples/Shared_Malloc/test_persistence.cpp b/ACE/examples/Shared_Malloc/test_persistence.cpp
index 43007928ccc..5635297da03 100644
--- a/ACE/examples/Shared_Malloc/test_persistence.cpp
+++ b/ACE/examples/Shared_Malloc/test_persistence.cpp
@@ -59,16 +59,14 @@ public:
return shmem_allocator->malloc (sizeof (Employee));
}
-#if defined (ACE_HAS_NEW_NOTHROW)
- void *operator new (size_t, const ACE_nothrow_t&)
+ void *operator new (size_t, const std::nothrow_t&)
{
return shmem_allocator->malloc (sizeof (Employee));
}
- void operator delete (void *p, const ACE_nothrow_t&) throw ()
+ void operator delete (void *p, const std::nothrow_t&) throw ()
{
shmem_allocator->free (p);
}
-#endif
void operator delete (void *pointer)
{
diff --git a/ACE/tests/DLL_Test_Impl.cpp b/ACE/tests/DLL_Test_Impl.cpp
index 06b093a852d..8457a82623f 100644
--- a/ACE/tests/DLL_Test_Impl.cpp
+++ b/ACE/tests/DLL_Test_Impl.cpp
@@ -52,24 +52,21 @@ Hello_Impl::operator new (size_t bytes)
return ::new char[bytes];
}
-#if defined (ACE_HAS_NEW_NOTHROW)
- /// Overloaded new operator, nothrow_t variant.
+/// Overloaded new operator, nothrow_t variant.
void *
-Hello_Impl::operator new (size_t bytes, const ACE_nothrow_t &nt)
+Hello_Impl::operator new (size_t bytes, const std::nothrow_t &nt)
{
ACE_DEBUG ((LM_INFO, "Hello_Impl::new\n"));
return ::new (nt) char[bytes];
}
void
-Hello_Impl::operator delete (void *ptr, const ACE_nothrow_t&) throw ()
+Hello_Impl::operator delete (void *ptr, const std::nothrow_t&) throw ()
{
ACE_DEBUG ((LM_INFO, "Hello_Impl::delete\n"));
::delete [] static_cast<char *> (ptr);
}
-#endif /* ACE_HAS_NEW_NOTHROW */
-
void
Hello_Impl::operator delete (void *ptr)
{
diff --git a/ACE/tests/DLL_Test_Impl.h b/ACE/tests/DLL_Test_Impl.h
index 0ca5c5323d0..97db4904e42 100644
--- a/ACE/tests/DLL_Test_Impl.h
+++ b/ACE/tests/DLL_Test_Impl.h
@@ -50,14 +50,11 @@ public:
// DLL/SO.
void *operator new (size_t bytes);
-#if defined (ACE_HAS_NEW_NOTHROW)
/// Overloaded new operator, nothrow_t variant.
- void *operator new (size_t bytes, const ACE_nothrow_t &nt);
- void operator delete (void *p, const ACE_nothrow_t&) throw ();
-#endif /* ACE_HAS_NEW_NOTHROW */
+ void *operator new (size_t bytes, const std::nothrow_t &nt);
+ void operator delete (void *p, const std::nothrow_t&) throw ();
void operator delete (void *ptr);
-
};
#endif /* ACE_TESTS_DLL_TEST_IMPL_H */
diff --git a/ACE/tests/Dynamic_Test.cpp b/ACE/tests/Dynamic_Test.cpp
index 0ffc523544b..958ac6fa10e 100644
--- a/ACE/tests/Dynamic_Test.cpp
+++ b/ACE/tests/Dynamic_Test.cpp
@@ -24,11 +24,8 @@ public:
void *operator new (size_t n);
-#if defined (ACE_HAS_NEW_NOTHROW)
- void *operator new (size_t n, const ACE_nothrow_t&) throw();
- void operator delete (void *p, const ACE_nothrow_t&) throw ();
-#endif
-
+ void *operator new (size_t n, const std::nothrow_t&) throw();
+ void operator delete (void *p, const std::nothrow_t&) throw ();
void * operator new (size_t n, void *p);
void operator delete (void *);
@@ -63,9 +60,8 @@ A::operator new (size_t n)
}
}
-#if defined (ACE_HAS_NEW_NOTHROW)
void*
-A::operator new (size_t n, const ACE_nothrow_t&) throw()
+A::operator new (size_t n, const std::nothrow_t&) throw()
{
ACE_Dynamic *const dynamic_instance = ACE_Dynamic::instance ();
@@ -84,18 +80,16 @@ A::operator new (size_t n, const ACE_nothrow_t&) throw()
// storage, depending on config flags).
dynamic_instance->set ();
- return ::new(ACE_nothrow) char[n];
+ return ::new(std::nothrow) char[n];
}
}
void
-A::operator delete (void *p, const ACE_nothrow_t&) throw()
+A::operator delete (void *p, const std::nothrow_t&) throw()
{
::delete [] static_cast <char *> (p);
}
-#endif /* ACE_HAS_NEW_NOTHROW */
-
void
A::operator delete (void *obj)
{
diff --git a/ACE/tests/New_Fail_Test.cpp b/ACE/tests/New_Fail_Test.cpp
index 10957e455fe..a63539c77d1 100644
--- a/ACE/tests/New_Fail_Test.cpp
+++ b/ACE/tests/New_Fail_Test.cpp
@@ -176,10 +176,7 @@ run_main (int, ACE_TCHAR *[])
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Caught exception during test; ")
- ACE_TEXT ("ACE_bad_alloc not defined correctly, or\n")));
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("ACE_NEW_THROWS_EXCEPTIONS is not #defined ")
- ACE_TEXT ("(and should be).\n")));
+ ACE_TEXT ("ACE_bad_alloc not defined correctly\n")));
// Mark test failure
status = 1;
}