diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_operation')
16 files changed, 321 insertions, 72 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp index 41fff5467c0..3983afa8dbd 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_rh_ss.cpp @@ -158,28 +158,44 @@ be_visitor_amh_rh_operation_ss::visit_operation (be_operation *node) operation_name[idx] = '\0'; *os << be_nl << "{" << be_idt_nl - << "try" << be_nl + << (be_global->use_raw_throw () ? "try" : "ACE_TRY") << be_nl << "{" << be_idt_nl << "holder->raise_" << operation_name.c_str () - << " ();" << be_uidt_nl + << " (" + << (be_global->use_raw_throw () + ? "" + : "ACE_ENV_SINGLE_ARG_PARAMETER") + << ");" << ace_try_check << be_uidt_nl << "}" << be_nl - << "catch ( ::CORBA::Exception& ex)" + << (be_global->use_raw_throw () + ? "catch ( ::CORBA::Exception& ex)" + : "ACE_CATCH ( ::CORBA::Exception, ex)") << be_nl << "{" << be_idt_nl - << "this->_tao_rh_send_exception (ex);" << be_uidt_nl - << "}" << be_uidt_nl + << "this->_tao_rh_send_exception (ex" + << (be_global->use_raw_throw () ? "" : " ACE_ENV_ARG_PARAMETER") + << ");" << TAO_ACE_CHECK () << be_uidt_nl + << "}" << ace_endtry << be_uidt_nl << "}"; } else { // Step 3: Generate actual code for the method *os << be_nl << "{" << be_idt_nl - << "this->_tao_rh_init_reply ();" << be_nl << be_nl; + << "this->_tao_rh_init_reply (" + << (be_global->use_raw_throw () + ? "" + : "ACE_ENV_SINGLE_ARG_PARAMETER") + << ");" << TAO_ACE_CHECK () << be_nl << be_nl; this->marshal_params (node); *os << be_nl - << "this->_tao_rh_send_reply ();" << be_uidt_nl + << "this->_tao_rh_send_reply (" + << (be_global->use_raw_throw () + ? "" + : "ACE_ENV_SINGLE_ARG_PARAMETER") + << ");" << be_uidt_nl << "}"; } @@ -220,7 +236,8 @@ be_visitor_amh_rh_operation_ss::marshal_params (be_operation *node) << "{" << be_idt_nl; // If marshaling fails, raise exception. - if (this->gen_raise_exception ("::CORBA::MARSHAL", + if (this->gen_raise_exception (0, + "::CORBA::MARSHAL", "") == -1) { ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp index 4d9fcfe18eb..333063bd543 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_sh.cpp @@ -83,7 +83,7 @@ be_visitor_amh_operation_sh::visit_operation (be_operation *node) } } - *os << be_uidt_nl + *os << env_decl << be_uidt_nl << ")" << be_uidt_nl; if (be_global->use_raw_throw ()) @@ -117,6 +117,11 @@ be_visitor_amh_operation_sh::visit_attribute (be_attribute *node) TAO_OutStream *os = this->ctx_->stream (); this->generate_shared_prologue (node, os, "_get_"); + if (!be_global->exception_support ()) + { + *os << env_decl; + } + *os << be_uidt_nl << ")" << be_uidt_nl << "ACE_THROW_SPEC (( ::CORBA::SystemException)) = 0;" << be_nl; @@ -137,14 +142,19 @@ be_visitor_amh_operation_sh::visit_attribute (be_attribute *node) be_visitor_args_arglist visitor (&ctx); int status = visitor.visit_argument (&the_argument); - + the_argument.destroy (); - + if (-1 == status) { return -1; } + if (!be_global->exception_support ()) + { + *os << env_decl; + } + *os << be_uidt_nl << ")" << be_uidt_nl << "ACE_THROW_SPEC (( ::CORBA::SystemException)) = 0;" << be_nl; @@ -166,7 +176,7 @@ be_visitor_amh_operation_sh::generate_shared_prologue ( << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest &_tao_req," << be_nl << "void *_tao_obj," << be_nl - << "void *_tao_servant_upcall" << be_uidt_nl + << "void *_tao_servant_upcall" << env_decl << be_uidt_nl << ");" << be_uidt_nl << be_nl; // We need the interface node in which this operation was defined. However, diff --git a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp index ba881c6039a..909176025cf 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/amh_ss.cpp @@ -125,7 +125,8 @@ be_visitor_amh_operation_ss::visit_operation (be_operation *node) *os << be_uidt_nl << "))" << be_nl; // If marshaling fails, raise exception. - if (this->gen_raise_exception ("::CORBA::MARSHAL", + if (this->gen_raise_exception (0, + "::CORBA::MARSHAL", "") == -1) { ACE_ERROR_RETURN ((LM_ERROR, @@ -172,6 +173,8 @@ be_visitor_amh_operation_ss::visit_operation (be_operation *node) -1); } } + + *os << env_arg; } if (this->generate_shared_epilogue (os) == -1) @@ -199,6 +202,8 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node) return -1; } + *os << env_arg; + if (this->generate_shared_epilogue (os) == -1) { return -1; @@ -217,7 +222,7 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node) be_argument the_argument (AST_Argument::dir_IN, node->field_type (), node->name ()); - + int status = 0; { @@ -225,7 +230,7 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node) be_visitor_args_vardecl_ss vardecl_visitor (&ctx); status = vardecl_visitor.visit_argument (&the_argument); - + if (-1 == status) { the_argument.destroy (); @@ -246,7 +251,7 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node) be_visitor_args_marshal_ss marshal_visitor (&ctx); status = marshal_visitor.visit_argument (&the_argument); - + if (-1 == status) { the_argument.destroy (); @@ -258,7 +263,8 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node) << "{" << be_idt_nl; // If marshaling fails, raise exception. - status = this->gen_raise_exception ("::CORBA::MARSHAL", + status = this->gen_raise_exception (0, + "::CORBA::MARSHAL", ""); if (-1 == status) { @@ -279,15 +285,17 @@ be_visitor_amh_operation_ss::visit_attribute (be_attribute *node) { be_visitor_args_upcall_ss upcall_visitor (this->ctx_); - status = upcall_visitor.visit_argument (&the_argument); + status = upcall_visitor.visit_argument (&the_argument); the_argument.destroy (); - + if (-1 == status) { return -1; } } + *os << env_arg; + if (-1 == this->generate_shared_epilogue (os)) { return -1; @@ -336,11 +344,11 @@ be_visitor_amh_operation_ss::generate_shared_prologue (be_decl *node, << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & _tao_server_request," << be_nl << "void * /* context */," << be_nl - << "void * _tao_servant" << be_uidt_nl + << "void * _tao_servant" << env_decl << be_uidt_nl << ")" << be_uidt_nl; // Generate the actual code for the skeleton. - // last argument + // last argument - is always ACE_ENV_ARG_PARAMETER. *os << "{" << be_idt_nl; // Get the right object implementation. diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp index 5040b2d6585..9cf17b17ab4 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_cs.cpp @@ -128,16 +128,23 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) // Generate the actual code for the stub. However, if any of the argument // types is "native", we flag a MARSHAL exception. - // last argument + // last argument - is always ACE_ENV_ARG_PARAMETER *os << be_nl << "{" << be_idt; + if (be_global->exception_support ()) + { + *os << be_nl + << "ACE_DECLARE_NEW_CORBA_ENV;"; + } + if (node->has_native ()) // native exists => no stub { be_predefined_type bpt (AST_PredefinedType::PT_void, 0); - int const status = this->gen_raise_exception ("::CORBA::MARSHAL", - ""); + int status = this->gen_raise_exception (&bpt, + "::CORBA::MARSHAL", + ""); if (status == -1) { @@ -263,8 +270,9 @@ be_visitor_operation_ami_cs::visit_operation (be_operation *node) *os << "AMI_" << parent->local_name () << "Handler::" << opname.fast_rep () + (this->ctx_->attribute () != 0) - << "_reply_stub" << be_uidt_nl - << ");" << be_uidt; + << "_reply_stub" << env_arg << be_uidt_nl + << ");" << be_uidt + << TAO_ACE_CHECK (); *os << be_uidt_nl << "}"; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp index b3ab6250841..75921685b61 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_ch.cpp @@ -74,7 +74,10 @@ be_visitor_operation_ami_handler_reply_stub_operation_ch::visit_operation ( *os << "TAO_InputCDR &_tao_reply_cdr," << be_nl << "::Messaging::ReplyHandler_ptr _tao_reply_handler," << be_nl - << "::CORBA::ULong reply_status);" << be_uidt; + << "::CORBA::ULong reply_status"; + + *os << env_dflts << be_uidt_nl + << ");" << be_uidt; } return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp index 4061f48b16b..3ed6053a76b 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/ami_handler_reply_stub_operation_cs.cpp @@ -130,7 +130,7 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation ( *os << "TAO_InputCDR &_tao_in, " << be_nl << "::Messaging::ReplyHandler_ptr _tao_reply_handler," << be_nl << "::CORBA::ULong reply_status" - << ")" << be_uidt << be_uidt_nl + << env_decl << ")" << be_uidt << be_uidt_nl << "{" << be_idt_nl; *os << "// Retrieve Reply Handler object." << be_nl; @@ -138,8 +138,10 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation ( << "_tao_reply_handler_object =" << be_idt_nl; *os << parent->full_name (); - *os << "::_narrow (_tao_reply_handler);" << be_uidt - << be_nl << be_nl + *os << "::_narrow (_tao_reply_handler" + << (be_global->use_raw_throw () ? "" : " ACE_ENV_ARG_PARAMETER") + << ");" << be_uidt + << TAO_ACE_CHECK () << be_nl << be_nl << "// Exception handling" << be_nl << "switch (reply_status)" << be_nl << "{" << be_idt_nl @@ -273,8 +275,18 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::visit_operation ( << node->local_name () << "_excep (" << be_idt << be_idt_nl << "exception_holder_var"; + if (!be_global->exception_support ()) + { + *os << " ACE_ENV_ARG_PARAMETER"; + } + *os << be_uidt_nl << ");" << be_uidt_nl; + if (!be_global->exception_support ()) + { + *os << "ACE_CHECK;" << be_nl; + } + *os << "break;" << be_uidt_nl << "}" << be_nl; @@ -443,7 +455,7 @@ be_visitor_operation_ami_handler_reply_stub_operation_cs::gen_marshal_and_invoke } *os << be_uidt_nl << ");" << be_uidt - << be_nl; + << TAO_ACE_CHECK () << be_nl; return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp index ab820a630a9..5988f4c0049 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/arglist.cpp @@ -18,8 +18,8 @@ // // ============================================================================ -ACE_RCSID (be_visitor_operation, - arglist, +ACE_RCSID (be_visitor_operation, + arglist, "$Id$") // ************************************************************ @@ -46,6 +46,8 @@ be_visitor_operation_arglist::visit_operation (be_operation *node) *os << " (" << be_idt << be_idt_nl; + int arg_emitted = 0; + switch (this->ctx_->state ()) { case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH: @@ -57,6 +59,7 @@ be_visitor_operation_arglist::visit_operation (be_operation *node) *os << "," << be_nl; } + arg_emitted = 1; break; default: break; @@ -72,12 +75,17 @@ be_visitor_operation_arglist::visit_operation (be_operation *node) -1); } - if (node->argument_count () == 0) + if (this->gen_environment_decl (arg_emitted, node) == -1) { - *os << "void"; + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation_arglist::" + "visit_operation - " + "gen_environment_decl failed\n"), + -1); } - *os << be_uidt_nl<< ")"; + *os << be_uidt_nl + << ")"; // Now generate the throw specs. if (this->gen_throw_spec (node) == -1) @@ -101,7 +109,6 @@ be_visitor_operation_arglist::visit_operation (be_operation *node) break; case TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH: - case TAO_CodeGen::TAO_TIE_OPERATION_ARGLIST_SH: break; case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: *os << " = 0"; @@ -109,7 +116,7 @@ be_visitor_operation_arglist::visit_operation (be_operation *node) default: return 0; } - + *os << ";"; return 0; @@ -140,7 +147,8 @@ be_visitor_operation_arglist::visit_argument (be_argument *node) // We need the interface node in which this operation was defined. However, // if this operation node was an attribute node in disguise, we get this // information from the context - be_interface *intf = this->ctx_->attribute () + be_interface *intf; + intf = this->ctx_->attribute () ? be_interface::narrow_from_scope (this->ctx_->attribute ()->defined_in ()) : be_interface::narrow_from_scope (op->defined_in ()); diff --git a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp index 413cb6a125e..fcd2fa84244 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/argument.cpp @@ -74,6 +74,8 @@ be_visitor_operation_argument::post_process (be_decl *bd) int be_visitor_operation_argument::visit_operation (be_operation *node) { + TAO_OutStream *os = this->ctx_->stream (); + // All we do is hand over code generation to our scope. if (this->visit_scope (node) == -1) { @@ -84,6 +86,33 @@ be_visitor_operation_argument::visit_operation (be_operation *node) -1); } + // If we are supporting the alternate mapping, we must pass the + // ACE_ENV_ARG_PARAMETER as the last parameter. + if (!be_global->exception_support ()) + { + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_OPERATION_ARG_UPCALL_SS: + case TAO_CodeGen::TAO_OPERATION_COLLOCATED_ARG_UPCALL_SS: + // Applicable only to these cases where the actual upcall is made. + + // Use ACE_ENV_SINGLE_ARG_DECL or ACE_ENV_ARG_DECL depending on + // whether the operation node has parameters. + if (node->argument_count () > 0) + { + *os << env_arg; + } + else + { + *os << env_sngl_arg; + } + + break; + default: + break; + } + } + return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp index 44e2d250135..76b2b20752a 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/direct_proxy_impl_ss.cpp @@ -68,7 +68,7 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( } *os << "," << be_nl - << "int" << be_uidt_nl + << "int" << env_decl << be_uidt_nl << ")"; if (this->gen_throw_spec (node) != 0) @@ -117,6 +117,10 @@ be_visitor_operation_direct_proxy_impl_ss::visit_operation ( *os << be_uidt << be_uidt_nl; + if (!be_global->exception_support ()) + { + *os << "ACE_CHECK;"; + } *os << be_uidt_nl << "}" << be_nl; @@ -141,7 +145,7 @@ be_visitor_operation_direct_proxy_impl_ss::gen_invoke ( if (si.is_done ()) { - *os << be_uidt_nl + *os << env_sngl_arg << be_uidt_nl << ");"; return 0; @@ -181,7 +185,7 @@ be_visitor_operation_direct_proxy_impl_ss::gen_invoke ( } // End the upcall - *os << be_uidt_nl + *os << env_arg << be_uidt_nl << ");"; return 0; diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp index f766694a58a..4a5d6dfb5a3 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation.cpp @@ -148,9 +148,7 @@ be_visitor_operation::gen_throw_spec (be_operation *node) int is_amh_exception_holder = this->is_amh_exception_holder (iface); AST_Decl::NodeType nt = iface->node_type (); - if (nt != AST_Decl::NT_valuetype - && nt != AST_Decl::NT_eventtype - || is_amh_exception_holder) + if (nt != AST_Decl::NT_valuetype || is_amh_exception_holder) { *os << be_nl << throw_spec_open; *os << be_idt_nl << "::CORBA::SystemException"; @@ -188,13 +186,130 @@ be_visitor_operation::gen_throw_spec (be_operation *node) } int -be_visitor_operation::gen_raise_exception (const char *exception_name, +be_visitor_operation::gen_environment_decl (int argument_emitted, + be_operation *node) +{ + // Generate the CORBA::Environment parameter for the alternative mapping. + if (be_global->exception_support ()) + { + return 0; + } + + TAO_OutStream *os = this->ctx_->stream (); + + // Use ACE_ENV_SINGLE_ARG_DECL or ACE_ENV_ARG_DECL depending on + // whether the operation node has parameters. + const char *env_decl = "ACE_ENV_SINGLE_ARG_DECL"; + + if (this->ctx_->sub_state () + == TAO_CodeGen::TAO_AMH_RESPONSE_HANDLER_OPERATION + && node->argument_count () == 0) + { + // Response handler operations don't use the environment arg + // unless there are other args in the operation. + env_decl = "ACE_ENV_SINGLE_ARG_DECL"; + this->ctx_->sub_state (TAO_CodeGen::TAO_SUB_STATE_UNKNOWN); + } + else if (argument_emitted || node->argument_count () > 0) + { + env_decl = "ACE_ENV_ARG_DECL"; + } + + TAO_CodeGen::CG_STATE cgs = this->ctx_->state (); + + if (node->argument_count () > 0 + || cgs == TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XH + || cgs == TAO_CodeGen::TAO_OPERATION_ARGLIST_PROXY_IMPL_XS) + { + *os << be_nl; + } + + switch (this->ctx_->state ()) + { + case TAO_CodeGen::TAO_OPERATION_ARGLIST_CH: + case TAO_CodeGen::TAO_OPERATION_ARGLIST_COLLOCATED_SH: + case TAO_CodeGen::TAO_OPERATION_ARGLIST_SH: + // Last argument is always CORBA::Environment. + *os << env_decl << "_WITH_DEFAULTS"; + break; + default: + *os << env_decl; + break; + } + + return 0; +} + +// Method that returns the appropriate CORBA::Environment variable. +const char * +be_visitor_operation::gen_environment_var (void) +{ + static const char *ace_try_env_decl = "ACE_DECLARE_NEW_CORBA_ENV;"; + static const char *null_env_decl = ""; + + // Check if we are generating stubs/skeletons for + // true C++ exception support. + if (be_global->exception_support ()) + { + return ace_try_env_decl; + } + else + { + return null_env_decl; + } +} + +int +be_visitor_operation::gen_raise_exception (be_type *return_type, + const char *exception_name, const char *exception_arguments) { TAO_OutStream *os = this->ctx_->stream (); - *os << "throw " - << exception_name << "(" << exception_arguments << ");"; + if (be_global->use_raw_throw ()) + { + *os << "throw " + << exception_name << "(" << exception_arguments << ");\n"; + return 0; + } + + int is_void = + return_type == 0 || this->void_return_type (return_type); + + if (is_void) + { + *os << "ACE_THROW ("; + } + else + { + *os << "ACE_THROW_RETURN ("; + } + + *os << exception_name << " (" << exception_arguments << ")"; + + if (is_void) + { + *os << ");"; + + return 0; + } + + *os << ","; + + // Non-void return type. + be_visitor_context ctx (*this->ctx_); + be_visitor_operation_rettype_return_cs visitor (&ctx); + + if (return_type->accept (&visitor) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_operation::" + "gen_raise_exception - " + "codegen for return var failed\n"), + -1); + } + + *os << ");"; return 0; } @@ -225,7 +340,8 @@ be_visitor_operation::gen_stub_operation_body ( if (node->has_native ()) // native exists => no stub { - if (this->gen_raise_exception ("::CORBA::MARSHAL", + if (this->gen_raise_exception (return_type, + "::CORBA::MARSHAL", "") == -1) { ACE_ERROR_RETURN (( @@ -357,12 +473,23 @@ be_visitor_operation::gen_stub_operation_body ( *os << "_tao_call.invoke (" << be_idt << be_idt_nl << "_tao_" << node->flat_name () << "_exceptiondata," << be_nl - << node->exceptions ()->length () << be_uidt_nl + << node->exceptions ()->length () << env_arg << be_uidt_nl << ");" << be_uidt; } else { - *os << "_tao_call.invoke (0, 0);"; + *os << "_tao_call.invoke (0, 0" + << (be_global->use_raw_throw () ? "" : " ACE_ENV_ARG_PARAMETER") + << ");"; + } + + if (this->void_return_type (return_type)) + { + *os << TAO_ACE_CHECK (); + } + else + { + *os << TAO_ACE_CHECK ("_tao_retval.excp ()"); } if (!this->void_return_type (return_type)) @@ -408,7 +535,18 @@ be_visitor_operation::gen_raise_interceptor_exception ( if (this->void_return_type (bt)) { - *os << "throw " << excep << "(" << completion_status << ");"; + if (be_global->use_raw_throw ()) + { + *os << "throw " << excep << "(" << completion_status << ");"; + } + else + { + *os << "TAO_INTERCEPTOR_THROW (" << be_idt << be_idt_nl + << excep << " (" << be_idt << be_idt_nl + << completion_status << be_uidt_nl + << ")" << be_uidt << be_uidt_nl + << ");" << be_uidt; + } } else { diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp index 92bc5ab2eec..7bba7f41d3b 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_sh.cpp @@ -113,7 +113,7 @@ be_visitor_operation_sh::visit_operation (be_operation *node) << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & server_request," << be_nl << "void * servant_upcall," << be_nl - << "void * servant" << be_uidt_nl + << "void * servant" << env_decl << be_uidt_nl << ");" << be_uidt; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp index a62f5e8c7cd..34adf67cb75 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/operation_ss.cpp @@ -209,7 +209,7 @@ be_visitor_operation_ss::gen_skel_operation_body (be_operation * node, << "_skel (" << be_idt << be_idt_nl << "TAO_ServerRequest & server_request," << be_nl << "void * TAO_INTERCEPTOR (servant_upcall)," << be_nl - << "void * servant" << be_uidt_nl + << "void * servant" << env_decl << be_uidt_nl << ")" << be_uidt_nl; // Generate the actual code for the skeleton. However, if any of the @@ -298,8 +298,10 @@ be_visitor_operation_ss::gen_skel_operation_body (be_operation * node, << " , exceptions" << be_nl << " , nexceptions" << "\n#endif /* TAO_HAS_INTERCEPTORS == 1 */" << be_nl - << " );" << be_uidt_nl - << "}" << be_nl << be_nl; + << " " + << (be_global->use_raw_throw () ? "" : "ACE_ENV_ARG_PARAMETER") + << ");" << TAO_ACE_CHECK () << be_uidt_nl + << "}"; return 0; } diff --git a/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp index af21e45b74a..2990b9fde70 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/proxy_impl_xh.cpp @@ -42,7 +42,7 @@ int be_visitor_operation_proxy_impl_xh::visit_operation (be_operation *node) *os << node->local_name () << " (" << be_idt << be_idt_nl << "TAO_Abstract_ServantBase *servant," << be_nl << "TAO::Argument ** args," << be_nl - << "int num_args" << be_uidt_nl + << "int num_args" << env_decl << be_uidt_nl << ")"; if (this->gen_throw_spec (node) != 0) diff --git a/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp b/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp index 6042227dc34..a0fc6da455e 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/tie_sh.cpp @@ -77,10 +77,9 @@ be_visitor_operation_tie_sh::visit_operation (be_operation *node) // STEP 3: generate the argument list with the appropriate mapping. For these // we grab a visitor that generates the parameter listing ctx = *this->ctx_; - // We use this state here as a flag to leave out the param names in the - // arglist, to avoid a possible clash with the TIE class template - // parameter name. - ctx.state (TAO_CodeGen::TAO_TIE_OPERATION_ARGLIST_SH); + // we use the _CH state here because the _SH state produces pure virtual + // methods. + ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH); be_visitor_operation_arglist oa_visitor (&ctx); if (node->accept (&oa_visitor) == -1) diff --git a/TAO/TAO_IDL/be/be_visitor_operation/tie_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp index 8675c7ecd8f..ffa3758d8c8 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/tie_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/tie_si.cpp @@ -8,7 +8,7 @@ // TAO IDL // // = FILENAME -// tie_ss.cpp +// tie_si.cpp // // = DESCRIPTION // Visitor generating code for operations for the TIE class. @@ -19,25 +19,25 @@ // ============================================================================ ACE_RCSID (be_visitor_operation, - tie_ss, + tie_si, "$Id$") // ************************************************************ // Operation visitor for server inline for TIE class operations. // ************************************************************ -be_visitor_operation_tie_ss::be_visitor_operation_tie_ss ( +be_visitor_operation_tie_si::be_visitor_operation_tie_si ( be_visitor_context *ctx ) : be_visitor_scope (ctx) { } -be_visitor_operation_tie_ss::~be_visitor_operation_tie_ss (void) +be_visitor_operation_tie_si::~be_visitor_operation_tie_si (void) { } -int be_visitor_operation_tie_ss::visit_operation (be_operation *node) +int be_visitor_operation_tie_si::visit_operation (be_operation *node) { TAO_OutStream *os = this->ctx_->stream (); @@ -46,7 +46,7 @@ int be_visitor_operation_tie_ss::visit_operation (be_operation *node) if (!intf) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_tie_ss::" + "(%N:%l) be_visitor_operation_tie_si::" "visit_operation - " "bad interface scope\n"), -1); @@ -58,7 +58,7 @@ int be_visitor_operation_tie_ss::visit_operation (be_operation *node) if (!bt) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_tie_ss::" + "(%N:%l) be_visitor_operation_tie_si::" "visit_operation - " "Bad return type\n"), -1); @@ -100,7 +100,7 @@ int be_visitor_operation_tie_ss::visit_operation (be_operation *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from " << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; - *os << "template <class " << template_name.c_str () << ">" << be_nl; + *os << "template <class " << template_name.c_str () << "> ACE_INLINE\n"; // Generate the return type mapping (same as in the header file). be_visitor_context ctx (*this->ctx_); @@ -109,7 +109,7 @@ int be_visitor_operation_tie_ss::visit_operation (be_operation *node) if (bt->accept (&oro_visitor) == -1) { ACE_ERROR_RETURN ((LM_ERROR, - "(%N:%l) be_visitor_operation_tie_ss::" + "(%N:%l) be_visitor_operation_tie_si::" "visit_operation - " "codegen for return type failed\n"), -1); diff --git a/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp b/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp index 9703b55a0f4..bdf0aff984d 100644 --- a/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_operation/upcall_command_ss.cpp @@ -189,7 +189,9 @@ be_visitor_operation_upcall_command_ss::visit (be_operation * node, << "}" << be_nl << be_nl; // Generate execute() method. - os << "virtual void execute (void)" << be_nl + os << "virtual void execute (" + << (be_global->use_raw_throw () ? "void" : "ACE_ENV_SINGLE_ARG_DECL") + << ")" << be_nl << "{" << be_idt_nl; if (!node->void_return_type ()) @@ -385,6 +387,15 @@ be_visitor_operation_upcall_command_ss::gen_upcall (be_operation * node) << (i == 0 ? "" : ", ") << "arg_" << i + 1; } + if (count > 0) + { + os << env_arg; + } + else + { + os << env_sngl_arg; + } + os << ");"; if (!node->void_return_type ()) @@ -393,7 +404,7 @@ be_visitor_operation_upcall_command_ss::gen_upcall (be_operation * node) } os << be_uidt - << be_uidt_nl; + << TAO_ACE_CHECK () << be_uidt_nl; return 0; } |