diff options
author | Steve Huston <shuston@riverace.com> | 2002-08-23 22:39:04 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2002-08-23 22:39:04 +0000 |
commit | cfc877e7bece5599a3c03aa80b3aa9b9542623bf (patch) | |
tree | cb2ffab8a6a62f3d6c6428057265b0dd025c4e7a | |
parent | bac2d01866ab5f11c250985b7bd8b04c4dad51c2 (diff) | |
download | ATCD-cfc877e7bece5599a3c03aa80b3aa9b9542623bf.tar.gz |
ChangeLogTag:Fri Aug 23 18:20:31 2002 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ChangeLog | 30 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 30 | ||||
-rw-r--r-- | ace/Arg_Shifter.cpp | 1 | ||||
-rw-r--r-- | ace/Basic_Types.h | 39 | ||||
-rw-r--r-- | ace/Cache_Map_Manager_T.h | 1 | ||||
-rw-r--r-- | ace/Caching_Utility_T.cpp | 8 | ||||
-rw-r--r-- | ace/Log_Msg.h | 3 | ||||
-rw-r--r-- | ace/OS_Memory.h | 125 | ||||
-rw-r--r-- | ace/config-all.h | 125 | ||||
-rw-r--r-- | netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp | 1 | ||||
-rw-r--r-- | tests/Cached_Allocator_Test.cpp | 2 |
11 files changed, 195 insertions, 170 deletions
diff --git a/ChangeLog b/ChangeLog index 42316f11e39..3e19f3baafd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +Fri Aug 23 18:20:31 2002 Steve Huston <shuston@riverace.com> + + * ace/config-all.h: + * ace/OS_Memory.h: Moved the ACE_NEW macros from config-all.h to + OS_Memory.h + + * ace/Log_Msg.h: Removed #include "ace/Basic_Types.h" (not needed) + and replaced "ace/OS_Errno.h" with "ace/OS.h" since thread defs + are necessary. + + * ace/Basic_Types.h: Don't make thread definitions here - they belong + in ace/OS.h. + + * ace/Cache_Map_Manager_T.h: Added #include "ace/Default_Constants.h" + to get ACE_DEFAULT_MAP_SIZE when instantiating templates on AIX + with Visual Age C++. + + * ace/Caching_Utility_T.cpp: #include "ace/Min_Max.h" and + "ace/OS_Memory.h" so Visual Age C++ can see ACE_MAX and ACE_NEW + when instantiating templates. + + * ace/Arg_Shifter.cpp: Added #include "ace/OS_Memory.h" to get ACE_NEW. + + * netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp: Added + #include "ace/Malloc_Base.h" to pick up ACE_Allocator. + + * tests/Cached_Allocator_Test.cpp: Changed default speed tests loops + from 100,000,000 to 10,000,000. run_test.pl times it out on + non-nuclear processors ;-) + Fri Aug 23 16:59:51 2002 Nanbor Wang <nanbor@cs.wustl.edu> * bin/svcconf-convert.pl: Fixed regex to handle empty option diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 42316f11e39..3e19f3baafd 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,33 @@ +Fri Aug 23 18:20:31 2002 Steve Huston <shuston@riverace.com> + + * ace/config-all.h: + * ace/OS_Memory.h: Moved the ACE_NEW macros from config-all.h to + OS_Memory.h + + * ace/Log_Msg.h: Removed #include "ace/Basic_Types.h" (not needed) + and replaced "ace/OS_Errno.h" with "ace/OS.h" since thread defs + are necessary. + + * ace/Basic_Types.h: Don't make thread definitions here - they belong + in ace/OS.h. + + * ace/Cache_Map_Manager_T.h: Added #include "ace/Default_Constants.h" + to get ACE_DEFAULT_MAP_SIZE when instantiating templates on AIX + with Visual Age C++. + + * ace/Caching_Utility_T.cpp: #include "ace/Min_Max.h" and + "ace/OS_Memory.h" so Visual Age C++ can see ACE_MAX and ACE_NEW + when instantiating templates. + + * ace/Arg_Shifter.cpp: Added #include "ace/OS_Memory.h" to get ACE_NEW. + + * netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp: Added + #include "ace/Malloc_Base.h" to pick up ACE_Allocator. + + * tests/Cached_Allocator_Test.cpp: Changed default speed tests loops + from 100,000,000 to 10,000,000. run_test.pl times it out on + non-nuclear processors ;-) + Fri Aug 23 16:59:51 2002 Nanbor Wang <nanbor@cs.wustl.edu> * bin/svcconf-convert.pl: Fixed regex to handle empty option diff --git a/ace/Arg_Shifter.cpp b/ace/Arg_Shifter.cpp index eb75b6723d9..d174b4b0ef7 100644 --- a/ace/Arg_Shifter.cpp +++ b/ace/Arg_Shifter.cpp @@ -1,6 +1,7 @@ #include "ace/Arg_Shifter.h" #include "ace/OS_String.h" #include "ace/OS_Errno.h" +#include "ace/OS_Memory.h" ACE_RCSID (ace, Arg_Shifter, diff --git a/ace/Basic_Types.h b/ace/Basic_Types.h index 60b644f23a8..d4beae0df99 100644 --- a/ace/Basic_Types.h +++ b/ace/Basic_Types.h @@ -628,45 +628,6 @@ typedef unsigned char ACE_Byte; # endif # endif /* ! BYTE_ORDER && ! __BYTE_ORDER */ - -// These were moved from OS.h. -#if defined (ACE_HAS_THREADS) -# if defined (ACE_HAS_PTHREADS) -# if defined (ACE_HAS_TSS_EMULATION) - typedef u_long ACE_thread_key_t; -# else /* ! ACE_HAS_TSS_EMULATION */ -# include /**/ <pthread.h> - typedef pthread_key_t ACE_thread_key_t; -# endif /* ! ACE_HAS_TSS_EMULATION */ -# elif defined (ACE_HAS_STHREADS) - // Solaris threads, without PTHREADS. - // Typedefs to help compatibility with Windows NT and Pthreads. - typedef thread_t ACE_thread_t; - typedef thread_key_t ACE_thread_key_t; -// typedef mutex_t ACE_mutex_t; -# elif defined (ACE_PSOS) -# if defined (ACE_PSOS_HAS_TSS) - typedef u_long ACE_thread_key_t; -# else - typedef u_int ACE_thread_key_t; -# endif /* ACE_PSOS_HAS_TSS */ -# elif defined (VXWORKS) - typedef u_int ACE_thread_key_t; -# elif defined (ACE_WIN32) -# if !defined(__MINGW32__) - typedef long pid_t; -# endif /* __MINGW32__ */ -# if defined (ACE_HAS_TSS_EMULATION) -// typedef DWORD ACE_OS_thread_key_t; - typedef u_int ACE_thread_key_t; -# else /* ! ACE_HAS_TSS_EMULATION */ - typedef DWORD ACE_thread_key_t; -# endif /* ! ACE_HAS_TSS_EMULATION */ -# endif -#else - typedef u_int ACE_thread_key_t; -#endif - #if !defined (ACE_HAS_SSIZE_T) # if defined (ACE_WIN64) typedef SSIZE_T ssize_t; diff --git a/ace/Cache_Map_Manager_T.h b/ace/Cache_Map_Manager_T.h index 56de5e5d32f..7b5a3052463 100644 --- a/ace/Cache_Map_Manager_T.h +++ b/ace/Cache_Map_Manager_T.h @@ -21,6 +21,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Default_Constants.h" #include "ace/Global_Macros.h" #include "ace/Pair_T.h" diff --git a/ace/Caching_Utility_T.cpp b/ace/Caching_Utility_T.cpp index 75ce2aeda72..351255c1dfa 100644 --- a/ace/Caching_Utility_T.cpp +++ b/ace/Caching_Utility_T.cpp @@ -9,6 +9,8 @@ #define ACE_LACKS_PRAGMA_ONCE #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Min_Max.h" +#include "ace/OS_Memory.h" // #include "ace/Strategies.h" #include "ace/Recyclable.h" @@ -57,9 +59,9 @@ ACE_Pair_Caching_Utility<KEY, VALUE, CONTAINER, ITERATOR, ATTRIBUTES>::clear_cac // upon the <purge_percent>. size_t entries_to_remove = ACE_MAX (ACE_static_cast (size_t, 1), - ACE_static_cast(size_t, - ACE_static_cast(double, purge_percent) - / 100 * current_map_size)); + ACE_static_cast (size_t, + ACE_static_cast(double, purge_percent) + / 100 * current_map_size)); KEY *key_to_remove = 0; VALUE *value_to_remove = 0; diff --git a/ace/Log_Msg.h b/ace/Log_Msg.h index a3926869fb1..0a82fd8301a 100644 --- a/ace/Log_Msg.h +++ b/ace/Log_Msg.h @@ -22,8 +22,7 @@ #include "ace/Global_Macros.h" #include "ace/Default_Constants.h" #include "ace/Log_Priority.h" -#include "ace/Basic_Types.h" -#include "ace/OS_Errno.h" +#include "ace/OS.h" // The following ASSERT macro is courtesy of Alexandre Karev // <akg@na47sun05.cern.ch>. diff --git a/ace/OS_Memory.h b/ace/OS_Memory.h index 54e94d9031c..7b1dac8e22a 100644 --- a/ace/OS_Memory.h +++ b/ace/OS_Memory.h @@ -67,6 +67,131 @@ typedef char *ACE_MALLOC_T; typedef void *ACE_MALLOC_T; #endif /* ACE_HAS_OLD_MALLOC */ +// ============================================================================ +// 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 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)) || \ + (__HP_aCC >= 32500 && defined (_HP_NAMESPACE_STD))) \ + || 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)) || \ + (__HP_aCC >= 12500 && defined (_HP_NAMESPACE_STD))) +# 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 +# define ACE_throw_bad_alloc throw ACE_bad_alloc () +# endif /* __SUNPRO_CC < 0x500 */ +# elif defined (__BORLANDC__) || defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) +# include /**/ <new> +# define ACE_bad_alloc std::bad_alloc +# define ACE_throw_bad_alloc throw ACE_bad_alloc () +# else +# include /**/ <new> +# define ACE_bad_alloc bad_alloc +# define ACE_throw_bad_alloc throw ACE_bad_alloc () +# 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) { errno = ENOMEM; POINTER = 0; return RET_VAL; } \ + } while (0) + +# define ACE_NEW(POINTER,CONSTRUCTOR) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; POINTER = 0; return; } \ + } while (0) + +# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_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; } \ + } while (0) +# define ACE_NEW(POINTER,CONSTRUCTOR) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; return; } \ + } while (0) +# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; } \ + } while (0) + +# define ACE_throw_bad_alloc \ + void* gcc_will_complain_if_literal_0_is_returned = 0; \ + return gcc_will_complain_if_literal_0_is_returned + +#endif /* ACE_NEW_THROWS_EXCEPTIONS */ + /** * @class ACE_OS_Memory * diff --git a/ace/config-all.h b/ace/config-all.h index eebffb9a9e7..830bc638d02 100644 --- a/ace/config-all.h +++ b/ace/config-all.h @@ -336,131 +336,6 @@ #endif /* __sgi || ghs || ..... */ // ============================================================================ -// 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 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)) || \ - (__HP_aCC >= 32500 && defined (_HP_NAMESPACE_STD))) \ - || 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)) || \ - (__HP_aCC >= 12500 && defined (_HP_NAMESPACE_STD))) -# 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 -# define ACE_throw_bad_alloc throw ACE_bad_alloc () -# endif /* __SUNPRO_CC < 0x500 */ -# elif defined (__BORLANDC__) || defined (ACE_USES_STD_NAMESPACE_FOR_STDCPP_LIB) -# include /**/ <new> -# define ACE_bad_alloc std::bad_alloc -# define ACE_throw_bad_alloc throw ACE_bad_alloc () -# else -# include /**/ <new> -# define ACE_bad_alloc bad_alloc -# define ACE_throw_bad_alloc throw ACE_bad_alloc () -# 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) { errno = ENOMEM; POINTER = 0; return RET_VAL; } \ - } while (0) - -# define ACE_NEW(POINTER,CONSTRUCTOR) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; POINTER = 0; return; } \ - } while (0) - -# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_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; } \ - } while (0) -# define ACE_NEW(POINTER,CONSTRUCTOR) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; return; } \ - } while (0) -# define ACE_NEW_NORETURN(POINTER,CONSTRUCTOR) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; } \ - } while (0) - -# define ACE_throw_bad_alloc \ - void* gcc_will_complain_if_literal_0_is_returned = 0; \ - return gcc_will_complain_if_literal_0_is_returned - -#endif /* ACE_NEW_THROWS_EXCEPTIONS */ - -// ============================================================================ // ACE_ALLOC_HOOK* macros // // Macros to declare and define class-specific allocation operators. diff --git a/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp b/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp index fec5e9967f0..ef7b26ba5d7 100644 --- a/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp +++ b/netsvcs/clients/Naming/Dump_Restore/Dump_Restore.cpp @@ -1,5 +1,6 @@ // $Id$ +#include "ace/Malloc_Base.h" #include "ace/Service_Config.h" #include "ace/Read_Buffer.h" #include "ace/Thread_Manager.h" diff --git a/tests/Cached_Allocator_Test.cpp b/tests/Cached_Allocator_Test.cpp index 8f6deeacd7c..a16ad9d6b5c 100644 --- a/tests/Cached_Allocator_Test.cpp +++ b/tests/Cached_Allocator_Test.cpp @@ -155,7 +155,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) const char *str3 = "ABCDEFGH"; if (argc < 2) - loops = 100000000; + loops = 10000000; else loops = ACE_OS::atoi (argv[1]); |