summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-02-15 00:35:36 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-02-15 00:35:36 +0000
commit0c369763cbac58f2e9df6da59f59e8739856098a (patch)
treea328b8bb8d2a463ec9374e4508510a77b124646e
parent33eac35196d129866e1f026391e8fbc8401f2664 (diff)
downloadATCD-0c369763cbac58f2e9df6da59f59e8739856098a.tar.gz
ChangeLogTag: Fri Feb 14 18:27:09 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog22
-rw-r--r--TAO/TAO_IDL/ast/ast_decl.cpp57
-rw-r--r--TAO/TAO_IDL/ast/ast_module.cpp18
-rw-r--r--TAO/TAO_IDL/include/ast_module.h7
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp2
-rw-r--r--TAO/tests/IDL_Test/main.cpp114
6 files changed, 125 insertions, 95 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 87069327e25..009936c0325 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,25 @@
+Fri Feb 14 18:27:09 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/ast/ast_decl.cpp:
+ * TAO_IDL/ast/ast_module.cpp:
+ * TAO_IDL/include/ast_module.h:
+
+ Fixes for an error in IDL_Test, where recent changes to the
+ IDL compiler induced an error in typeprefix handling, and
+ a bug reported by Will Christhof <Will.Christhof@krones.de>
+ in #pragma prefix handling.
+
+ * TAO_IDL/util/utl_scope.cpp:
+
+ Cosmetic fix.
+
+ * tests/IDL_Test/main.cpp:
+
+ Changed error reporting and handling to allow multiple
+ errors to be reported in one run, and to allow the ORB
+ and POA to clean up at exit whether there have been errors
+ or not.
+
Fri Feb 14 14:37:55 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
* TAO_IDL/be/be_predefined_type.cpp (compute_repoID):
diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp
index 39a13f53f47..9a37e47acf1 100644
--- a/TAO/TAO_IDL/ast/ast_decl.cpp
+++ b/TAO/TAO_IDL/ast/ast_decl.cpp
@@ -75,6 +75,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc.
*/
#include "ast_interface.h"
+#include "ast_module.h"
#include "ast_array.h"
#include "ast_field.h"
#include "ast_structure.h"
@@ -270,47 +271,26 @@ AST_Decl::set_prefix_with_typeprefix_r (char *value,
// This will recursively catch all previous openings of a module.
if (this->node_type () == AST_Decl::NT_module)
{
- AST_Decl *d = DeclAsScope (this)->lookup_by_name (this->name (),
- I_TRUE);
+ AST_Decl **d = 0;
+ AST_Module *m = AST_Module::narrow_from_decl (this);
- if (d != this)
+ for (ACE_Unbounded_Set_Iterator<AST_Decl *> iter (m->previous ());
+ !iter.done ();
+ iter.advance ())
{
- d->set_prefix_with_typeprefix_r (value,
- appeared_in);
- }
- }
-
- this->compute_repoID ();
- UTL_Scope *s = DeclAsScope (this);
-
- if (s != 0)
- {
- AST_Decl *d = 0;
- AST_Decl *prefix_scope = 0;
+ iter.next (d);
- for (UTL_ScopeActiveIterator i (s, UTL_Scope::IK_decls);
- !i.is_done ();
- i.next ())
- {
- d = i.item ();
- prefix_scope = ScopeAsDecl (d->prefix_scope ());
-
- // This will let a prefix set in an inner scope override one set in
- // an outer scope, even if the outer scope typeprefix directive
- // appears later in the IDL file.
- if (d->typeid_set_
- || prefix_scope != 0
- && prefix_scope->has_ancestor (ScopeAsDecl (appeared_in)) != 0)
+ if ((*d)->node_type () == AST_Decl::NT_pre_defined)
{
continue;
}
- else
- {
- d->set_prefix_with_typeprefix_r (value,
- appeared_in);
- }
+
+ (*d)->set_prefix_with_typeprefix_r (value,
+ appeared_in);
}
}
+
+ this->compute_repoID ();
}
// Protected operations.
@@ -421,8 +401,15 @@ AST_Decl::compute_repoID (void)
while (ACE_OS::strcmp (prefix, "") == 0 && scope != 0)
{
AST_Decl *parent = ScopeAsDecl (scope);
+
+ if (parent->node_type () == AST_Decl::NT_root
+ && parent->imported ())
+ {
+ break;
+ }
+
prefix = parent->prefix ();
- scope = ScopeAsDecl (scope)->defined_in ();
+ scope = parent->defined_in ();
}
// in the first loop compute the total length
@@ -436,7 +423,7 @@ AST_Decl::compute_repoID (void)
{
AST_Decl *parent = ScopeAsDecl (scope);
version = parent->version ();
- scope = ScopeAsDecl (scope)->defined_in ();
+ scope = parent->defined_in ();
}
if (version != 0)
diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp
index e3d4c8a6ff1..6a84475fdef 100644
--- a/TAO/TAO_IDL/ast/ast_module.cpp
+++ b/TAO/TAO_IDL/ast/ast_module.cpp
@@ -169,6 +169,16 @@ AST_Module::fe_add_module (AST_Module *t)
AST_Decl *d;
AST_Module *m = 0;
+ UTL_Scope *scope = t->defined_in ();
+
+ // If our prefix is empty, we check to see if an ancestor has one.
+ while (ACE_OS::strcmp (t->prefix (), "") == 0 && scope != 0)
+ {
+ AST_Decl *parent = ScopeAsDecl (scope);
+ t->prefix (ACE_static_cast (char *, parent->prefix ()));
+ scope = parent->defined_in ();
+ }
+
// Already defined and cannot be redefined? Or already used?
if ((d = this->lookup_for_add (t, I_FALSE)) != 0)
{
@@ -199,7 +209,7 @@ AST_Module::fe_add_module (AST_Module *t)
if (ACE_OS::strcmp (this_prefix, "") == 0)
{
- this->prefix (ACE_const_cast (char *, prev_prefix));
+ t->prefix (ACE_const_cast (char *, prev_prefix));
}
else
{
@@ -1710,6 +1720,12 @@ AST_Module::look_in_previous (Identifier *e)
return retval;
}
+ACE_Unbounded_Set<AST_Decl *> &
+AST_Module::previous (void)
+{
+ return this->previous_;
+}
+
void
AST_Module::destroy (void)
{
diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h
index 13bf036df1a..7293a527971 100644
--- a/TAO/TAO_IDL/include/ast_module.h
+++ b/TAO/TAO_IDL/include/ast_module.h
@@ -121,6 +121,9 @@ public:
// in a previous opening of this module.
AST_Decl *look_in_previous (Identifier *e);
+ // Accessor to the member.
+ ACE_Unbounded_Set<AST_Decl *> &previous (void);
+
// Cleanup function.
virtual void destroy (void);
@@ -167,13 +170,13 @@ private:
virtual AST_StructureFwd *fe_add_structure_fwd (AST_StructureFwd *s);
- virtual AST_Enum *fe_add_enum (AST_Enum *e);
+ virtual AST_Enum *fe_add_enum (AST_Enum *e);
virtual AST_EnumVal *fe_add_enum_val (AST_EnumVal *v);
virtual AST_Typedef *fe_add_typedef (AST_Typedef *t);
- virtual AST_Native *fe_add_native (AST_Native *n);
+ virtual AST_Native *fe_add_native (AST_Native *n);
idl_bool pd_has_nested_valuetype;
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index 133098c8a25..5ad0c416db6 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -886,7 +886,7 @@ UTL_Scope::fe_add_predefined_type (AST_PredefinedType *)
AST_Module *
UTL_Scope::fe_add_module (AST_Module *)
{
- return NULL;
+ return 0;
}
AST_Interface *
diff --git a/TAO/tests/IDL_Test/main.cpp b/TAO/tests/IDL_Test/main.cpp
index a83a104897f..27ad53cc52d 100644
--- a/TAO/tests/IDL_Test/main.cpp
+++ b/TAO/tests/IDL_Test/main.cpp
@@ -78,6 +78,8 @@ class schmegegging_i : public virtual gleep::schmegegging
int
main (int argc , char *argv[])
{
+ int error_count = 0;
+
ACE_TRY_NEW_ENV
{
CORBA::ORB_var orb = CORBA::ORB_init (argc,
@@ -107,9 +109,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (obj->_interface_repository_id (),
"IDL:anvil.com/hello:1.0"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'hello'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'hello'\n"));
}
goodbye_i g;
@@ -119,9 +121,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (obj->_interface_repository_id (),
"IDL:anvil.com/goodbye:1.0"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'goodbye'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'goodbye'\n"));
}
sayonara_i s;
@@ -131,9 +133,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (obj->_interface_repository_id (),
"IDL:hammer.com/salutation/sayonara:1.0"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'sayonara'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'sayonara'\n"));
}
ciao_i c;
@@ -143,9 +145,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (obj->_interface_repository_id (),
"IDL:anvil.com/ciao:1.0"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'ciao'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'ciao'\n"));
}
aloha_i a;
@@ -155,9 +157,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (obj->_interface_repository_id (),
"IDL:anvil.com/aloha:1.0"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'aloha'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'aloha'\n"));
}
// Test of typeprefix, typeid, and #pragma version behavior.
@@ -167,9 +169,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (s_schmooze._interface_repository_id (),
"IDL:gleep_prefix/gleep/schmooze:1.0"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'schmooze'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'schmooze'\n"));
}
schmeer_i s_schmeer;
@@ -177,9 +179,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (s_schmeer._interface_repository_id (),
"IDL:gleep_prefix/gleep/schmeer:1.0"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'schmeer'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'schmeer'\n"));
}
schlemiel_i s_schlemiel;
@@ -187,9 +189,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (s_schlemiel._interface_repository_id (),
"IDL:gleep_prefix/gleep/schlemiel:1.0"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'schlemiel'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'schlemiel'\n"));
}
spilkis_i s_spilkis;
@@ -197,9 +199,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (s_spilkis._interface_repository_id (),
"IDL:gleep_prefix/gleep/spilkis:1.0"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'spilkis'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'spilkis'\n"));
}
schmuck_i s_schmuck;
@@ -207,9 +209,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (s_schmuck._interface_repository_id (),
"ABRA:cadabra/hocus/pocus:1.23"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'schmuck'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'schmuck'\n"));
}
schmendrick_i s_schmendrick;
@@ -217,9 +219,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (s_schmendrick._interface_repository_id (),
"IDL:floop_prefix/gleep/floop/schmendrick:524.23"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'schmendrick'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'schmendrick'\n"));
}
schlemazel_i s_schlemazel;
@@ -229,9 +231,9 @@ main (int argc , char *argv[])
"IDL:verklempt_prefix/gleep/floop/verklempt/schlemazel:1.0"
))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'schlemazel'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'schlemazel'\n"));
}
schmegegging_i s_schmegegging;
@@ -239,9 +241,9 @@ main (int argc , char *argv[])
if (ACE_OS::strcmp (s_schmegegging._interface_repository_id (),
"IDL:gleep_prefix/gleep/schmegegging:1.0"))
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "pragma prefix error in object 'schmegegging'\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "pragma prefix error in object 'schmegegging'\n"));
}
// Testing (de)marshaling of IDL union values
@@ -258,20 +260,20 @@ main (int argc , char *argv[])
if ((any1 >>= outfield) == 0)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "error in extraction of "
- "duplicate case label value\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "error in extraction of "
+ "duplicate case label value\n"));
}
const char *str = outfield->value.strValue ();
if (ACE_OS::strcmp (str, "duplicate case label test string") != 0)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "error - corruption of "
- "duplicate case label value\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "error - corruption of "
+ "duplicate case label value\n"));
}
field.value.defstr (CORBA::string_dup ("default case test string"));
@@ -279,20 +281,20 @@ main (int argc , char *argv[])
if ((any1 >>= outfield) == 0)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "error in extraction of "
- "default case label value\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "error in extraction of "
+ "default case label value\n"));
}
str = outfield->value.defstr ();
if (ACE_OS::strcmp (str, "default case test string") != 0)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "error - corruption of "
- "default case label value\n"),
- -1);
+ ++error_count;
+ ACE_DEBUG ((LM_DEBUG,
+ "error - corruption of "
+ "default case label value\n"));
}
root_poa->destroy (1,
@@ -308,5 +310,5 @@ main (int argc , char *argv[])
}
ACE_ENDTRY;
- return 0;
+ return error_count;
}