summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-03-16 19:38:15 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-03-16 19:38:15 +0000
commit65e8c7e74d0c26af7867559011dd2b560abfad10 (patch)
treed55f7eb2e330e7a3e5216b01d6ae21dfb585b7d2
parenteafcec4805a2e6ef4eb7de0f296748e0f42c7207 (diff)
downloadATCD-65e8c7e74d0c26af7867559011dd2b560abfad10.tar.gz
Various bug fixes.
-rw-r--r--TAO/TAO_IDL/ast/ast_interface.cpp2
-rw-r--r--TAO/TAO_IDL/ast/ast_operation.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp10
-rw-r--r--TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp4
-rw-r--r--TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp25
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp12
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp7
-rw-r--r--TAO/TAO_IDL/include/utl_scope.h3
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp63
9 files changed, 81 insertions, 51 deletions
diff --git a/TAO/TAO_IDL/ast/ast_interface.cpp b/TAO/TAO_IDL/ast/ast_interface.cpp
index 256ed4eb505..f05c84a5769 100644
--- a/TAO/TAO_IDL/ast/ast_interface.cpp
+++ b/TAO/TAO_IDL/ast/ast_interface.cpp
@@ -883,7 +883,7 @@ AST_Interface::fwd_redefinition_helper (AST_Interface *&i,
{
// Fwd redefinition should be in the same scope, so local
// lookup is all that's needed.
- AST_Decl *d = s->lookup_by_name_local (i->local_name ());
+ AST_Decl *d = s->lookup_by_name_local (i->local_name (), 0);
AST_Interface *fd = NULL;
diff --git a/TAO/TAO_IDL/ast/ast_operation.cpp b/TAO/TAO_IDL/ast/ast_operation.cpp
index f8c667465ea..34906848d32 100644
--- a/TAO/TAO_IDL/ast/ast_operation.cpp
+++ b/TAO/TAO_IDL/ast/ast_operation.cpp
@@ -172,9 +172,9 @@ UTL_NameList *
AST_Operation::fe_add_exceptions(UTL_NameList *t)
{
UTL_NamelistActiveIterator *nl_i;
- UTL_ScopedName *nl_n;
+ UTL_ScopedName *nl_n;
UTL_Scope *fs = idl_global->scopes()->top();
- AST_Exception *fe;
+ AST_Exception *fe;
AST_Decl *d;
// Macro to avoid "warning: unused parameter" type warning.
@@ -220,7 +220,7 @@ AST_Argument *AST_Operation::fe_add_argument(AST_Argument *t)
/*
* Already defined and cannot be redefined? Or already used?
*/
- if ((d = lookup_by_name_local(t->local_name())) != NULL) {
+ if ((d = lookup_by_name_local(t->local_name(), 0)) != NULL) {
if (!can_be_redefined(d)) {
idl_global->err()->error3(UTL_Error::EIDL_REDEF, t, this, d);
return NULL;
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
index c7d4d544277..b32b8f0d261 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_ch.cpp
@@ -54,9 +54,6 @@ int be_visitor_exception_ch::visit_exception (be_exception *node)
os->indent ();
*os << "class " << node->local_name () << ";" << be_nl;
- // generate the _ptr declaration
- *os << "typedef " << node->local_name () << " *"
- << node->local_name () << "_ptr;" << be_nl;
os->gen_endif ();
os->gen_ifdef_macro (node->flat_name ());
@@ -68,13 +65,6 @@ int be_visitor_exception_ch::visit_exception (be_exception *node)
*os << "{" << be_nl
<< "public:\n\n";
- // generate the _ptr_type and _var_type typedefs
- // but we must protect against certain versions of g++
- *os << "#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)\n";
- os->incr_indent ();
- *os << "typedef " << node->local_name () << "_ptr _ptr_type;\n"
- << "#endif /* ! __GNUC__ || g++ >= 2.8 */\n\n";
-
// generate code for field members
if (this->visit_scope (node) == -1)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
index 33306b05046..c8bd80c63db 100644
--- a/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_exception/exception_cs.cpp
@@ -129,14 +129,14 @@ int be_visitor_exception_cs::visit_exception (be_exception *node)
// narrow method
os->indent ();
*os << "// narrow" << be_nl;
- *os << node->name () << "_ptr " << be_nl;
+ *os << node->name () << " *" << be_nl;
*os << node->name () << "::_narrow (CORBA::Exception *exc)" << be_nl;
*os << "{\n";
os->incr_indent ();
*os << "if (!ACE_OS::strcmp (\"" << node->repoID ()
<< "\", exc->_id ())) // same type" << be_nl;
*os << " return ACE_dynamic_cast (" << node->local_name ()
- << "_ptr, exc);" << be_nl;
+ << " *, exc);" << be_nl;
*os << "else" << be_nl;
*os << " return 0;\n";
os->decr_indent ();
diff --git a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
index 6d3a4b62438..d6fc8764209 100644
--- a/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_sequence/sequence_ch.cpp
@@ -308,9 +308,7 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
}
*os << "class " << node->local_name () << ";" << be_nl;
- *os << "class " << node->local_name () << "_var;" << be_nl;
- *os << "typedef " << node->local_name () << "* "
- << node->local_name () << "_ptr;" << be_nl << be_nl;
+ *os << "class " << node->local_name () << "_var;" << be_nl << be_nl;
*os << "// *************************************************************"
<< be_nl
@@ -379,8 +377,7 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
// but we must protect against certain versions of g++
*os << "#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)\n";
os->indent ();
- *os << "typedef " << node->local_name () << "_ptr _ptr_type;" << be_nl
- << "typedef " << node->local_name () << "_var _var_type;\n"
+ *os << "typedef " << node->local_name () << "_var _var_type;\n"
<< "#endif /* ! __GNUC__ || g++ >= 2.8 */\n\n";
os->decr_indent ();
@@ -390,17 +387,19 @@ int be_visitor_sequence_ch::visit_sequence (be_sequence *node)
if (bt->base_node_type () == AST_Type::NT_pre_defined)
{
be_typedef* alias =
- be_typedef::narrow_from_decl (bt);
+ be_typedef::narrow_from_decl (bt);
if (alias == 0)
- {
- predef = be_predefined_type::narrow_from_decl (bt);
- }
+ {
+ predef = be_predefined_type::narrow_from_decl (bt);
+ }
else
- {
- predef = be_predefined_type::narrow_from_decl
- (alias->primitive_base_type ());
- }
+ {
+ predef =
+ be_predefined_type::narrow_from_decl (
+ alias->primitive_base_type ()
+ );
+ }
}
// Now generate the extension...
if (predef != 0 && predef->pt () == AST_PredefinedType::PT_octet
diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
index 71ca878b782..d68b55ddf69 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
@@ -2854,10 +2854,14 @@ be_visitor_typecode_defn::gen_repoID (be_decl *node)
}
}
- // XXXASG -- there is still some doubts in my mind about whether repoID
- // *must* be supplied or not as per spec 2.3a. So I am not going to allow
- // optimizations here.
- // flag = 0;
+ // @@@JP CORBA 2.3.1 states that the Repository ID must be present
+ // for interfaces, valuetypes and exceptions, as Andy has implemented
+ // above. It also states that it must be present in structs, unions,
+ // enumerations and aliases for typecodes crom an interface repository
+ // or created by the ORB. We've also had requests to leave the repo
+ // ID in even in optimized typecodes, so I'll disable the
+ // optimization of this field for now.
+ flag = 0;
if (flag)
{
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
index ecbd98a907b..ba9f9004368 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_ch.cpp
@@ -62,9 +62,7 @@ int be_visitor_union_ch::visit_union (be_union *node)
os->indent (); // start with the current indentation level
*os << "class " << node->local_name () << ";" << be_nl;
- *os << "class " << node->local_name () << "_var;" << be_nl;
- *os << "typedef " << node->local_name () << "* "
- << node->local_name () << "_ptr;" << be_nl << be_nl;
+ *os << "class " << node->local_name () << "_var;" << be_nl << be_nl;
*os << "class " << idl_global->stub_export_macro () << " "
<< node->local_name () << ": public TAO_Base_Union " << be_nl
@@ -118,8 +116,7 @@ int be_visitor_union_ch::visit_union (be_union *node)
// but we must protect against certain versions of g++
*os << "#if !defined(__GNUC__) || !defined (ACE_HAS_GNUG_PRE_2_8)\n";
os->indent ();
- *os << "typedef " << node->local_name () << "_ptr _ptr_type;" << be_nl
- << "typedef " << node->local_name () << "_var _var_type;\n"
+ *os << "typedef " << node->local_name () << "_var _var_type;\n"
<< "#endif /* ! __GNUC__ || g++ >= 2.8 */\n";
// now generate the public defn for the union branch members. For this,
diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h
index ff12dd9bd48..2a06e20c2fc 100644
--- a/TAO/TAO_IDL/include/utl_scope.h
+++ b/TAO/TAO_IDL/include/utl_scope.h
@@ -166,7 +166,8 @@ public:
idl_bool in_parent = 1);
// Look up the Identifier * specified only in the local scope
- virtual AST_Decl *lookup_by_name_local(Identifier *);
+ virtual AST_Decl *lookup_by_name_local(Identifier *,
+ long index);
// Look up a predefined type by its ExprType
virtual AST_Decl
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index 20310ea41f8..9c076cf035c 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -166,7 +166,7 @@ iter_lookup_by_name_local (AST_Decl *d,
return NULL;
}
- d = sc->lookup_by_name_local (s);
+ d = sc->lookup_by_name_local (s, 0);
}
delete i;
@@ -274,7 +274,7 @@ UTL_Scope::lookup_for_add(AST_Decl *d, idl_bool)
{
if (d == NULL)
return NULL;
- return lookup_by_name_local(d->local_name());
+ return lookup_by_name_local(d->local_name(), 0);
}
/*
@@ -834,7 +834,8 @@ UTL_Scope::look_in_inherited (UTL_ScopedName *e,
// Look up a String * in local scope only
AST_Decl *
-UTL_Scope::lookup_by_name_local (Identifier *e)
+UTL_Scope::lookup_by_name_local (Identifier *e,
+ long index)
{
// Temporary hack to disallow 'fixed' without
// implementing all the classes for it.
@@ -863,17 +864,29 @@ UTL_Scope::lookup_by_name_local (Identifier *e)
if (e->case_compare (item_name))
{
- delete i;
+ if (index == 0)
+ {
+ delete i;
+
+ // Special case for forward declared interfaces.
+ // Look through the forward declaration and retrieve
+ // the full definition.
+ if (d->node_type () == AST_Decl::NT_interface_fwd)
+ {
+ d = AST_InterfaceFwd::narrow_from_decl (d)->full_definition ();
+ }
- // Special case for forward declared interfaces.
- // Look through the forward declaration and retrieve
- // the full definition.
- if (d->node_type () == AST_Decl::NT_interface_fwd)
+ return d;
+ }
+ else
+ // This is an instance of a reopened modules that matches the
+ // input indentifier, but the rest of the scoped name didn't
+ // match.
{
- d = AST_InterfaceFwd::narrow_from_decl (d)->full_definition ();
+ index--;
+ i->next ();
+ continue;
}
-
- return d;
}
i->next ();
@@ -895,6 +908,7 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
{
AST_Decl *d;
UTL_Scope *t = NULL;
+ long index = 0;
// Empty name? error
if (e == NULL)
@@ -950,7 +964,7 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
while (1)
{
- d = lookup_by_name_local (e->head ());
+ d = lookup_by_name_local (e->head (), 0);
if (d == NULL)
{
@@ -1046,9 +1060,34 @@ UTL_Scope::lookup_by_name (UTL_ScopedName *e,
// OK, start of name is defined. Now loop doing local lookups
// of subsequent elements of the name.
+ AST_Decl::NodeType nt = d->node_type ();
+
d = iter_lookup_by_name_local (d,
e);
+ if (nt == AST_Decl::NT_module)
+ {
+ // If local lookup matched identifier, but the rest
+ // of the scoped name failed to match, maybe the
+ // module is reopened later in the scope and we'll
+ // get another chance.
+ while (d == NULL)
+ {
+ // Incrementing index will skip the previous
+ // identifier matches.
+ d = this->lookup_by_name_local (e->head (),
+ ++index);
+
+ // Entire local scope was searched - no match.
+ if (d == NULL)
+ break;
+
+ // Try again to match the whole scoped name.
+ d = iter_lookup_by_name_local (d,
+ e);
+ }
+ }
+
// If treat_as_ref is true and d is not NULL, add d to
// set of nodes referenced here
if (treat_as_ref && d != NULL)