diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-05-08 08:20:00 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-05-08 08:20:00 +0000 |
commit | d6983b3503554a2632914644a1d1ab51b3456aed (patch) | |
tree | 88fe67ed2a86fa77666de5ca8cc22d4f476861d1 | |
parent | 5be752fbfa26ffe9463a55aa4166bdee20d17288 (diff) | |
download | ATCD-d6983b3503554a2632914644a1d1ab51b3456aed.tar.gz |
ChangeLogTag:Sun May 8 00:20:50 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
8 files changed, 35 insertions, 25 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index aff866a7a0d..3d1cfeaea27 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -6,13 +6,17 @@ Sun May 8 07:59:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl> Sun May 8 00:20:50 2005 Ossama Othman <ossama@dre.vanderbilt.edu> - * TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp (visit_array): - (visit_sequence): + * TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp: + * TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp: + * TAO_IDL/be/be_visitor_typecode/union_typecode.cpp: + * TAO_IDL/be/be_visitor_typecode/value_typecode.cpp: + * TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h: + * TAO_IDL/be_include/be_visitor_typecode/union_typecode.h: + * TAO_IDL/be_include/be_visitor_typecode/value_typecode.h: - Only generate a TypeCode for the base/content type if the latter - is not defined. Addresses duplicate definitions in the case of - structure containing arrays of structures (not necessarily - recursive). + Fixed duplicate TypeCode generation in cases where + struct/union/valuetype indirectly contained members of the same + type, such as through an array. Sat May 7 20:12:12 2005 Ossama Othman <ossama@dre.vanderbilt.edu> diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp index 80ec1b2d8e3..5e5d47656a7 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp @@ -20,6 +20,7 @@ TAO::be_visitor_struct_typecode::be_visitor_struct_typecode ( be_visitor_context * ctx) : be_visitor_typecode_defn (ctx) , is_recursive_ (false) + , is_nested_ (false) { } @@ -48,7 +49,7 @@ TAO::be_visitor_struct_typecode::visit_structure (be_structure * node) -1); } - if (this->recursion_detect_) + if (this->recursion_detect_ || this->is_nested_) return 0; static bool const is_exception = false; @@ -77,6 +78,7 @@ TAO::be_visitor_struct_typecode::visit (AST_Structure * node, // Exceptions cannot be recursive. // ACE_ASSERT (!is_exception || (is_exception && !this->in_recursion_)); + this->is_nested_ = true; TAO_OutStream & os = *this->ctx_->stream (); 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 5064a9ae6d4..667a7dace1d 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp @@ -625,17 +625,10 @@ be_visitor_typecode_defn::visit_array (be_array *node) // generate typecode for the base type this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED); - AST_Decl::NodeType nt = base->node_type (); - bool const anonymous = - nt == AST_Decl::NT_array - || nt == AST_Decl::NT_sequence - || nt == AST_Decl::NT_string; - // Generate typecode for the base type, being careful to avoid doing // so for a typedef since that could recursively cause multiple base // type TypeCode definitions to be generated. - if (!base || (nt != AST_Decl::NT_typedef - && (anonymous || !base->is_defined ()) + if (!base || (base->node_type () != AST_Decl::NT_typedef && base->accept (this) == -1)) { ACE_ERROR_RETURN ((LM_ERROR, @@ -946,17 +939,10 @@ be_visitor_typecode_defn::visit_sequence (be_sequence * node) // generate typecode for the base type this->ctx_->sub_state (TAO_CodeGen::TAO_TC_DEFN_TYPECODE_NESTED); - AST_Decl::NodeType nt = base->node_type (); - bool const anonymous = - nt == AST_Decl::NT_array - || nt == AST_Decl::NT_sequence - || nt == AST_Decl::NT_string; - // Generate typecode for the base type, being careful to avoid doing // so for a typedef since that could recursively cause multiple base // type TypeCode definitions to be generated. - if (!base || (nt != AST_Decl::NT_typedef - && (anonymous || !base->is_defined ()) + if (!base || (base->node_type () != AST_Decl::NT_typedef && base->accept (this) == -1)) { ACE_ERROR_RETURN ((LM_ERROR, diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp index 37e04977d68..e88b26e6f8b 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp @@ -17,6 +17,7 @@ TAO::be_visitor_union_typecode::be_visitor_union_typecode ( be_visitor_context * ctx) : be_visitor_typecode_defn (ctx) , is_recursive_ (false) + , is_nested_ (false) { } @@ -45,9 +46,11 @@ TAO::be_visitor_union_typecode::visit_union (be_union * node) -1); } - if (this->recursion_detect_) + if (this->recursion_detect_ || this->is_nested_) return 0; + this->is_nested_ = true; + TAO_OutStream & os = *this->ctx_->stream (); os << be_nl << be_nl diff --git a/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp b/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp index ac16564d9e9..8675ee89944 100644 --- a/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp +++ b/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp @@ -20,6 +20,7 @@ TAO::be_visitor_value_typecode::be_visitor_value_typecode ( be_visitor_context * ctx) : be_visitor_typecode_defn (ctx) , is_recursive_ (false) + , is_nested_ (false) { } @@ -48,9 +49,11 @@ TAO::be_visitor_value_typecode::visit_valuetype (be_valuetype * node) -1); } - if (this->recursion_detect_) + if (this->recursion_detect_ || this->is_nested_) return 0; + this->is_nested_ = true; + TAO_OutStream & os = *this->ctx_->stream (); os << be_nl << be_nl diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h index f43c69f161c..41fbb815706 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h +++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h @@ -77,6 +77,10 @@ namespace TAO */ bool is_recursive_; + /// @c true if this visitor is already visiting an outer scope + /// struct or exception + bool is_nested_; + }; } diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/union_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/union_typecode.h index 50a428338bf..9498461479f 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_typecode/union_typecode.h +++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/union_typecode.h @@ -56,6 +56,10 @@ namespace TAO /// @c true if the union is recursive. bool is_recursive_; + /// @c true if this visitor is already visiting an outer scope + /// struct or exception + bool is_nested_; + }; } diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/value_typecode.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/value_typecode.h index 008ceb8eaa4..94f2c0afc60 100644 --- a/TAO/TAO_IDL/be_include/be_visitor_typecode/value_typecode.h +++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/value_typecode.h @@ -56,6 +56,10 @@ namespace TAO /// @c true if the valuetype or eventtype is recursive. bool is_recursive_; + /// @c true if this visitor is already visiting an outer scope + /// struct or exception + bool is_nested_; + }; } |