diff options
-rw-r--r-- | ace/CORBA_macros.h | 74 | ||||
-rw-r--r-- | ace/OS.h | 42 |
2 files changed, 75 insertions, 41 deletions
diff --git a/ace/CORBA_macros.h b/ace/CORBA_macros.h index e595aea4c53..fd15d52f56c 100644 --- a/ace/CORBA_macros.h +++ b/ace/CORBA_macros.h @@ -30,6 +30,8 @@ # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/OS.h" + // All these macros assume the CORBA::Environment variable used to pass // in/out the exception is call ACE_TRY_ENV. Below is the name we use // in TAO (The ACE ORB.) Most other ORB's have their own naming @@ -309,6 +311,78 @@ #endif /* ! ACE_CORBA_HAS_EXCEPTIONS */ +// ACE_HAS_EXCEPTIONS is not the same as ACE_NEW_THROWS_EXCEPTIONS. +#if defined(ACE_NEW_THROWS_EXCEPTIONS) + +# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; ACE_THROW_INT (EXCEPTION); } \ + } while (0) +// The following ACE_NEW_THROW* macros are to be depricated soon. +// -------------------- Start Depricated -------------------- +# define ACE_NEW_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; TAO_THROW (EXCEPTION); } \ + } while (0) +# define ACE_NEW_THROW_RETURN(POINTER,CONSTRUCTOR,EXCEPTION,RET_VAL) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; TAO_THROW_RETURN (EXCEPTION,RET_VAL); } \ + } while (0) +# define ACE_NEW_TRY_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { try { POINTER = new CONSTRUCTOR; } \ + catch (ACE_bad_alloc) { errno = ENOMEM; TAO_TRY_THROW (EXCEPTION); } \ + } while (0) +// -------------------- End Depricated -------------------- + +#else + +# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; ACE_THROW_INT (EXCEPTION); } \ + } while (0) +// The following ACE_NEW_THROW* macros are to be depricated soon. +// -------------------- Start Depricated -------------------- +# define ACE_NEW_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; TAO_THROW (EXCEPTION); } \ + } while (0) +# define ACE_NEW_THROW_RETURN(POINTER,CONSTRUCTOR,EXCEPTION,RET_VAL) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0)\ + { errno = ENOMEM; TAO_THROW_RETURN (EXCEPTION,RET_VAL); } \ + } while (0) +# define ACE_NEW_TRY_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ + do { POINTER = new CONSTRUCTOR; \ + if (POINTER == 0) { errno = ENOMEM; TAO_TRY_THROW (EXCEPTION); } \ + } while (0) +// -------------------- End Depricated -------------------- + +#endif /* ACE_NEW_THROWS_EXCEPTIONS */ + +# define ACE_GUARD_THROW_EX(MUTEX,OBJ,LOCK,EXCEPTION) \ + ACE_Guard<MUTEX> OBJ (LOCK); \ + if (OBJ.locked () == 0) ACE_THROW_INT (EXCEPTION); + +# define ACE_READ_GUARD_THROW_EX(MUTEX,OBJ,LOCK) \ + ACE_Read_Guard<MUTEX> OBJ (LOCK); \ + if (OBJ.locked () == 0) return; + +# define ACE_WRITE_GUARD_THROW_EX(MUTEX,OBJ,LOCK) \ + ACE_Write_Guard<MUTEX> OBJ (LOCK); \ + if (OBJ.locked () == 0) return; + +// The following ACE_GUARD_THROW* macros are to be depricated soon. +// -------------------- Start Depricated -------------------- +# define ACE_GUARD_THROW(MUTEX,OBJ,LOCK,EXCEPTION) \ + ACE_Guard<MUTEX> OBJ (LOCK); \ + if (OBJ.locked () == 0) TAO_THROW (EXCEPTION); +# define ACE_GUARD_THROW_RETURN(MUTEX,OBJ,LOCK,EXCEPTION,RETURN) \ + ACE_Guard<MUTEX> OBJ (LOCK); \ + if (OBJ.locked () == 0) TAO_THROW_RETURN (EXCEPTION, RETURN); +// -------------------- End Deprication -------------------- + +// ============================================================ + // Print out a TAO exception. This is not CORBA compliant. # define ACE_PRINT_TAO_EXCEPTION(EX,INFO) \ EX.print_exception (INFO) @@ -1712,12 +1712,6 @@ typedef const struct rlimit ACE_SETRLIMIT_TYPE; # define ACE_GUARD_RETURN(MUTEX,OBJ,LOCK,RETURN) \ ACE_Guard<MUTEX> OBJ (LOCK); \ if (OBJ.locked () == 0) return RETURN; -# define ACE_GUARD_THROW(MUTEX,OBJ,LOCK,EXCEPTION) \ - ACE_Guard<MUTEX> OBJ (LOCK); \ - if (OBJ.locked () == 0) TAO_THROW (EXCEPTION); -# define ACE_GUARD_THROW_RETURN(MUTEX,OBJ,LOCK,EXCEPTION,RETURN) \ - ACE_Guard<MUTEX> OBJ (LOCK); \ - if (OBJ.locked () == 0) TAO_THROW_RETURN (EXCEPTION, RETURN); # define ACE_WRITE_GUARD(MUTEX,OBJ,LOCK) \ ACE_Write_Guard<MUTEX> OBJ (LOCK); \ if (OBJ.locked () == 0) return; @@ -6423,23 +6417,6 @@ private: do { try { POINTER = new CONSTRUCTOR; } \ catch (ACE_bad_alloc) { errno = ENOMEM; return; } \ } while (0) -# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; ACE_THROW_INT (EXCEPTION); } \ - } while (0) -// The following ACE_NEW_THROW* macros are to be depricated soon. -# define ACE_NEW_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; TAO_THROW (EXCEPTION); } \ - } while (0) -# define ACE_NEW_THROW_RETURN(POINTER,CONSTRUCTOR,EXCEPTION,RET_VAL) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; TAO_THROW_RETURN (EXCEPTION,RET_VAL); } \ - } while (0) -# define ACE_NEW_TRY_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { try { POINTER = new CONSTRUCTOR; } \ - catch (ACE_bad_alloc) { errno = ENOMEM; TAO_TRY_THROW (EXCEPTION); } \ - } while (0) # else /* ACE_NEW_THROWS_EXCEPTIONS */ @@ -6451,24 +6428,7 @@ private: do { POINTER = new CONSTRUCTOR; \ if (POINTER == 0) { errno = ENOMEM; return; } \ } while (0) -# define ACE_NEW_THROW_EX(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; ACE_THROW_INT (EXCEPTION); } \ - } while (0) -// The following ACE_NEW_THROW* macros are to be depricated soon. -# define ACE_NEW_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; TAO_THROW (EXCEPTION); } \ - } while (0) -# define ACE_NEW_THROW_RETURN(POINTER,CONSTRUCTOR,EXCEPTION,RET_VAL) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0)\ - { errno = ENOMEM; TAO_THROW_RETURN (EXCEPTION,RET_VAL); } \ - } while (0) -# define ACE_NEW_TRY_THROW(POINTER,CONSTRUCTOR,EXCEPTION) \ - do { POINTER = new CONSTRUCTOR; \ - if (POINTER == 0) { errno = ENOMEM; TAO_TRY_THROW (EXCEPTION); } \ - } while (0) + # endif /* ACE_NEW_THROWS_EXCEPTIONS */ // Some useful abstrations for expressions involving |