diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-03-16 15:53:16 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-03-16 15:53:16 +0000 |
commit | 97035e22a548ee4c475d7a695cbfc1e67e55eca1 (patch) | |
tree | cbffafc903f404dc6ddccb9ce701e44c6cb06027 | |
parent | 084031d94047f1c6f270c047119aef89b7977467 (diff) | |
download | ATCD-97035e22a548ee4c475d7a695cbfc1e67e55eca1.tar.gz |
ChangeLogTag: Tue Mar 16 09:40:54 2004 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 40 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_decl.cpp | 6 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_interface.cpp | 116 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp | 12 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp | 10 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp | 2 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_decl.h | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_interface.h | 4 | ||||
-rw-r--r-- | TAO/tests/IDL_Test/IDL_Test.mpc | 11 | ||||
-rw-r--r-- | TAO/tests/IDL_Test/namespace_check.cpp | 22 |
14 files changed, 205 insertions, 39 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index f64d9739143..2be24698acd 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,43 @@ +Tue Mar 16 09:40:54 2004 Jeff Parsons <j.parsons@vanderbilt.edu> + + * TAO_IDL/be/be_decl.cpp: + * TAO_IDL be/be_interface.cpp: + * TAO_IDL be/be_visitor_interface/amh_rh_sh.cpp: + * TAO_IDL be/be_visitor_interface/amh_rh_ss.cpp: + * TAO_IDL be/be_visitor_interface/direct_proxy_impl_sh.cpp: + * TAO_IDL be/be_visitor_interface/interface_ch.cpp: + * TAO_IDL be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp: + * TAO_IDL be/be_visitor_valuetype/valuetype_cs.cpp: + * TAO_IDL be/be_visitor_valuetype/valuetype_init_cs.cpp: + * TAO_IDL be_include/be_decl.h: + * TAO_IDL be_include/be_interface.h: + + - Added code generation that redeclares operations that a local + interface has inherited from a non-local one as pure virtual. + Thanks to Gautam Thaker <gthaker@atl.lmco.com> for reporting + the problem. + + - Added '::' prefix to the generation of some fully scoped + names in code generation for AMH-related classes, helping + some compilers that get confused when a namespace name is + repeated at some more deeply nested level. + + - Fixed indentation in code generation of collocation classes + in the skeleton header file. + + * tests/IDL_Test/IDL_Test.mpc: + + Added source files (and thus indirectly the IDL files that + generate them) to the project file. Also removed the source file + namespace_check.cpp, which was originally added as a workaround + for platforms that did not support namespaces. + + * tests/IDL_Test/namespace_check.cpp: + + Removed this file from the repository, since it is a legacy from + the time when ACE+TAO supported compilers that did not support + namespaces. + Thu Jan 06 15:20:39 2000 Balachandran Natarajan <bala@dre.vanderbilt.edu> * tao/TAO.dsp: diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp index 49473a7698e..23f18671df9 100644 --- a/TAO/TAO_IDL/be/be_decl.cpp +++ b/TAO/TAO_IDL/be/be_decl.cpp @@ -277,6 +277,12 @@ be_decl::destroy (void) this->AST_Decl::destroy (); } +void +be_decl::set_local (idl_bool val) +{ + this->is_local_ = val; +} + // Return the scope created by this node (if one exists, else NULL). be_scope * be_decl::scope (void) diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 9a960230867..1acc313ee96 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -643,7 +643,10 @@ TAO_IDL_Inheritance_Hierarchy_Worker::~TAO_IDL_Inheritance_Hierarchy_Worker ( { } -class TAO_IDL_Gen_OpTable_Worker : public TAO_IDL_Inheritance_Hierarchy_Worker +// ================================================================= + +class TAO_IDL_Gen_OpTable_Worker + : public TAO_IDL_Inheritance_Hierarchy_Worker { public: TAO_IDL_Gen_OpTable_Worker (const char *skeleton_name); @@ -656,8 +659,9 @@ private: const char *skeleton_name_; }; -TAO_IDL_Gen_OpTable_Worker:: -TAO_IDL_Gen_OpTable_Worker (const char *skeleton_name) +TAO_IDL_Gen_OpTable_Worker::TAO_IDL_Gen_OpTable_Worker ( + const char *skeleton_name + ) : skeleton_name_ (skeleton_name) { } @@ -675,6 +679,81 @@ TAO_IDL_Gen_OpTable_Worker::emit (be_interface *derived_interface, os); } +// ================================================================= + +class Pure_Virtual_Regenerator + : public TAO_IDL_Inheritance_Hierarchy_Worker +{ +public: + Pure_Virtual_Regenerator (be_visitor *visitor); + + virtual int emit (be_interface *derived_interface, + TAO_OutStream *os, + be_interface *base_interface); + +private: + be_visitor *visitor_; +}; + +Pure_Virtual_Regenerator::Pure_Virtual_Regenerator ( + be_visitor *visitor + ) + : visitor_ (visitor) +{ +} + +// We don't use the output stream in the signature but instead +// pass the visitor member (which is always be_visitor_operation_ch) +// to each iterator item, and (almost, see below) everything else +// is automatic. +int +Pure_Virtual_Regenerator::emit (be_interface *derived_interface, + TAO_OutStream *, + be_interface *base_interface) +{ + if (derived_interface == base_interface) + { + return 0; + } + + // A parent that's local will already have its operations declared + // as pure virtual. + if (base_interface->is_local ()) + { + return 0; + } + + be_decl *d = 0; + + for (UTL_ScopeActiveIterator si (base_interface, UTL_Scope::IK_decls); + !si.is_done (); + si.next ()) + { + d = be_decl::narrow_from_decl (si.item ()); + + if (d->node_type () == AST_Decl::NT_op) + { + // Hack to force the generation of the pure virtual ' = 0' + // at the end of the operation declaration. + d->set_local (I_TRUE); + + if (d->accept (this->visitor_) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) Pure_Virtual_Regenerator::emit - " + "visit base interface operation failed\n"), + -1); + } + + d->set_local (I_FALSE); + } + } + + return 0; +} + +// ================================================================= + int be_interface::gen_operation_table (const char *flat_name, const char *skeleton_class_name) @@ -910,6 +989,37 @@ be_interface::gen_operation_table (const char *flat_name, return 0; } +int +be_interface::convert_parent_ops (be_visitor *visitor) +{ + // Make sure the queues are empty. + this->insert_queue.reset (); + this->del_queue.reset (); + + // Insert ourselves in the queue. + if (insert_queue.enqueue_tail (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_interface::convert_parent_ops - " + "error generating entries\n"), + -1); + } + + // Traverse the graph. + Pure_Virtual_Regenerator worker (visitor); + + if (this->traverse_inheritance_graph (worker, 0) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_interface::" + "convert_parent_ops - " + "codegen for base class operations failed\n"), + -1); + } + + return 0; +} + // Output the header (type declaration and %%) to the gperf's input // file. void diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp index 2633b1bc693..26e93763e90 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_sh.cpp @@ -72,7 +72,7 @@ be_visitor_amh_rh_interface_sh::visit_interface (be_interface *node) *os << "class " << be_global->skel_export_macro () << " " << rh_skel_class_name.c_str () << be_idt_nl << ": public " << inherit_tao_parent.c_str () << "," << be_idt_nl - << "public " << inherit_client_parent.c_str () << be_uidt << be_uidt; + << "public ::" << inherit_client_parent.c_str () << be_uidt << be_uidt; *os << be_nl << "{" << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp index 5fbc9db05cf..92cab622efc 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_rh_ss.cpp @@ -75,7 +75,7 @@ be_visitor_amh_rh_interface_ss::visit_interface (be_interface *node) << "TAO_ServerRequest &sr" << be_uidt_nl << ")" << be_nl << ": TAO_AMH_Response_Handler (sr)," << be_idt_nl - << node->full_name () << " ()" << be_uidt << be_uidt_nl + << "::" << node->full_name () << " ()" << be_uidt << be_uidt_nl << "{" << be_nl << "}" << be_nl << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp index 25c0ba626b2..f75b2c26159 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/direct_proxy_impl_sh.cpp @@ -60,7 +60,8 @@ be_visitor_interface_direct_proxy_impl_sh::visit_interface ( if (first_concrete) { - *os << be_nl << " : " << be_idt << be_idt; + *os << be_nl + << " : " << be_idt << be_idt; } else { @@ -72,11 +73,12 @@ be_visitor_interface_direct_proxy_impl_sh::visit_interface ( *os << "public virtual ::" << inherited->full_direct_proxy_impl_name (); } - } - *os << be_uidt << be_uidt_nl; + *os << be_uidt << be_uidt; + } - *os << "{" << be_nl << "public:" << be_idt_nl; + *os << be_nl + << "{" << be_nl << "public:" << be_idt_nl; // Ctor *os << node->direct_proxy_impl_name () << " (void);" << be_nl << be_nl; @@ -110,7 +112,7 @@ be_visitor_interface_direct_proxy_impl_sh::visit_interface ( -1); } - *os << be_uidt << be_uidt_nl + *os << be_uidt_nl << "};" << be_nl << be_nl << "//" << be_nl << "// Direct Proxy Impl. Declaration" << be_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 92827afccd5..f6d6df4ba27 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ch.cpp @@ -191,6 +191,18 @@ be_visitor_interface_ch::visit_interface (be_interface *node) "codegen for scope failed\n"), -1); } + + if (node->is_local ()) + { + if (node->convert_parent_ops (this) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_visitor_interface_ch::" + "visit_interface - " + "converting parent ops failed\n"), + -1); + } + } *os << be_nl << be_nl << "// TAO_IDL - Generated from" << be_nl << "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl; diff --git a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp index c83fc7cd61f..66a2301d163 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/thru_poa_proxy_impl_sh.cpp @@ -60,7 +60,8 @@ be_visitor_interface_thru_poa_proxy_impl_sh::visit_interface ( if (first_concrete) { - *os << be_nl << " : " << be_idt << be_idt; + *os << be_nl + << " : " << be_idt << be_idt; } else { @@ -72,11 +73,12 @@ be_visitor_interface_thru_poa_proxy_impl_sh::visit_interface ( *os << "public virtual ::" << inherited->full_thru_poa_proxy_impl_name (); } + + *os << be_uidt << be_uidt; } - *os << be_uidt << be_uidt_nl; - - *os << "{" << be_nl + *os << be_nl + << "{" << be_nl << "public:" << be_idt_nl; // Ctor diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp index acb795f2702..0298f50a010 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_cs.cpp @@ -110,7 +110,7 @@ be_visitor_valuetype_cs::visit_valuetype (be_valuetype *node) << "{" << be_idt_nl << "return 0;" << be_uidt_nl << "}" << be_uidt_nl << be_nl - << "return dynamic_cast<" << node->name () << " *> (v);" << be_uidt_nl + << "return dynamic_cast<::" << node->name () << " *> (v);" << be_uidt_nl << "}" << be_nl << be_nl; // The _tao_obv_repository_id method. diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp index 8b81ec57925..ec4d577b172 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype_init_cs.cpp @@ -98,7 +98,7 @@ be_visitor_valuetype_init_cs::visit_valuetype (be_valuetype *node) << "const char* " << be_nl << fname << "::tao_repository_id (void)" << be_nl << "{" << be_idt_nl - << "return " << node->full_name () + << "return ::" << node->full_name () << "::_tao_obv_static_repository_id ();" << be_uidt_nl << "}"; diff --git a/TAO/TAO_IDL/be_include/be_decl.h b/TAO/TAO_IDL/be_include/be_decl.h index 14ff73abc96..6f0f505d82c 100644 --- a/TAO/TAO_IDL/be_include/be_decl.h +++ b/TAO/TAO_IDL/be_include/be_decl.h @@ -70,6 +70,9 @@ public: virtual void destroy (void); // Cleanup function. + + void set_local (idl_bool val); + // Temporarily set this node's is_local_ flag. // Boolean methods to test if code was already generated. idl_bool cli_hdr_gen (void); diff --git a/TAO/TAO_IDL/be_include/be_interface.h b/TAO/TAO_IDL/be_include/be_interface.h index c918c613d5b..28bd3c303b5 100644 --- a/TAO/TAO_IDL/be_include/be_interface.h +++ b/TAO/TAO_IDL/be_include/be_interface.h @@ -303,6 +303,10 @@ public: const char *full_skeleton_name, TAO_OutStream *os); // generate the operation table entries. + + int convert_parent_ops (be_visitor *visitor); + // If we are local, regenerate non-local base class operations as + // pure virtual. static void gen_collocated_skel_body (be_interface *derived, be_interface *ancestor, diff --git a/TAO/tests/IDL_Test/IDL_Test.mpc b/TAO/tests/IDL_Test/IDL_Test.mpc index 7fd44af256a..5f202e7ece3 100644 --- a/TAO/tests/IDL_Test/IDL_Test.mpc +++ b/TAO/tests/IDL_Test/IDL_Test.mpc @@ -31,8 +31,18 @@ project(*Main): taoserver, messaging { interfaceS.cpp keywordsC.cpp keywordsS.cpp + nested_scopeC.cpp + nested_scopeS.cpp + paramsC.cpp + paramsS.cpp pragmaC.cpp pragmaS.cpp + reopened_modulesC.cpp + reopened_modulesS.cpp + reopen_include1C.cpp + reopen_include1S.cpp + reopen_include2C.cpp + reopen_include2S.cpp sequenceC.cpp sequenceS.cpp typedefC.cpp @@ -41,7 +51,6 @@ project(*Main): taoserver, messaging { unionS.cpp repo_id_modC.cpp repo_id_modS.cpp - namespace_check.cpp main.cpp } } diff --git a/TAO/tests/IDL_Test/namespace_check.cpp b/TAO/tests/IDL_Test/namespace_check.cpp deleted file mode 100644 index 787da1d0328..00000000000 --- a/TAO/tests/IDL_Test/namespace_check.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/tests/IDL_Test -// -// = FILENAME -// namespace_check.cpp -// -// = DESCRIPTION -// Contains conditional include of generated code which contains -// reopened and/or nested modules, for platforms without -// namespaces. -// -// = AUTHORS -// Jeff Parsons <parsons@cs.wustl.edu>. -// -// ============================================================================ - - -#include "ace/OS.h" |