summaryrefslogtreecommitdiff
path: root/etc/enforce_ace_try.diff
blob: c17a1f855faf9628e4115fcc338de26b7e57f7fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
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.