summaryrefslogtreecommitdiff
path: root/trunk/ACE/etc/enforce_ace_try.diff
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/ACE/etc/enforce_ace_try.diff')
-rw-r--r--trunk/ACE/etc/enforce_ace_try.diff271
1 files changed, 271 insertions, 0 deletions
diff --git a/trunk/ACE/etc/enforce_ace_try.diff b/trunk/ACE/etc/enforce_ace_try.diff
new file mode 100644
index 00000000000..c17a1f855fa
--- /dev/null
+++ b/trunk/ACE/etc/enforce_ace_try.diff
@@ -0,0 +1,271 @@
+Index: ace/CORBA_macros.h
+===================================================================
+RCS file: /project/ace/cvs-repository/ACE_wrappers-repository/ace/CORBA_macros.h,v
+retrieving revision 1.19
+diff -u -r1.19 CORBA_macros.h
+--- CORBA_macros.h 1999/06/28 00:53:07 1.19
++++ CORBA_macros.h 1999/07/31 22:52:52
+@@ -174,15 +174,15 @@
+ // or ACE_CHECK_ENV. These two macros should _NOT_ be used within
+ // try blocks. Use ACE_TRY_CHECK or ACE_TRY_CHECK_EX instead.
+ # define ACE_CHECK \
+- if (ACE_TRY_ENV . exception () != 0) \
++ if (ACE_TRY_ENV . _exception () != 0) \
+ return
+ // When function requires a return value
+ # define ACE_CHECK_RETURN(RETV) \
+- if (ACE_TRY_ENV . exception () != 0) \
++ if (ACE_TRY_ENV . _exception () != 0) \
+ return RETV
+
+ // ACE_THROW_INT should not be used by the user.
+-# define ACE_THROW_INT(EXCEPTION) ACE_TRY_ENV.exception (new EXCEPTION)
++# define ACE_THROW_INT(EXCEPTION) ACE_TRY_ENV._exception (new EXCEPTION)
+
+ // Throwing exceptions will inevitably cause an return from the current
+ // function. These two macros should _NOT_ be used within try blocks.
+@@ -190,14 +190,14 @@
+ # define ACE_THROW(EXCEPTION) \
+ do \
+ { \
+- ACE_TRY_ENV.exception (new EXCEPTION); \
++ ACE_TRY_ENV._exception (new EXCEPTION); \
+ return; \
+ } while (0)
+
+ # define ACE_THROW_RETURN(EXCEPTION,RETV) \
+ do \
+ { \
+- ACE_TRY_ENV.exception (new EXCEPTION); \
++ ACE_TRY_ENV._exception (new EXCEPTION); \
+ return RETV; \
+ } while (0)
+
+@@ -245,7 +245,7 @@
+ // Check for exceptions within try blocks.
+ # define ACE_TRY_CHECK \
+ { \
+- if (ACE_TRY_ENV.exception () != 0) \
++ if (ACE_TRY_ENV._exception () != 0) \
+ { \
+ ACE_TRY_FLAG = 0; \
+ goto ACE_TRY_LABEL; \
+@@ -255,7 +255,7 @@
+ // Checking exception within EX try blocks.
+ # define ACE_TRY_CHECK_EX(LABEL) \
+ { \
+- if (ACE_TRY_ENV.exception () != 0) \
++ if (ACE_TRY_ENV._exception () != 0) \
+ { \
+ ACE_TRY_FLAG = 0; \
+ goto ACE_TRY_LABEL ## LABEL; \
+@@ -265,14 +265,14 @@
+ // Throwing exception within TRY blocks.
+ # define ACE_TRY_THROW(EXCEPTION) \
+ { \
+- ACE_TRY_ENV.exception (new EXCEPTION); \
++ ACE_TRY_ENV._exception (new EXCEPTION); \
+ ACE_TRY_FLAG = 0; \
+ goto ACE_TRY_LABEL; \
+ }
+
+ # define ACE_TRY_THROW_EX(EXCEPTION,LABEL) \
+ { \
+- ACE_TRY_ENV.exception (new EXCEPTION); \
++ ACE_TRY_ENV._exception (new EXCEPTION); \
+ ACE_TRY_FLAG = 0; \
+ goto ACE_TRY_LABEL ## LABEL; \
+ }
+@@ -291,14 +291,14 @@
+ # define ACE_CATCH(TYPE,VAR) \
+ } while (0); \
+ do \
+- if (ACE_TRY_ENV.exception () != 0 && ACE_EXCEPTION_NOT_CAUGHT && \
+- TYPE::_narrow(ACE_TRY_ENV.exception ()) != 0) \
++ if (ACE_TRY_ENV._exception () != 0 && ACE_EXCEPTION_NOT_CAUGHT && \
++ TYPE::_narrow(ACE_TRY_ENV._exception ()) != 0) \
+ { \
+ CORBA::Environment ACE_CAUGHT_ENV = ACE_TRY_ENV;\
+ ACE_EXCEPTION_NOT_CAUGHT = 0; \
+- TYPE &VAR = *TYPE::_narrow (ACE_CAUGHT_ENV.exception ()); \
++ TYPE &VAR = *TYPE::_narrow (ACE_CAUGHT_ENV._exception ()); \
+ ACE_UNUSED_ARG (VAR); \
+- ACE_TRY_ENV.clear ();
++ ACE_TRY_ENV._clear ();
+
+ // ACE_CATCHANY uses ACE_CATCH to catch all CORBA exceptions.
+ # define ACE_CATCHANY ACE_CATCH (CORBA::Exception, ACE_ANY_EXCEPTION)
+Index: TAO/tao/Environment.cpp
+===================================================================
+RCS file: /project/ace/cvs-repository/ACE_wrappers-repository/TAO/tao/Environment.cpp,v
+retrieving revision 1.29
+diff -u -r1.29 Environment.cpp
+--- Environment.cpp 1999/06/24 01:49:38 1.29
++++ Environment.cpp 1999/07/31 22:52:52
+@@ -88,15 +88,15 @@
+ {
+ if (this != &rhs)
+ {
+- this->clear ();
+- this->exception (rhs.exception_);
++ this->_clear ();
++ this->_exception (rhs.exception_);
+ }
+ return *this;
+ }
+
+ CORBA_Environment::~CORBA_Environment (void)
+ {
+- this->clear ();
++ this->_clear ();
+
+ // If previous is 0 then this is the first Environment, allocated
+ // with the ORB, it shouldn't try to pop because the ORB is beign
+@@ -106,11 +106,11 @@
+ }
+
+ void
+-CORBA_Environment::exception (CORBA_Exception *ex)
++CORBA_Environment::_exception (CORBA_Exception *ex)
+ {
+ if (ex != this->exception_)
+ {
+- this->clear ();
++ this->_clear ();
+ this->exception_ = ex;
+ }
+ if (this->exception_ != 0)
+@@ -123,7 +123,7 @@
+ }
+
+ void
+-CORBA_Environment::clear (void)
++CORBA_Environment::_clear (void)
+ {
+ if (this->exception_)
+ this->exception_->_decr_refcnt ();
+@@ -149,7 +149,7 @@
+ // the Environment argument) because then the user is supposed to
+ // clear the environment before calling into the ORB.
+ //
+- TAO_ORB_Core_instance ()->default_environment ()->clear ();
++ TAO_ORB_Core_instance ()->default_environment ()->_clear ();
+ #endif /* TAO_HAS_EXCEPTIONS */
+
+ return CORBA::default_environment ();
+@@ -210,8 +210,8 @@
+ // standard I/O stream passed as a parameter.
+
+ void
+-CORBA::Environment::print_exception (const char *info,
+- FILE *) const
++CORBA::Environment::_print_exception (const char *info,
++ FILE *) const
+ {
+ if (this->exception_)
+ {
+Index: TAO/tao/Environment.h
+===================================================================
+RCS file: /project/ace/cvs-repository/ACE_wrappers-repository/TAO/tao/Environment.h,v
+retrieving revision 1.17
+diff -u -r1.17 Environment.h
+--- Environment.h 1999/06/25 19:51:05 1.17
++++ Environment.h 1999/07/31 22:52:52
+@@ -76,11 +76,11 @@
+ static CORBA_Environment * _nil (void);
+ // Some static methods that need to be defined in every pseudo object
+
+- CORBA_Exception* exception (void) const;
++ CORBA_Exception* _exception (void) const;
+ // Return the exception. Caller must call <_incr_refcnf> in order
+ // to keep the ptr.
+
+- void exception (CORBA_Exception *ex);
++ void _exception (CORBA_Exception *ex);
+ // Set the exception to <ex>, taking a reference on it.
+
+ int exception_type (void) const;
+@@ -90,10 +90,10 @@
+ const char *exception_id (void) const;
+ // return the repository ID for the exception.
+
+- void clear (void);
++ void _clear (void);
+ // Clear the exception.
+
+- void print_exception (const char *info,
++ void _print_exception (const char *info,
+ FILE *f=stdout) const;
+ // Print the exception to output determined by f. This function is
+ // not CORBA compliant.
+Index: TAO/tao/Environment.i
+===================================================================
+RCS file: /project/ace/cvs-repository/ACE_wrappers-repository/TAO/tao/Environment.i,v
+retrieving revision 1.7
+diff -u -r1.7 Environment.i
+--- Environment.i 1999/06/25 19:50:57 1.7
++++ Environment.i 1999/07/31 22:52:52
+@@ -15,7 +15,7 @@
+ }
+
+ ACE_INLINE CORBA_Exception*
+-CORBA_Environment::exception (void) const
++CORBA_Environment::_exception (void) const
+ {
+ return this->exception_;
+ }
+Index: TAO/tao/Invocation.cpp
+===================================================================
+RCS file: /project/ace/cvs-repository/ACE_wrappers-repository/TAO/tao/Invocation.cpp,v
+retrieving revision 1.102
+diff -u -r1.102 Invocation.cpp
+--- Invocation.cpp 1999/07/22 20:06:46 1.102
++++ Invocation.cpp 1999/07/31 22:52:52
+@@ -47,6 +47,12 @@
+
+ #endif /* ACE_ENABLE_TIMEPROBES */
+
++#if defined (ACE_CORBA_HAS_EXCEPTIONS)
++#define ACE_THROW_EX(EXCEPTION) EXCEPTION->_raise ();
++#else
++#define ACE_THROW_EX(EXCEPTION) ACE_TRY_ENV._exception (EXCEPTION)
++#endif /* ACE_CORBA_HAS_EXCEPTIONS */
++
+ // Normal invocations don't involve any heap al; messages are
+ // constructed into stack-based buffers and are read into those
+ // buffers too. Larger buffers are heap-allocated as needed.
+@@ -472,9 +478,7 @@
+ CORBA::COMPLETED_YES));
+ ACE_CHECK_RETURN (TAO_INVOKE_EXCEPTION);
+
+- // @@ Think about a better way to raise the exception here,
+- // maybe we need some more macros?
+- ACE_TRY_ENV.exception (exception); // We can not use ACE_THROW here.
++ ACE_THROW_EX (exception);
+ return TAO_INVOKE_EXCEPTION;
+ }
+
+@@ -560,9 +564,7 @@
+ "TAO: (%P|%t) Raising exception %s\n",
+ buf.in ()));
+
+- // @@ Think about a better way to raise the exception here,
+- // maybe we need some more macros?
+- ACE_TRY_ENV.exception (exception); // We can not use ACE_THROW here.
++ ACE_THROW_EX (exception);
+ return TAO_INVOKE_EXCEPTION;
+ }
+
+@@ -746,11 +748,7 @@
+ ex->minor (minor);
+ ex->completed (CORBA::CompletionStatus (completion));
+
+-
+- // @@ There should be a better way to raise this exception!
+- // This code works for both native and emulated exceptions,
+- // but it is ugly.
+- ACE_TRY_ENV.exception (ex); // We can not use ACE_THROW here.
++ ACE_THROW_EX (ex);
+ return TAO_INVOKE_OK;
+ }
+ // NOTREACHED.