From 109260f4c483c042c5db16e716229df694817d0a Mon Sep 17 00:00:00 2001 From: parsons Date: Fri, 5 Jan 2007 23:00:17 +0000 Subject: ChangeLogTag: Fri Jan 5 22:51:37 UTC 2007 Jeff Parsons --- TAO/ChangeLog | 27 +++++++++++++++++++++++++++ TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp | 18 ++++++++++++++++-- TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp | 8 ++++++++ TAO/TAO_IDL/fe/idl.ll | 26 +++++++++++++++++++++----- TAO/TAO_IDL/fe/lex.yy.cpp | 26 +++++++++++++++++++++----- TAO/TAO_IDL/include/ast_decl.h | 3 ++- TAO/TAO_IDL/util/utl_global.cpp | 19 ++++++++++++++----- 7 files changed, 109 insertions(+), 18 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index f505567110e..1575d3fcbfd 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,30 @@ +Fri Jan 5 22:51:37 UTC 2007 Jeff Parsons + + * TAO_IDL/include/ast_decl.h: + + Small change to comment. + + * TAO_IDL/fe/lex.yy.cpp: + * TAO_IDL/fe/idl.ll: + * TAO_IDL/util/utl_global.cpp: + + Changed logic of pushing/popping prefixes to/from + the IDL compiler's dedicated stack, to fix a + problem reported by Martin Corino + related to #pragma prefix directives from included + IDL files and how they interact with the IDL + compiler's preprocessor. + + * TAO_IDL/be/be_visitor_amh_pre_proc.cpp: + * TAO_IDL/be/be_visitor_ami_pre_proc.cpp: + + Copied lines of code from the CCM preprocessing + visitor, which ensures that implied IDL nodes + will have the correct repository ids even if + the original node has its prefix modified later + in the IDL file. The same logic is now applied + to the AMI and AMH preprocessing visitors. + Fri Jan 5 18:26:43 UTC 2007 Ciju John * docs/ORBEndpoint.html: diff --git a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp index 232bed31bea..8deb1967180 100644 --- a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp @@ -185,10 +185,16 @@ be_visitor_amh_pre_proc::create_response_handler ( response_handler->set_imported (node->imported ()); response_handler->set_line (node->line ()); response_handler->set_file_name (node->file_name ()); + + // Set repo id to 0, so it will be recomputed on the next access, + // and set the prefix to the node's prefix. All this is + // necessary in case the node's prefix was modified after + // its declaration. + response_handler->AST_Decl::repoID (0); + response_handler->prefix (const_cast (node->prefix ())); + response_handler->gen_fwd_helper_name (); - this->add_rh_node_members (node, response_handler, exception_holder); - return response_handler; } @@ -619,6 +625,14 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node) excep_holder->set_name (excep_holder_name); excep_holder->set_defined_in (node->defined_in ()); + + // Set repo id to 0, so it will be recomputed on the next access, + // and set the prefix to the node's prefix. All this is + // necessary in case the node's prefix was modified after + // its declaration. + excep_holder->AST_Decl::repoID (0); + excep_holder->prefix (const_cast (node->prefix ())); + excep_holder->gen_fwd_helper_name (); // Now our customized valuetype is created, we have to diff --git a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp index 2fca204b7f2..7d4f8b25d67 100644 --- a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp @@ -377,6 +377,14 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node, reply_handler->set_name (reply_handler_name); reply_handler->set_defined_in (s); + + // Set repo id to 0, so it will be recomputed on the next access, + // and set the prefix to the node's prefix. All this is + // necessary in case the node's prefix was modified after + // its declaration. + reply_handler->AST_Decl::repoID (0); + reply_handler->prefix (const_cast (node->prefix ())); + reply_handler->gen_fwd_helper_name (); // Now our customized reply handler is created, we have to diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll index 69a2d313e39..598d764391b 100644 --- a/TAO/TAO_IDL/fe/idl.ll +++ b/TAO/TAO_IDL/fe/idl.ll @@ -570,11 +570,23 @@ idl_store_pragma (char *buf) int status = idl_global->file_prefixes ().find (ext_id, int_id); - if (status == 0 && ACE_OS::strcmp (int_id, "") != 0) + if (status == 0) { - char *trash = 0; - idl_global->pragma_prefixes ().pop (trash); - delete [] trash; + if (ACE_OS::strcmp (int_id, "") != 0) + { + char *trash = 0; + idl_global->pragma_prefixes ().pop (trash); + delete [] trash; + } + else if (depth == 1) + { + // Remove the default "" and bind the new prefix. + (void) idl_global->file_prefixes ().unbind (ext_id); + ext_id = ACE::strnew (ext_id); + int_id = ACE::strnew (new_prefix); + (void) idl_global->file_prefixes ().bind (ext_id, + int_id); + } } UTL_Scope *top_scope = idl_global->scopes ().top (); @@ -587,9 +599,13 @@ idl_store_pragma (char *buf) idl_global->pragma_prefixes ().push (new_prefix); - if (idl_global->in_main_file ()) + if (depth == 1) { idl_global->root ()->prefix (new_prefix); + } + + if (idl_global->in_main_file ()) + { idl_global->root ()->set_imported (false); top_scope->has_prefix (true); } diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp index 94982836c1e..43423a53333 100644 --- a/TAO/TAO_IDL/fe/lex.yy.cpp +++ b/TAO/TAO_IDL/fe/lex.yy.cpp @@ -2775,11 +2775,23 @@ idl_store_pragma (char *buf) int status = idl_global->file_prefixes ().find (ext_id, int_id); - if (status == 0 && ACE_OS::strcmp (int_id, "") != 0) + if (status == 0) { - char *trash = 0; - idl_global->pragma_prefixes ().pop (trash); - delete [] trash; + if (ACE_OS::strcmp (int_id, "") != 0) + { + char *trash = 0; + idl_global->pragma_prefixes ().pop (trash); + delete [] trash; + } + else if (depth == 1) + { + // Remove the default "" and bind the new prefix. + (void) idl_global->file_prefixes ().unbind (ext_id); + ext_id = ACE::strnew (ext_id); + int_id = ACE::strnew (new_prefix); + (void) idl_global->file_prefixes ().bind (ext_id, + int_id); + } } UTL_Scope *top_scope = idl_global->scopes ().top (); @@ -2792,9 +2804,13 @@ idl_store_pragma (char *buf) idl_global->pragma_prefixes ().push (new_prefix); - if (idl_global->in_main_file ()) + if (depth == 1) { idl_global->root ()->prefix (new_prefix); + } + + if (idl_global->in_main_file ()) + { idl_global->root ()->set_imported (false); top_scope->has_prefix (true); } diff --git a/TAO/TAO_IDL/include/ast_decl.h b/TAO/TAO_IDL/include/ast_decl.h index 75425f06ac1..c4f0bd7afe5 100644 --- a/TAO/TAO_IDL/include/ast_decl.h +++ b/TAO/TAO_IDL/include/ast_decl.h @@ -289,7 +289,8 @@ public: protected: // These are not private because they're used by - // be_predefined_type' constructor. + // be_predefined_type' constructor and can be called + // from be_decl. char *repoID_; // Repository ID. diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index bf5b7830f06..dbb5f016cdd 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -1157,9 +1157,7 @@ IDL_GlobalData::update_prefix (char *filename) ACE_CString tmp ("", 0, 0); char *main_filename = this->pd_main_filename->get_string (); -// ACE_CString ext_id (filename); char *prefix = 0; - int status = this->file_prefixes_.find (filename, prefix); if (status == 0) @@ -1189,9 +1187,20 @@ IDL_GlobalData::update_prefix (char *filename) { if (!this->pd_in_main_file) { - char *trash = 0; - this->pragma_prefixes_.pop (trash); - delete [] trash; + status = + this->file_prefixes_.find (this->pd_filename->get_string (), + prefix); + + // This function is called just before we transition to a + // new file at global scope. If there is a non-null prefix + // stored in the table under our not-yet-changed filename, + // pop it. + if (status == 0 && ACE_OS::strcmp (prefix, "") != 0) + { + char *trash = 0; + this->pragma_prefixes_.pop (trash); + delete [] trash; + } } } else -- cgit v1.2.1