summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2012-11-23 19:26:43 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2012-11-23 19:26:43 +0000
commit46f2f6495e322b5cee0c53d7c2fab69b6aeaee4b (patch)
treed950f94f8770e8e637db57fa49d79ba80dbcb5c3
parent82af7641f5d45b63a030eed3296602526b064e09 (diff)
downloadATCD-46f2f6495e322b5cee0c53d7c2fab69b6aeaee4b.tar.gz
ChangeLogTag: Fri Nov 23 19:15:15 UTC 2012 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog33
-rw-r--r--TAO/TAO_IDL/ast/ast_module.cpp6
-rw-r--r--TAO/TAO_IDL/include/ast_module.h6
-rw-r--r--TAO/TAO_IDL/util/utl_global.cpp5
-rw-r--r--TAO/TAO_IDL/util/utl_scope.cpp12
-rw-r--r--TAO/tests/IDL_Test/IDL_Test.mpc10
-rw-r--r--TAO/tests/IDL_Test/PEMNaming.idl61
-rw-r--r--TAO/tests/IDL_Test/loader_const.idl17
8 files changed, 145 insertions, 5 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index d1ef7cadd00..5e4a9b72190 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,36 @@
+Fri Nov 23 19:15:15 UTC 2012 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/ast/ast_module.cpp:
+ * TAO_IDL/include/ast_module.h:
+ * TAO_IDL/util/utl_global.cpp:
+
+ Fixed bug caused by (1) processing multiple IDL files in one pass
+ and (2) any IDL file except the last containing an include of
+ orb.idl. This include causes reopenings of the CORBA module,
+ in addition to the one created internally by tao_idl to contain
+ the basic types. This last is a special module, but like other
+ AST nodes, contains a reference to the most recent reopening
+ in its parent scope. Since the reopened CORBA modules are
+ destroyed after the included file is processed, this special
+ module contained a garbage reference, since it is not destroyed
+ until all IDL files are processed. Code was added to reset
+ this reference to the module itself after each file is processed.
+ Thanks to Sergey Onuchin <sonuchin at parallels dot com> for
+ reporting the bug and for supplying example IDL files.
+
+ * TAO_IDL/util/utl_scope.cpp:
+
+ Cosmetic changes.
+
+ * tests/IDL_Test/loader_const.idl:
+ * tests/IDL_Test/PEMNaming.idl:
+
+ New files that formerly reproduced the bug described above.
+
+ * tests/IDL_Test/IDL_Test.mpc:
+
+ Updated the MPC file to use the new IDL files above.
+
Fri Nov 23 17:55:33 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl>
* orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc:
diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp
index 910864ecd74..7594a0c71f7 100644
--- a/TAO/TAO_IDL/ast/ast_module.cpp
+++ b/TAO/TAO_IDL/ast/ast_module.cpp
@@ -637,3 +637,9 @@ AST_Module::fe_add_porttype (AST_PortType *t)
AST_PortType::narrow_from_decl (
this->fe_add_decl (t));
}
+
+void
+AST_Module::reset_last_in_same_parent_scope (void)
+{
+ this->last_in_same_parent_scope_ = this;
+} \ No newline at end of file
diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h
index 12e2e23e434..cf2dba748ca 100644
--- a/TAO/TAO_IDL/include/ast_module.h
+++ b/TAO/TAO_IDL/include/ast_module.h
@@ -231,6 +231,12 @@ public:
virtual
AST_PortType *fe_add_porttype (AST_PortType *pt);
+ // Reset the last_in_same_parent_scope_ member to ourself
+ // (called by AST_Root::destroy on the CORBA module containing
+ // the basic types, since it isn't destroyed between processing
+ // multiple IDL files.
+ void reset_last_in_same_parent_scope (void);
+
private: // Data
bool pd_has_nested_valuetype_;
diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp
index 6ce41ce58a7..71a0527a3da 100644
--- a/TAO/TAO_IDL/util/utl_global.cpp
+++ b/TAO/TAO_IDL/util/utl_global.cpp
@@ -928,6 +928,11 @@ IDL_GlobalData::destroy (void)
ACE::strdelete (this->recursion_start_);
this->recursion_start_ = 0;
+ // Reset the member of the CORBA module containing the basic types
+ // to point to itself, since all the other CORBA modules (if any)
+ // will be destroyed.
+ this->corba_module_->reset_last_in_same_parent_scope ();
+
if (0 != this->pd_root)
{
this->pd_root->destroy ();
diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp
index 27e7290467f..b2120a33cf4 100644
--- a/TAO/TAO_IDL/util/utl_scope.cpp
+++ b/TAO/TAO_IDL/util/utl_scope.cpp
@@ -1127,7 +1127,7 @@ UTL_Scope::lookup_by_name_local (Identifier *e,
return 0;
}
- bool in_corba = !ACE_OS::strcmp (e->get_string (), "CORBA");
+ bool in_corba = (ACE_OS::strcmp (e->get_string (), "CORBA") == 0);
// We search only the decls here, the local types are done
// below as a last resort.
@@ -1136,16 +1136,18 @@ UTL_Scope::lookup_by_name_local (Identifier *e,
i.next ())
{
d = i.item ()->adjust_found (true, full_def_only);
- if (d)
+
+ if (d != 0)
{
Identifier *item_name = d->local_name ();
- if (item_name
+
+ if (item_name != 0
// Right now we populate the global scope with all the CORBA basic
// types, so something like 'ULong' in an IDL file will find a
// match, unless we skip over these items. This is a workaround until
// there's time to fix the code generation for CORBA basic types.
- && (in_corba || ACE_OS::strcmp (
- d->name ()->head ()->get_string (), "CORBA"))
+ && (in_corba
+ || (ACE_OS::strcmp (d->name ()->head ()->get_string (), "CORBA") != 0))
&& e->case_compare (item_name))
{
return d; // We have found the one and only one we are looking for.
diff --git a/TAO/tests/IDL_Test/IDL_Test.mpc b/TAO/tests/IDL_Test/IDL_Test.mpc
index 13d97910bce..d23f339a4e9 100644
--- a/TAO/tests/IDL_Test/IDL_Test.mpc
+++ b/TAO/tests/IDL_Test/IDL_Test.mpc
@@ -84,6 +84,13 @@ project(*IDL): taoserver, messaging, gen_ostream {
typedef.idl
typecode.idl
}
+
+ IDL_Files {
+ // Workaround to get tao_idl to process multiple files in one pass,
+ // since MPC doesn't support it.
+ idlflags += loader_const.idl
+ PEMNaming.idl
+ }
}
project(*DLL): taoidldefaults, taolib, messaging {
@@ -158,6 +165,7 @@ project(*DLL): taoidldefaults, taolib, messaging {
keywordsA.cpp
keywordsC.cpp
keywordsS.cpp
+ loader_constC.cpp
moduleA.cpp
moduleC.cpp
moduleS.cpp
@@ -177,6 +185,8 @@ project(*DLL): taoidldefaults, taolib, messaging {
old_unionS.cpp
paramsC.cpp
paramsS.cpp
+ PEMNamingC.cpp
+ PEMNamingS.cpp
pragmaA.cpp
pragmaC.cpp
pragmaS.cpp
diff --git a/TAO/tests/IDL_Test/PEMNaming.idl b/TAO/tests/IDL_Test/PEMNaming.idl
new file mode 100644
index 00000000000..52069315e1c
--- /dev/null
+++ b/TAO/tests/IDL_Test/PEMNaming.idl
@@ -0,0 +1,61 @@
+
+#ifndef _PEM_NAMING_IDL_
+#define _PEM_NAMING_IDL_
+
+module Plesk
+{
+ typedef long TObjectID;
+
+ enum TBool
+ {
+ TB_NO,
+ TB_YES,
+ TB_MAYBE
+ };
+
+ struct TProperty
+ {
+ string name;
+ string value;
+ };
+
+ typedef sequence<TProperty> TPropertyList;
+
+ exception ExSystem
+ {
+ string module_id;
+ long extype_id;
+ long errcode;
+ long errcode_minor;
+ string errmsg;
+ TPropertyList props;
+ TBool transient;
+ };
+
+ module Naming
+ {
+
+ struct NamingContext
+ {
+ string kernel_resolver_ior;
+ };
+
+ const long ERR_NO_SUCH_OBJ = 6; // don't change it
+ // reserved for Naming
+
+ interface ObjectResolver
+ {
+# pragma version ObjectResolver 1.2
+
+ Object
+ resolve(in string service_type, inout TObjectID sc_id)
+ raises (ExSystem);
+
+ Object
+ resolve_sc(in string service_type, in string version, inout TObjectID sc_id)
+ raises (ExSystem);
+ };
+ }; // module Naming
+}; // module Plesk
+
+#endif // _PEM_NAMING_IDL_
diff --git a/TAO/tests/IDL_Test/loader_const.idl b/TAO/tests/IDL_Test/loader_const.idl
new file mode 100644
index 00000000000..c12c20623ea
--- /dev/null
+++ b/TAO/tests/IDL_Test/loader_const.idl
@@ -0,0 +1,17 @@
+#ifndef _LOADER_CONST_IDL_
+#define _LOADER_CONST_IDL_
+
+// This include caused a crash when another IDL file is processed after
+// this one in one pass. The node in the AST corresponding to the CORBA
+// module where the basic types are declared contained garbage due to
+// subsequent openings in the included file, which are destroyed between
+// files in the list (unlike the one containing the basic types).
+#include <orb.idl>
+
+#pragma prefix ""
+
+module Plesk {
+ const unsigned long PLESK_VENDOR_ID = 40000;
+}; /* module Plesk */
+
+#endif /* _LOADER_CONST_IDL_ */