summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-11-10 16:01:52 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-11-10 16:01:52 +0000
commit94b2749b7d6472d3abc252dbb4be1aaaf2844e19 (patch)
tree9d0eabe98b75b4a7b417882337c4d406fe6b1947
parent89590439505d8e5dff8b4a6badd840237f9ae556 (diff)
downloadATCD-94b2749b7d6472d3abc252dbb4be1aaaf2844e19.tar.gz
ChangeLogTag: Wed Nov 10 09:46:46 2004 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r--TAO/ChangeLog15
-rw-r--r--TAO/TAO_IDL/ast/ast_union.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_union_branch.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp12
4 files changed, 27 insertions, 4 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 24ddb9ea147..00302bdff03 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,18 @@
+Wed Nov 10 09:46:46 2004 Jeff Parsons <j.parsons@vanderbilt.edu>
+
+ * TAO_IDL/ast/ast_union.cpp:
+ * TAO_IDLbe/be_union_branch.cpp:
+ * TAO_IDLbe/be_visitor_union/union_cs.cpp:
+
+ Changed code generation for a union default constructor to
+ set the discriminator to a legal defaul value if there is
+ one, and to the value of the first case label otherwise
+ (previously the behavior in all cases). This new behavior
+ is not required by the spec, but is more in line with the
+ behavior of IDL compilers from other ORB vendors. Thanks
+ to Rohan Mars <rohan_mars@yahoo.com> for sending in the
+ example IDL file.
+
Tue Nov 9 15:35:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl>
* tao/GIOP_Utils.h:
diff --git a/TAO/TAO_IDL/ast/ast_union.cpp b/TAO/TAO_IDL/ast/ast_union.cpp
index 9587fe295b9..f8cd8ccb7b4 100644
--- a/TAO/TAO_IDL/ast/ast_union.cpp
+++ b/TAO/TAO_IDL/ast/ast_union.cpp
@@ -646,7 +646,7 @@ AST_Union::compute_default_value (void)
ACE_NOTREACHED (break;)
} // End of switch
- // If we have determined that we don't need a default case and even then a
+ // If we have determined that we don't have a default case and even then a
// default case was provided, flag this off as error.
if ((this->default_value_.computed_ == 0)
&& (this->default_index () != -1))
diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp
index 006ce84d787..4c67346e028 100644
--- a/TAO/TAO_IDL/be/be_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_union_branch.cpp
@@ -152,7 +152,7 @@ be_union_branch::gen_default_label_value (TAO_OutStream *os,
os->print ("%d", dv.u.char_val);
break;
case AST_Expression::EV_bool:
- *os << dv.u.bool_val;
+ *os << (dv.u.bool_val == 0 ? "false" : "true");
break;
case AST_Expression::EV_enum:
// The discriminant is an enum. Some compilers will
diff --git a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
index f9801d2d421..c7257392ecc 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/union_cs.cpp
@@ -118,8 +118,16 @@ int be_visitor_union_cs::visit_union (be_union *node)
// Get the first label in its list.
AST_UnionLabel *ul = ub->label (0);
-
- if (ul->label_kind () == AST_UnionLabel::UL_label)
+ AST_Union::DefaultValue dv;
+
+ // This can indicate an error in the return value, but it is
+ // caught elsewhere.
+ (void) node->default_value (dv);
+
+ bool test = dv.computed_ == 0
+ && ul->label_kind () == AST_UnionLabel::UL_label;
+
+ if (test)
{
ub->gen_label_value (os);
}