From 8b73cd726a301dddaf749f9f0ba9a7c0b4752d2e Mon Sep 17 00:00:00 2001 From: parsons Date: Tue, 17 Aug 2004 23:00:06 +0000 Subject: ChangeLogTag: Tue Aug 17 17:56:23 2004 Jeff Parsons --- TAO/ChangeLog | 19 +++++++++++++ TAO/TAO_IDL/be/be_interface.cpp | 13 +++++++-- TAO/TAO_IDL/be/be_visitor_component/component.cpp | 7 +---- .../be/be_visitor_component/component_ch.cpp | 15 ++++++++++ .../be/be_visitor_component/component_cs.cpp | 33 ++++++++++++++++++++++ .../be/be_visitor_interface/interface_ch.cpp | 3 +- TAO/TAO_IDL/be/be_visitor_module/module.cpp | 2 ++ TAO/TAO_IDL/be/be_visitor_root/root.cpp | 2 ++ TAO/TAO_IDL/fe/fe_interface_header.cpp | 8 ------ TAO/TAO_IDL/include/utl_err.h | 8 +----- TAO/TAO_IDL/util/utl_err.cpp | 21 +------------- 11 files changed, 86 insertions(+), 45 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index ab15ed8cad7..18275be8849 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,22 @@ +Tue Aug 17 17:56:23 2004 Jeff Parsons + + * TAO_IDL/be/be_interface.cpp: + * TAO_IDL/be/be_visitor_component/component.cpp: + * TAO_IDL/be/be_visitor_component/component_ch.cpp: + * TAO_IDL/be/be_visitor_component/component_cs.cpp: + * TAO_IDL/be/be_visitor_interface/interface_ch.cpp: + * TAO_IDL/be/be_visitor_module/module.cpp: + * TAO_IDL/be/be_visitor_root/root.cpp: + * TAO_IDL/fe/fe_interface_header.cpp: + * TAO_IDL/include/utl_err.h: + * TAO_IDL/util/utl_err.cpp: + + Eliminated the error message generated when a component is + supporting an abstract interface - it was mistakenly assumed + that such a thing was barred by the spec. Once this error + was eliminated, other changes were required to support the + new 'feature'. + Tue Aug 17 15:48:28 2004 Jeff Parsons * TAO_IDL/be/be_interface.cpp: diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 00179b1f715..58760041cfe 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -1356,6 +1356,11 @@ be_interface::gen_collocated_skel_body (be_interface *derived, void be_interface::analyze_parentage (void) { + if (this->has_mixed_parentage_ != -1) + { + return; + } + this->has_mixed_parentage_ = 0; for (long i = 0; i < this->pd_n_inherits; ++i) @@ -1369,9 +1374,13 @@ be_interface::analyze_parentage (void) break; } } + + AST_Decl::NodeType nt = this->node_type (); + idl_bool can_be_mixed = nt == AST_Decl::NT_interface + || nt == AST_Decl::NT_component + || nt == AST_Decl::NT_home; - if (this->has_mixed_parentage_ == 1 - && this->node_type () == AST_Decl::NT_interface) + if (this->has_mixed_parentage_ == 1 && can_be_mixed) { be_global->mixed_parentage_interfaces.enqueue_tail (this); } diff --git a/TAO/TAO_IDL/be/be_visitor_component/component.cpp b/TAO/TAO_IDL/be/be_visitor_component/component.cpp index 80bf5a90a14..e0062c4515f 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component.cpp @@ -45,16 +45,11 @@ be_visitor_component::visit_attribute (be_attribute *node) switch (this->ctx_->state ()) { - case TAO_CodeGen::TAO_ROOT_CH: - break; + case TAO_CodeGen::TAO_INTERFACE_CH: case TAO_CodeGen::TAO_ROOT_CS: - break; case TAO_CodeGen::TAO_ROOT_SH: - break; case TAO_CodeGen::TAO_ROOT_IH: - break; case TAO_CodeGen::TAO_ROOT_SS: - break; case TAO_CodeGen::TAO_ROOT_IS: break; default: diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp index b168399f32d..c2f85d715ff 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_ch.cpp @@ -153,6 +153,21 @@ be_visitor_component_ch::visit_component (be_component *node) *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__; + if (! node->is_abstract ()) + { + node->analyze_parentage (); + } + + // If we inherit from both CORBA::Object and CORBA::AbstractBase, + // we have to override _add_ref() to avoid ambiguity. A comopnent + // can have mixed parentage if it supports an abstract or mixed- + // parentage interface. + if (node->has_mixed_parentage ()) + { + *os << be_nl << be_nl + << "virtual void _add_ref (void);"; + } + *os << be_nl << be_nl << "virtual CORBA::Boolean _is_a (" << be_idt << be_idt_nl << "const char *type_id" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp b/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp index f35f7eab081..94cc74fa620 100644 --- a/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_component/component_cs.cpp @@ -109,6 +109,29 @@ be_visitor_component_cs::visit_component (be_component *node) << "}"; } + if (node->has_mixed_parentage ()) + { + *os << be_nl << be_nl + << "void" << be_nl + << "CORBA::release (" + << node->name () + << "_ptr p)" << be_nl + << "{" << be_idt_nl + << "CORBA::AbstractBase_ptr abs = p;" << be_nl + << "CORBA::release (abs);" << be_uidt_nl + << "}"; + + *os << be_nl << be_nl + << "CORBA::Boolean" << be_nl + << "CORBA::is_nil (" + << node->name () + << "_ptr p)" << be_nl + << "{" << be_idt_nl + << "CORBA::Object_ptr obj = p;" << be_nl + << "return CORBA::is_nil (obj);" << be_uidt_nl + << "}"; + } + // Generate the proxy broker factory function pointer definition. *os << be_nl << be_nl << "// Function pointer for collocation factory initialization." @@ -172,6 +195,16 @@ be_visitor_component_cs::visit_component (be_component *node) << "}" << be_nl << be_nl; } + if (node->has_mixed_parentage ()) + { + *os << "void" << be_nl + << node->name () << "::_add_ref (void)" << be_nl + << "{" << be_idt_nl + << "this->ACE_NESTED_CLASS (CORBA, Object)::_add_ref ();" + << be_uidt_nl + << "}" << be_nl << be_nl; + } + // The _narrow method. *os << node->full_name () << "_ptr" << be_nl << node->full_name () << "::_narrow (" << be_idt << be_idt_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp index 1e7b0fefcf9..675f9e648d5 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -213,8 +213,7 @@ be_visitor_interface_ch::visit_interface (be_interface *node) } // If we inherit from both CORBA::Object and CORBA::AbstractBase, - // we have to override _add_ref() to avoid ambiguity, because it is - // called in _tao_Queryinterface(). + // we have to override _add_ref() to avoid ambiguity. if (node->has_mixed_parentage ()) { *os << "virtual void _add_ref (void);" << be_nl << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_module/module.cpp b/TAO/TAO_IDL/be/be_visitor_module/module.cpp index d7427e01555..7505969be27 100644 --- a/TAO/TAO_IDL/be/be_visitor_module/module.cpp +++ b/TAO/TAO_IDL/be/be_visitor_module/module.cpp @@ -715,6 +715,8 @@ be_visitor_module::visit_component (be_component *node) case TAO_CodeGen::TAO_ROOT_CH: { be_visitor_component_ch visitor (&ctx); + // So we can pick up the abstract ops helpers. + ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); status = node->accept (&visitor); break; } diff --git a/TAO/TAO_IDL/be/be_visitor_root/root.cpp b/TAO/TAO_IDL/be/be_visitor_root/root.cpp index 6f135567811..05a72247f61 100644 --- a/TAO/TAO_IDL/be/be_visitor_root/root.cpp +++ b/TAO/TAO_IDL/be/be_visitor_root/root.cpp @@ -1104,6 +1104,8 @@ be_visitor_root::visit_component (be_component *node) case TAO_CodeGen::TAO_ROOT_CH: { be_visitor_component_ch visitor (&ctx); + // This is the only context state involved in strategies. + ctx.state (TAO_CodeGen::TAO_INTERFACE_CH); status = node->accept (&visitor); break; } diff --git a/TAO/TAO_IDL/fe/fe_interface_header.cpp b/TAO/TAO_IDL/fe/fe_interface_header.cpp index 7df853b91aa..f6d54db537a 100644 --- a/TAO/TAO_IDL/fe/fe_interface_header.cpp +++ b/TAO/TAO_IDL/fe/fe_interface_header.cpp @@ -950,14 +950,6 @@ FE_ComponentHeader::compile_supports (UTL_NameList *supports) continue; } - // Abstract interface? (illegal for components to support). - if (i->is_abstract ()) - { - idl_global->err ()->concrete_interface_expected (this->name (), - i->name ()); - continue; - } - // Local interface? (illegal for components to support). if (i->is_local ()) { diff --git a/TAO/TAO_IDL/include/utl_err.h b/TAO/TAO_IDL/include/utl_err.h index 03741e30463..62fd3830e97 100644 --- a/TAO/TAO_IDL/include/utl_err.h +++ b/TAO/TAO_IDL/include/utl_err.h @@ -226,16 +226,10 @@ public: void abstract_inheritance_error (UTL_ScopedName *v, UTL_ScopedName *i); - // Report an attempt to support more then one abstract type. + // Report an attempt to support more then one concrete type. void abstract_support_error (UTL_ScopedName *v, UTL_ScopedName *i); - // Report a situation where a concrete interface was expected but we got - // something else instead. This most likely is a case in a supports - // or inheritance list. - void concrete_interface_expected (UTL_ScopedName *c, - UTL_ScopedName *i); - // Report a situation where a non-local interface was expected but we got // something else instead. This most likely is a case in a supports // or inheritance list. diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp index 98a9f56c6ff..423cbd4c51a 100644 --- a/TAO/TAO_IDL/util/utl_err.cpp +++ b/TAO/TAO_IDL/util/utl_err.cpp @@ -943,26 +943,7 @@ UTL_Error::abstract_support_error (UTL_ScopedName *v, idl_global->set_err_count (idl_global->err_count () + 1); } -// Report illegal component or home support of abstract interface. -void -UTL_Error::concrete_interface_expected (UTL_ScopedName *c, - UTL_ScopedName *i) -{ - idl_error_header (EIDL_CANT_SUPPORT, - idl_global->lineno (), - idl_global->filename ()); - ACE_ERROR ((LM_ERROR, - " component or home ")); - c->dump (*ACE_DEFAULT_LOG_STREAM); - ACE_ERROR ((LM_ERROR, - " attempts to support an abstract interface: ")); - i->dump (*ACE_DEFAULT_LOG_STREAM); - ACE_ERROR ((LM_ERROR, - "\n")); - idl_global->set_err_count (idl_global->err_count () + 1); -} - -// Report illegal component or home support of abstract interface. +// Report illegal component or home support of local interface. void UTL_Error::unconstrained_interface_expected (UTL_ScopedName *c, UTL_ScopedName *i) -- cgit v1.2.1