summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog21
-rw-r--r--TAO/TAO_IDL/ast/ast_union.cpp62
-rw-r--r--TAO/TAO_IDL/be/be_helper.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_union_branch.cpp9
-rw-r--r--TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp7
-rw-r--r--TAO/TAO_IDL/be_include/be_helper.h2
-rw-r--r--TAO/TAO_IDL/include/ast_union.h3
-rw-r--r--TAO/tests/Bug_3311_Regression/Bug_3311_Regression.mpc10
-rw-r--r--TAO/tests/Bug_3311_Regression/README3
-rw-r--r--TAO/tests/Bug_3311_Regression/test.cpp8
-rw-r--r--TAO/tests/Bug_3311_Regression/test.idl22
11 files changed, 123 insertions, 26 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 15c1e3842a3..576c8bf8387 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,10 +1,29 @@
+Tue Apr 29 15:17:52 UTC 2008 Simon McQueen <sm@prismtech.com>
+
+ * TAO_IDL/ast/ast_union.cpp:
+ * TAO_IDL/be/be_helper.cpp:
+ * TAO_IDL/be/be_union_branch.cpp:
+ * TAO_IDL/be/be_visitor_union/discriminant_ci.cpp:
+ * TAO_IDL/be_include/be_helper.h:
+ * TAO_IDL/include/ast_union.h:
+
+ Add support for (unsigned) long long union discriminators.
+
+ * tests/Bug_3311_Regression:
+ * tests/Bug_3311_Regression/Bug_3311_Regression.mpc:
+ * tests/Bug_3311_Regression/README:
+ * tests/Bug_3311_Regression/test.idl:
+ * tests/Bug_3311_Regression/test.cpp:
+
+ Regression test for the above.
+
Mon Apr 28 19:38:08 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu>
* tao/Monitor/Monitor.h:
* tao/Monitor/Monitor.cpp:
* tao/Monitor/Monitor_Impl.h:
* tao/Monitor/Monitor_Impl.cpp:
-
+
Added TAO_HAS_MONITOR_FRAMEWORK guards around these files.
Mon Apr 28 17:57:32 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl>
diff --git a/TAO/TAO_IDL/ast/ast_union.cpp b/TAO/TAO_IDL/ast/ast_union.cpp
index 3aec9e1b973..cdb1bb87de7 100644
--- a/TAO/TAO_IDL/ast/ast_union.cpp
+++ b/TAO/TAO_IDL/ast/ast_union.cpp
@@ -157,6 +157,12 @@ AST_Union::AST_Union (AST_ConcreteType *dt,
case AST_PredefinedType::PT_ulong:
this->pd_udisc_type = AST_Expression::EV_ulong;
break;
+ case AST_PredefinedType::PT_longlong:
+ this->pd_udisc_type = AST_Expression::EV_longlong;
+ break;
+ case AST_PredefinedType::PT_ulonglong:
+ this->pd_udisc_type = AST_Expression::EV_ulonglong;
+ break;
case AST_PredefinedType::PT_short:
this->pd_udisc_type = AST_Expression::EV_short;
break;
@@ -523,7 +529,12 @@ AST_Union::compute_default_value (void)
// values of the discriminant type are covered by the cases.
// Compute the total true "case" labels i.e., exclude the "default" case.
- int total_case_members = 0;
+ ACE_UINT64 total_case_members = 0;
+
+ // In the case of a (unsigned) long long discriminant being fully used
+ // the total case count would actually overflow back to zero.
+ // This is 'end of days' programming but what the heck. We're here now.
+ bool first_case_found = false;
// Instantiate a scope iterator.
for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
@@ -542,6 +553,7 @@ AST_Union::compute_default_value (void)
if (ub->label (i)->label_kind () == AST_UnionLabel::UL_label)
{
++total_case_members;
+ first_case_found = true;
}
}
}
@@ -566,7 +578,7 @@ AST_Union::compute_default_value (void)
break;
case AST_Expression::EV_long:
case AST_Expression::EV_ulong:
- if ((unsigned int) total_case_members > ACE_UINT32_MAX)
+ if (total_case_members > ACE_UINT32_MAX)
{
this->default_value_.computed_ = 0;
}
@@ -574,17 +586,13 @@ AST_Union::compute_default_value (void)
break;
case AST_Expression::EV_longlong:
case AST_Expression::EV_ulonglong:
- // Error for now.
- this->default_value_.computed_ = -1;
- ACE_ERROR_RETURN ((
- LM_ERROR,
- ACE_TEXT ("(%N:%l) AST_Union::compute_default_value ")
- ACE_TEXT ("- unimplemented discriminant type ")
- ACE_TEXT ("(longlong or ulonglong)\n")
- ),
- -1
- );
- ACE_NOTREACHED (break;)
+ // We would wrap to 0 here - we are using a 64 bit count
+ if (first_case_found && total_case_members == 0)
+ {
+ // If anyone ever produces a "default clause is invalid here" error
+ // after passing through here I will buy them a a house.
+ this->default_value_.computed_ = 0;
+ }
case AST_Expression::EV_char:
if (total_case_members == ACE_OCTET_MAX + 1)
{
@@ -621,7 +629,7 @@ AST_Union::compute_default_value (void)
if (en != 0)
{
- if (total_case_members == en->member_count ())
+ if (total_case_members == (ACE_UINT64) en->member_count ())
{
this->default_value_.computed_ = 0;
}
@@ -706,8 +714,11 @@ AST_Union::compute_default_value (void)
this->default_value_.u.enum_val = 0;
break;
case AST_Expression::EV_longlong:
+ this->default_value_.u.longlong_val = 0;
+ break;
case AST_Expression::EV_ulonglong:
- // Unimplemented.
+ this->default_value_.u.ulonglong_val = 0;
+ break;
default:
// Error caught earlier.
break;
@@ -833,8 +844,27 @@ AST_Union::compute_default_value (void)
break;
case AST_Expression::EV_longlong:
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (this->default_value_.u.longlong_val
+ == expr->ev ()->u.llval)
+ {
+ this->default_value_.u.longlong_val++;
+ break_loop = 1;
+ }
+
+ break;
+#endif
case AST_Expression::EV_ulonglong:
- // Unimplemented. right now - flag as error.
+#if ! defined (ACE_LACKS_LONGLONG_T)
+ if (this->default_value_.u.ulonglong_val
+ == expr->ev ()->u.ullval)
+ {
+ this->default_value_.u.ulonglong_val++;
+ break_loop = 1;
+ }
+
+ break;
+#endif
default:
// Error.
break;
diff --git a/TAO/TAO_IDL/be/be_helper.cpp b/TAO/TAO_IDL/be/be_helper.cpp
index 6b6518a7d38..a4aa5c1b5aa 100644
--- a/TAO/TAO_IDL/be/be_helper.cpp
+++ b/TAO/TAO_IDL/be/be_helper.cpp
@@ -361,7 +361,6 @@ TAO_OutStream::operator<< (const ACE_CDR::Long num)
return *this;
}
-#if defined (ACE_WIN64)
TAO_OutStream &
TAO_OutStream::operator<< (const ACE_CDR::ULongLong num)
{
@@ -381,7 +380,6 @@ TAO_OutStream::operator<< (const ACE_CDR::LongLong num)
return *this;
}
-#endif /* ACE_WIN64 */
TAO_OutStream &
TAO_OutStream::operator<< (const unsigned long num)
diff --git a/TAO/TAO_IDL/be/be_union_branch.cpp b/TAO/TAO_IDL/be/be_union_branch.cpp
index 61f8e53f79d..aab57f0735c 100644
--- a/TAO/TAO_IDL/be/be_union_branch.cpp
+++ b/TAO/TAO_IDL/be/be_union_branch.cpp
@@ -28,8 +28,8 @@
#include "ast_union_label.h"
#include "ace/Log_Msg.h"
-ACE_RCSID (be,
- be_union_branch,
+ACE_RCSID (be,
+ be_union_branch,
"$Id$")
be_union_branch::be_union_branch (void)
@@ -171,8 +171,11 @@ be_union_branch::gen_default_label_value (TAO_OutStream *os,
break;
}
case AST_Expression::EV_longlong:
+ *os << dv.u.longlong_val;
+ break;
case AST_Expression::EV_ulonglong:
- // Unimplemented.
+ *os << dv.u.ulonglong_val;
+ break;
default:
// Error caught earlier.
ACE_ERROR_RETURN ((LM_ERROR,
diff --git a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
index 2d3c9e0f119..1b5c70a3a50 100644
--- a/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
@@ -205,8 +205,13 @@ be_visitor_union_discriminant_ci::visit_predefined_type (
break;
case AST_Expression::EV_longlong:
+ *os << dv.u.longlong_val;
+
+ break;
case AST_Expression::EV_ulonglong:
- // Unimplemented.
+ *os << dv.u.ulonglong_val;
+
+ break;
default:
// Error caught earlier.
ACE_ERROR_RETURN ((LM_ERROR,
diff --git a/TAO/TAO_IDL/be_include/be_helper.h b/TAO/TAO_IDL/be_include/be_helper.h
index 5e1084712e2..458380ad543 100644
--- a/TAO/TAO_IDL/be_include/be_helper.h
+++ b/TAO/TAO_IDL/be_include/be_helper.h
@@ -175,13 +175,11 @@ public:
TAO_OutStream &operator<< (const ACE_CDR::Long num);
// output the integer and return a reference to ourselves
-#if defined (ACE_WIN64)
TAO_OutStream &operator<< (const ACE_CDR::ULongLong num);
// output the integer and return a reference to ourselves
TAO_OutStream &operator<< (const ACE_CDR::LongLong num);
// output the integer and return a reference to ourselves
-#endif /* ACE_WIN64 */
TAO_OutStream &operator<< (const unsigned long num);
// output the integer and return a reference to ourselves
diff --git a/TAO/TAO_IDL/include/ast_union.h b/TAO/TAO_IDL/include/ast_union.h
index 40678e24f23..0db54351bd7 100644
--- a/TAO/TAO_IDL/include/ast_union.h
+++ b/TAO/TAO_IDL/include/ast_union.h
@@ -122,7 +122,8 @@ public:
ACE_INT32 long_val;
ACE_UINT32 ulong_val;
ACE_UINT32 enum_val;
- // TO-DO - handle (u)longlong types.
+ ACE_INT64 longlong_val;
+ ACE_UINT64 ulonglong_val;
} u;
long computed_;
// computed == -1 => error condition
diff --git a/TAO/tests/Bug_3311_Regression/Bug_3311_Regression.mpc b/TAO/tests/Bug_3311_Regression/Bug_3311_Regression.mpc
new file mode 100644
index 00000000000..bfe0e4b0ca1
--- /dev/null
+++ b/TAO/tests/Bug_3311_Regression/Bug_3311_Regression.mpc
@@ -0,0 +1,10 @@
+// -*- MPC -*-
+// $Id$
+
+project(*Test) : taoserver {
+ exename = test
+
+ Source_Files {
+ test.cpp
+ }
+}
diff --git a/TAO/tests/Bug_3311_Regression/README b/TAO/tests/Bug_3311_Regression/README
new file mode 100644
index 00000000000..c9b81b727d2
--- /dev/null
+++ b/TAO/tests/Bug_3311_Regression/README
@@ -0,0 +1,3 @@
+# $Id$
+
+This is a compile only test. If it compiles, it's passed. It tests that you can have a union with long long or unsigned long long discriminant.
diff --git a/TAO/tests/Bug_3311_Regression/test.cpp b/TAO/tests/Bug_3311_Regression/test.cpp
new file mode 100644
index 00000000000..68acdde0f3b
--- /dev/null
+++ b/TAO/tests/Bug_3311_Regression/test.cpp
@@ -0,0 +1,8 @@
+// $Id$
+
+#include "testS.h"
+
+int main (int, char*[])
+{
+ return 0;
+}
diff --git a/TAO/tests/Bug_3311_Regression/test.idl b/TAO/tests/Bug_3311_Regression/test.idl
new file mode 100644
index 00000000000..fed69c82366
--- /dev/null
+++ b/TAO/tests/Bug_3311_Regression/test.idl
@@ -0,0 +1,22 @@
+// $Id$
+
+// Oh ho, oh ho, what are we gonna do?
+union CityBlue
+ switch (unsigned long long)
+{
+ case 1:
+ long ucb_long;
+ default:
+ short ucb_short;
+};
+
+// Power, passion, plays a double hand
+union CityMan
+ switch (long long)
+{
+ case 1:
+ long ucm_long;
+ default:
+ short ucm_short;
+};
+