summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2005-05-07 17:35:12 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2005-05-07 17:35:12 +0000
commit64c261755f85da3c6a37dfb9a188363fa7ec1070 (patch)
treeee916f830d8a38e18f73731f709b16f2cb432d55
parent1a25a22f64e61a6a2249ffec08f75ed9881d1181 (diff)
downloadATCD-64c261755f85da3c6a37dfb9a188363fa7ec1070.tar.gz
ChangeLogTag:Sat May 7 10:33:21 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
-rw-r--r--TAO/ChangeLog15
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp27
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp6
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp24
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp23
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/struct_typecode.h8
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h16
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/union_typecode.h4
-rw-r--r--TAO/TAO_IDL/be_include/be_visitor_typecode/value_typecode.h4
9 files changed, 74 insertions, 53 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 4f4855ded6e..bb8a388d1c8 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,18 @@
+Sat May 7 10:33:21 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
+
+ * 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/typecode_defn.h:
+ * TAO_IDL/be_include/be_visitor_typecode/union_typecode.h:
+ * TAO_IDL/be_include/be_visitor_typecode/value_typecode.h:
+
+ Fixed duplicate generation of TypeCodes.
+
+ Fixed false positives in recursive type detection.
+
Sat May 7 11:13:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
* orbsvcs/tests/InterfaceRepo/Persistence_Test/svc.conf:
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 acf9272f7e7..608fcf86091 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/struct_typecode.cpp
@@ -19,7 +19,6 @@
TAO::be_visitor_struct_typecode::be_visitor_struct_typecode (
be_visitor_context * ctx)
: be_visitor_typecode_defn (ctx)
- , in_recursion_ (false)
, is_recursive_ (false)
{
}
@@ -30,21 +29,28 @@ TAO::be_visitor_struct_typecode::visit_structure (be_structure * node)
if (!node->is_defined ())
return this->gen_forward_declared_typecode (node);
- if (this->in_recursion_)
- {
- // This works because the same visitor instance is used for the
- // top-level TypeCode and the indirected TypeCode in the member
- // containing the recursive type (e.g. an anonymous sequence).
+ // Check if we are repeated.
+ be_visitor_typecode_defn::QNode const * const qnode =
+ this->queue_lookup (this->tc_queue_, node);
+ if (qnode)
+ {
this->is_recursive_ = true;
return 0;
}
- else
+ else if (this->queue_insert (this->tc_queue_, node, 0) == 0)
{
- this->in_recursion_ = true;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typecode_defn::"
+ "visit_type - "
+ "queue insert failed\n"),
+ -1);
}
+ if (this->recursion_detect_)
+ return 0;
+
static bool const is_exception = false;
return this->visit (node, is_exception);
@@ -53,6 +59,9 @@ TAO::be_visitor_struct_typecode::visit_structure (be_structure * node)
int
TAO::be_visitor_struct_typecode::visit_exception (be_exception * node)
{
+ if (this->recursion_detect_)
+ return 0;
+
// No need to check for recursion since exceptions are never
// recursive.
@@ -66,7 +75,7 @@ TAO::be_visitor_struct_typecode::visit (AST_Structure * node,
bool is_exception)
{
// Exceptions cannot be recursive.
- ACE_ASSERT (!is_exception || (is_exception && !this->in_recursion_));
+// ACE_ASSERT (!is_exception || (is_exception && !this->in_recursion_));
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 4308a82c785..ce22e3c14bf 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/typecode_defn.cpp
@@ -1063,7 +1063,7 @@ be_visitor_typecode_defn::visit_structure (be_structure * node)
}
int
-be_visitor_typecode_defn::visit_typedef (be_typedef *node)
+be_visitor_typecode_defn::visit_typedef (be_typedef * node)
{
// Only used for recursion detection.
@@ -1071,10 +1071,10 @@ be_visitor_typecode_defn::visit_typedef (be_typedef *node)
// visited are strings and sequences. All others have their own
// full-fledged visitors (e.g. objref_typecode, etc.)
- this->recursion_detect_ = true;
-
be_type * const base = be_type::narrow_from_decl (node->base_type ());
+ this->recursion_detect_ = true;
+
// Generate typecode for the base type, being careful to avoid doing
// so a for a typedef since that could recursively cause multiple
// base type TypeCode definitions to be generated.
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 0d252952277..9ab3351a5ff 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/union_typecode.cpp
@@ -16,7 +16,6 @@
TAO::be_visitor_union_typecode::be_visitor_union_typecode (
be_visitor_context * ctx)
: be_visitor_typecode_defn (ctx)
- , in_recursion_ (false)
, is_recursive_ (false)
{
}
@@ -27,21 +26,28 @@ TAO::be_visitor_union_typecode::visit_union (be_union * node)
if (!node->is_defined ())
return this->gen_forward_declared_typecode (node);
- if (this->in_recursion_)
- {
- // This works because the same visitor instance is used for the
- // top-level TypeCode and the indirected TypeCode in the member
- // containing the recursive type (e.g. an anonymous sequence).
+ // Check if we are repeated.
+ be_visitor_typecode_defn::QNode const * const qnode =
+ this->queue_lookup (this->tc_queue_, node);
+ if (qnode)
+ {
this->is_recursive_ = true;
return 0;
}
- else
+ else if (this->queue_insert (this->tc_queue_, node, 0) == 0)
{
- this->in_recursion_ = true;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typecode_defn::"
+ "visit_type - "
+ "queue insert failed\n"),
+ -1);
}
+ if (this->recursion_detect_)
+ return 0;
+
TAO_OutStream & os = *this->ctx_->stream ();
os << be_nl << be_nl
@@ -103,8 +109,6 @@ TAO::be_visitor_union_typecode::visit_union (be_union * node)
<< node->default_index () << ");" << be_uidt_nl
<< be_uidt_nl;
- // this->in_recursion_ = false;
-
return
this->gen_typecode_ptr (be_type::narrow_from_decl (node));
}
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 0712c23671b..6f90c834f1e 100644
--- a/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_typecode/value_typecode.cpp
@@ -19,7 +19,6 @@
TAO::be_visitor_value_typecode::be_visitor_value_typecode (
be_visitor_context * ctx)
: be_visitor_typecode_defn (ctx)
- , in_recursion_ (false)
, is_recursive_ (false)
{
}
@@ -30,28 +29,34 @@ TAO::be_visitor_value_typecode::visit_valuetype (be_valuetype * node)
if (!node->is_defined ())
return this->gen_forward_declared_typecode (node);
- if (this->in_recursion_)
- {
- // This works because the same visitor instance is used for the
- // top-level TypeCode and the indirected TypeCode in the member
- // containing the recursive type (e.g. an anonymous sequence).
+ // Check if we are repeated.
+ be_visitor_typecode_defn::QNode const * const qnode =
+ this->queue_lookup (this->tc_queue_, node);
+ if (qnode)
+ {
this->is_recursive_ = true;
return 0;
}
- else
+ else if (this->queue_insert (this->tc_queue_, node, 0) == 0)
{
- this->in_recursion_ = true;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "(%N:%l) be_visitor_typecode_defn::"
+ "visit_type - "
+ "queue insert failed\n"),
+ -1);
}
+ if (this->recursion_detect_)
+ return 0;
+
TAO_OutStream & os = *this->ctx_->stream ();
os << be_nl << be_nl
<< "// TAO_IDL - Generated from" << be_nl
<< "// " << __FILE__ << ":" << __LINE__ << be_nl << be_nl;
-
if (this->gen_member_typecodes (node) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
"TAO::be_visitor_value_typecode::visit_valuetype - "
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 c0b8bce7769..f43c69f161c 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
@@ -70,14 +70,6 @@ namespace TAO
private:
- /// @c true if a struct TypeCode is already being generated using
- /// this visitor.
- /**
- * @note Only applies for struct TypeCodes. Exceptions cannot be
- * recursive.
- */
- bool in_recursion_;
-
/// @c true if the struct is recursive.
/**
* @note Only applies for struct TypeCodes. Exceptions cannot be
diff --git a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h
index e97ea40da5b..713fd5e7a60 100644
--- a/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h
+++ b/TAO/TAO_IDL/be_include/be_visitor_typecode/typecode_defn.h
@@ -297,13 +297,18 @@ protected:
*/
bool is_typecode_generation_required (be_type * node);
-private:
- //
- friend class Scoped_Compute_Queue_Guard;
+protected:
+
+ /// Queue to keep nodes
+ ACE_Unbounded_Queue <QNode*> tc_queue_;
/// @c true if we are detecting recursion.
bool recursion_detect_;
+private:
+ //
+ friend class Scoped_Compute_Queue_Guard;
+
ACE_CDR::Long computed_tc_size_;
// the tc size of the node under consideration
@@ -318,9 +323,6 @@ private:
ACE_CDR::Long tc_offset_;
// current computed length of the typecode
- ACE_Unbounded_Queue <QNode*> tc_queue_;
- // queue to keep nodes
-
ACE_Unbounded_Queue <QNode*> compute_queue_;
// queue to keep nodes
@@ -335,6 +337,8 @@ private:
int pop (ACE_CDR::Long &);
+protected:
+
// queue related routines
const QNode *queue_insert (ACE_Unbounded_Queue <QNode*> &,
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 25be2ddfa98..50a428338bf 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
@@ -53,10 +53,6 @@ namespace TAO
private:
- /// @c true if a union TypeCode is already being generated using
- /// this visitor.
- bool in_recursion_;
-
/// @c true if the union is recursive.
bool is_recursive_;
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 25cd8381fa0..008ceb8eaa4 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
@@ -53,10 +53,6 @@ namespace TAO
private:
- /// @c true if a {value,event}type TypeCode is already being
- /// generated using this visitor.
- bool in_recursion_;
-
/// @c true if the valuetype or eventtype is recursive.
bool is_recursive_;