From 860746a594bf7bd04ee2501a8d8b5c7d678934c7 Mon Sep 17 00:00:00 2001 From: Fred Hornsey Date: Thu, 8 Jul 2021 17:26:09 -0500 Subject: [PATCH] Attempt to Fix Coverity Issues from #840 https://github.com/DOCGroup/ACE_TAO/pull/840 Because the main set of issues in `coerce_value` was caused by applying the existing pattern, the issues caused by the existing code should also be fixed. --- ACE/ace/Basic_Types.h | 2 + TAO/TAO_IDL/ast/ast_expression.cpp | 891 ++++++++++++--------------- TAO/TAO_IDL/be/be_sequence.cpp | 6 + TAO/TAO_IDL/include/ast_expression.h | 5 +- 4 files changed, 392 insertions(+), 512 deletions(-) diff --git a/ACE/ace/Basic_Types.h b/ACE/ace/Basic_Types.h index ac7a13116e358..8ef1b265d6472 100644 --- a/ACE/ace/Basic_Types.h +++ b/ACE/ace/Basic_Types.h @@ -686,8 +686,10 @@ ACE_END_VERSIONED_NAMESPACE_DECL // These use ANSI/IEEE format. #define ACE_FLT_MAX 3.402823466e+38F #define ACE_FLT_MIN 1.175494351e-38F +#define ACE_FLT_LOWEST -(ACE_FLT_MAX) #define ACE_DBL_MAX 1.7976931348623158e+308 #define ACE_DBL_MIN 2.2250738585072014e-308 +#define ACE_DBL_LOWEST -(ACE_DBL_MAX) # include /**/ "ace/post.h" #endif /* ACE_BASIC_TYPES_H */ diff --git a/TAO/TAO_IDL/ast/ast_expression.cpp b/TAO/TAO_IDL/ast/ast_expression.cpp index 0e819de9e51da..6fd259cafa465 100644 --- a/TAO/TAO_IDL/ast/ast_expression.cpp +++ b/TAO/TAO_IDL/ast/ast_expression.cpp @@ -572,39 +572,39 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return ev; } + // Avoid Coverity issue with "Assignment of overlapping memory" by using a + // temporary value and setting ev->u at the end if there wasn't an error. + AST_Expression::AST_ExprValue::Value tmp; switch (t) { case AST_Expression::EV_short: switch (ev->et) { case AST_Expression::EV_ushort: - if (ev->u.usval > (unsigned short) ACE_INT16_MAX) + if (ev->u.usval > (ACE_CDR::UShort) ACE_INT16_MAX) { return 0; } - ev->u.sval = (short) ev->u.usval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.usval; + break; case AST_Expression::EV_long: - if (ev->u.lval > (long) ACE_INT16_MAX - || ev->u.lval < (long) ACE_INT16_MIN) + if (ev->u.lval > (ACE_CDR::Long) ACE_INT16_MAX + || ev->u.lval < (ACE_CDR::Long) ACE_INT16_MIN) { return 0; } - ev->u.sval = (short) ev->u.lval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.lval; + break; case AST_Expression::EV_ulong: - if (ev->u.ulval > (unsigned long) ACE_INT16_MAX) + if (ev->u.ulval > (ACE_CDR::ULong) ACE_INT16_MAX) { return 0; } - ev->u.sval = (short) ev->u.ulval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.ulval; + break; case AST_Expression::EV_longlong: if (ev->u.llval > (ACE_CDR::LongLong) ACE_INT16_MAX || ev->u.llval < (ACE_CDR::LongLong) ACE_INT16_MIN) @@ -612,70 +612,62 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.sval = (short) ev->u.llval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.llval; + break; case AST_Expression::EV_ulonglong: if ((ev->u.ullval & ACE_INT16_MAX) != ev->u.ullval) { return 0; } - ev->u.sval = (short) ev->u.ullval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.ullval; + break; case AST_Expression::EV_bool: - ev->u.sval = (short) ev->u.bval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.bval; + break; case AST_Expression::EV_float: - if (ev->u.fval > (float) ACE_INT16_MAX - || ev->u.fval < (float) ACE_INT16_MIN) + if (ev->u.fval > (ACE_CDR::Float) ACE_INT16_MAX + || ev->u.fval < (ACE_CDR::Float) ACE_INT16_MIN) { return 0; } - ev->u.sval = (short) ev->u.fval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.fval; + break; case AST_Expression::EV_double: - if (ev->u.dval > (double) ACE_INT16_MAX - || ev->u.dval < (double) ACE_INT16_MIN) + if (ev->u.dval > (ACE_CDR::Double) ACE_INT16_MAX + || ev->u.dval < (ACE_CDR::Double) ACE_INT16_MIN) { return 0; } - ev->u.sval = (short) ev->u.dval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.dval; + break; case AST_Expression::EV_char: - ev->u.sval = (short) ev->u.cval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.cval; + break; case AST_Expression::EV_wchar: if (ev->u.wcval > (ACE_CDR::WChar) ACE_INT16_MAX) { return 0; } - ev->u.sval = (short) ev->u.wcval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.wcval; + break; case AST_Expression::EV_octet: - ev->u.sval = (short) ev->u.oval; - ev->et = AST_Expression::EV_short; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.oval; + break; case AST_Expression::EV_int8: - ev->u.sval = (short) ev->u.int8val; - ev->et = t; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.int8val; + break; case AST_Expression::EV_uint8: - ev->u.sval = (short) ev->u.uint8val; - ev->et = t; - return ev; + tmp.sval = (ACE_CDR::Short) ev->u.uint8val; + break; default: return 0; } + break; + case AST_Expression::EV_ushort: switch (ev->et) { @@ -685,28 +677,25 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.usval = (unsigned short) ev->u.sval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.sval; + break; case AST_Expression::EV_long: - if (ev->u.lval > (long) ACE_UINT16_MAX + if (ev->u.lval > (ACE_CDR::Long) ACE_UINT16_MAX || ev->u.lval < 0) { return 0; } - ev->u.usval = (unsigned short) ev->u.lval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.lval; + break; case AST_Expression::EV_ulong: - if (ev->u.ulval > (unsigned long) ACE_UINT16_MAX) + if (ev->u.ulval > (ACE_CDR::ULong) ACE_UINT16_MAX) { return 0; } - ev->u.usval = (unsigned short) ev->u.ulval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.ulval; + break; case AST_Expression::EV_longlong: if (ev->u.llval > (ACE_CDR::LongLong) ACE_UINT16_MAX || ev->u.llval < 0) @@ -714,156 +703,137 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.usval = (unsigned short) ev->u.llval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.llval; + break; case AST_Expression::EV_ulonglong: if ((ev->u.ullval & ACE_UINT16_MAX) != ev->u.ullval) { return 0; } - ev->u.usval = (unsigned short) ev->u.ullval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.ullval; + break; case AST_Expression::EV_bool: - ev->u.usval = (unsigned short) ev->u.bval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.bval; + break; case AST_Expression::EV_float: if (ev->u.fval < 0.0 - || ev->u.fval > (float) ACE_UINT16_MAX) + || ev->u.fval > (ACE_CDR::Float) ACE_UINT16_MAX) { return 0; } - ev->u.usval = (unsigned short) ev->u.fval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.fval; + break; case AST_Expression::EV_double: if (ev->u.dval < 0.0 - || ev->u.dval > (double) ACE_UINT16_MAX) + || ev->u.dval > (ACE_CDR::Double) ACE_UINT16_MAX) { return 0; } - ev->u.usval = (unsigned short) ev->u.dval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.dval; + break; case AST_Expression::EV_char: if ((signed char) ev->u.cval < 0) { return 0; } - ev->u.usval = (unsigned short) ev->u.cval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.cval; + break; case AST_Expression::EV_wchar: - ev->u.usval = (unsigned short) ev->u.wcval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.wcval; + break; case AST_Expression::EV_octet: - ev->u.usval = (unsigned short) ev->u.oval; - ev->et = AST_Expression::EV_ushort; - return ev; + tmp.usval = (ACE_CDR::UShort) ev->u.oval; + break; case AST_Expression::EV_int8: if (ev->u.int8val < 0) return 0; - ev->u.usval = static_cast (ev->u.int8val); - ev->et = t; - return ev; + tmp.usval = static_cast (ev->u.int8val); + break; case AST_Expression::EV_uint8: - ev->u.usval = static_cast (ev->u.uint8val); - ev->et = t; - return ev; + tmp.usval = static_cast (ev->u.uint8val); + break; default: return 0; } + break; + case AST_Expression::EV_long: switch (ev->et) { case AST_Expression::EV_short: - ev->u.lval = (long) ev->u.sval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.sval; + break; case AST_Expression::EV_ushort: - ev->u.lval = (long) ev->u.usval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.usval; + break; case AST_Expression::EV_ulong: - if (ev->u.ulval > (unsigned long) ACE_INT32_MAX) + if (ev->u.ulval > (ACE_CDR::ULong) ACE_INT32_MAX) { return 0; } - ev->u.lval = (long) ev->u.ulval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.ulval; + break; case AST_Expression::EV_longlong: if (ev->u.llval > (ACE_CDR::LongLong) ACE_INT32_MAX || ev->u.llval < (ACE_CDR::LongLong) ACE_INT32_MIN) { return 0; } - ev->u.lval = (long) ev->u.llval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.llval; + break; case AST_Expression::EV_ulonglong: if ((ev->u.ullval & ACE_INT32_MAX) != ev->u.ullval) { return 0; } - ev->u.lval = (long) ev->u.ullval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.ullval; + break; case AST_Expression::EV_bool: - ev->u.lval = (long) ev->u.bval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.bval; + break; case AST_Expression::EV_float: - if (ev->u.fval > (float) LONG_MAX - || ev->u.fval < (float) ACE_INT32_MIN) + if (ev->u.fval > (ACE_CDR::Float) ACE_INT32_MAX + || ev->u.fval < (ACE_CDR::Float) ACE_INT32_MIN) { return 0; } - ev->u.lval = (long) ev->u.fval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.fval; + break; case AST_Expression::EV_double: - if (ev->u.dval > (double) LONG_MAX - || ev->u.dval < (double) ACE_INT32_MIN) + if (ev->u.dval > (ACE_CDR::Double) ACE_INT32_MAX + || ev->u.dval < (ACE_CDR::Double) ACE_INT32_MIN) { return 0; } - ev->u.lval = (long) ev->u.dval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.dval; + break; case AST_Expression::EV_char: - ev->u.lval = (long) ev->u.cval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.cval; + break; case AST_Expression::EV_wchar: - ev->u.lval = (long) ev->u.wcval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.wcval; + break; case AST_Expression::EV_octet: - ev->u.lval = (long) ev->u.oval; - ev->et = AST_Expression::EV_long; - return ev; + tmp.lval = (ACE_CDR::Long) ev->u.oval; + break; case AST_Expression::EV_int8: - ev->u.lval = static_cast (ev->u.int8val); - ev->et = t; - return ev; + tmp.lval = static_cast (ev->u.int8val); + break; case AST_Expression::EV_uint8: - ev->u.lval = static_cast (ev->u.uint8val); - ev->et = t; - return ev; + tmp.lval = static_cast (ev->u.uint8val); + break; default: return 0; } + break; + case AST_Expression::EV_ulong: switch (ev->et) { @@ -873,22 +843,19 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.ulval = (unsigned long) ev->u.sval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.sval; + break; case AST_Expression::EV_ushort: - ev->u.ulval = (unsigned long) ev->u.usval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.usval; + break; case AST_Expression::EV_long: if (ev->u.lval < 0) { return 0; } - ev->u.ulval = (unsigned long) ev->u.lval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.lval; + break; case AST_Expression::EV_longlong: if (ev->u.llval > (ACE_CDR::LongLong) ACE_UINT32_MAX || ev->u.llval < 0) @@ -896,89 +863,77 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.ulval = (unsigned long) ev->u.llval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.llval; + break; case AST_Expression::EV_ulonglong: if ((ev->u.ullval & ACE_UINT32_MAX) != ev->u.ullval) { return 0; } - ev->u.ulval = (unsigned long) ev->u.ullval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.ullval; + break; case AST_Expression::EV_bool: - ev->u.ulval = (unsigned long) ev->u.bval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.bval; + break; case AST_Expression::EV_float: if (ev->u.fval < 0.0 - || ev->u.fval > (float) ACE_UINT32_MAX) + || ev->u.fval > (ACE_CDR::Float) ACE_UINT32_MAX) { return 0; } - ev->u.ulval = (unsigned long) ev->u.fval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.fval; + break; case AST_Expression::EV_double: if (ev->u.dval < 0.0 - || ev->u.dval > (double) ACE_UINT32_MAX) + || ev->u.dval > (ACE_CDR::Double) ACE_UINT32_MAX) { return 0; } - ev->u.ulval = (unsigned long) ev->u.dval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.dval; + break; case AST_Expression::EV_char: if ((signed char) ev->u.cval < 0) { return 0; } - ev->u.ulval = (unsigned long) ev->u.cval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.cval; + break; case AST_Expression::EV_wchar: - ev->u.ulval = (unsigned long) ev->u.wcval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.wcval; + break; case AST_Expression::EV_octet: - ev->u.ulval = (unsigned long) ev->u.oval; - ev->et = AST_Expression::EV_ulong; - return ev; + tmp.ulval = (ACE_CDR::ULong) ev->u.oval; + break; case AST_Expression::EV_int8: if (ev->u.int8val < 0) return 0; - ev->u.ulval = static_cast (ev->u.int8val); - ev->et = t; - return ev; + tmp.ulval = static_cast (ev->u.int8val); + break; case AST_Expression::EV_uint8: - ev->u.ulval = static_cast (ev->u.uint8val); - ev->et = t; - return ev; + tmp.ulval = static_cast (ev->u.uint8val); + break; default: return 0; } + break; + case AST_Expression::EV_longlong: switch (ev->et) { case AST_Expression::EV_short: - ev->u.llval = (ACE_CDR::LongLong) ev->u.sval; - ev->et = AST_Expression::EV_longlong; - return ev; + tmp.llval = (ACE_CDR::LongLong) ev->u.sval; + break; case AST_Expression::EV_ushort: - ev->u.llval = (ACE_CDR::LongLong) ev->u.usval; - ev->et = AST_Expression::EV_longlong; - return ev; + tmp.llval = (ACE_CDR::LongLong) ev->u.usval; + break; case AST_Expression::EV_long: - ev->u.llval = (ACE_CDR::LongLong) ev->u.lval; - ev->et = AST_Expression::EV_longlong; - return ev; + tmp.llval = (ACE_CDR::LongLong) ev->u.lval; + break; case AST_Expression::EV_ulong: - ev->u.llval = (ACE_CDR::LongLong) ev->u.ulval; - ev->et = AST_Expression::EV_longlong; - return ev; + tmp.llval = (ACE_CDR::LongLong) ev->u.ulval; + break; case AST_Expression::EV_ulonglong: if (ev->u.ullval > ACE_INT64_MAX) { @@ -987,55 +942,48 @@ coerce_value (AST_Expression::AST_ExprValue *ev, ev->u.llval = static_cast (ev->u.ullval); - ev->et = AST_Expression::EV_longlong; - return ev; + break; case AST_Expression::EV_bool: - ev->u.llval = (ACE_CDR::LongLong) ev->u.bval; - ev->et = AST_Expression::EV_longlong; - return ev; + tmp.llval = (ACE_CDR::LongLong) ev->u.bval; + break; case AST_Expression::EV_float: - if (ev->u.fval > (float) ACE_INT64_MAX - || ev->u.fval < (float) ACE_INT64_MIN) + if (ev->u.fval > (ACE_CDR::Float) ACE_INT64_MAX + || ev->u.fval < (ACE_CDR::Float) ACE_INT64_MIN) { return 0; } - ev->u.llval = (ACE_CDR::LongLong) ev->u.fval; - ev->et = AST_Expression::EV_longlong; - return ev; + tmp.llval = (ACE_CDR::LongLong) ev->u.fval; + break; case AST_Expression::EV_double: - if (ev->u.dval > (double) ACE_INT64_MAX - || ev->u.dval < (double) ACE_INT64_MIN) + if (ev->u.dval > (ACE_CDR::Double) ACE_INT64_MAX + || ev->u.dval < (ACE_CDR::Double) ACE_INT64_MIN) { return 0; } - ev->u.llval = (ACE_CDR::LongLong) ev->u.dval; - ev->et = AST_Expression::EV_longlong; - return ev; + tmp.llval = (ACE_CDR::LongLong) ev->u.dval; + break; case AST_Expression::EV_char: - ev->u.llval = (ACE_CDR::LongLong) ev->u.cval; - ev->et = AST_Expression::EV_longlong; - return ev; + tmp.llval = (ACE_CDR::LongLong) ev->u.cval; + break; case AST_Expression::EV_wchar: - ev->u.llval = (ACE_CDR::LongLong) ev->u.wcval; - ev->et = AST_Expression::EV_longlong; - return ev; + tmp.llval = (ACE_CDR::LongLong) ev->u.wcval; + break; case AST_Expression::EV_octet: - ev->u.llval = (ACE_CDR::LongLong) ev->u.oval; - ev->et = AST_Expression::EV_longlong; - return ev; + tmp.llval = (ACE_CDR::LongLong) ev->u.oval; + break; case AST_Expression::EV_int8: - ev->u.llval = static_cast (ev->u.int8val); - ev->et = t; - return ev; + tmp.llval = static_cast (ev->u.int8val); + break; case AST_Expression::EV_uint8: - ev->u.llval = static_cast (ev->u.int8val); - ev->et = t; - return ev; + tmp.llval = static_cast (ev->u.int8val); + break; default: return 0; } + break; + case AST_Expression::EV_ulonglong: switch (ev->et) { @@ -1045,26 +993,22 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.ullval = ev->u.sval; - ev->et = AST_Expression::EV_ulonglong; - return ev; + tmp.ullval = ev->u.sval; + break; case AST_Expression::EV_ushort: - ev->u.ullval = ev->u.usval; - ev->et = AST_Expression::EV_ulonglong; - return ev; + tmp.ullval = ev->u.usval; + break; case AST_Expression::EV_long: if (ev->u.lval < 0) { return 0; } - ev->u.ullval = ev->u.lval; - ev->et = AST_Expression::EV_ulonglong; - return ev; + tmp.ullval = ev->u.lval; + break; case AST_Expression::EV_ulong: - ev->u.ullval = ev->u.ulval; - ev->et = AST_Expression::EV_ulonglong; - return ev; + tmp.ullval = ev->u.ulval; + break; case AST_Expression::EV_longlong: if (ev->u.llval < 0) { @@ -1073,213 +1017,177 @@ coerce_value (AST_Expression::AST_ExprValue *ev, ev->u.ullval = static_cast (ev->u.llval); - ev->et = AST_Expression::EV_ulonglong; - return ev; + break; case AST_Expression::EV_bool: - ev->u.ullval = ev->u.bval; - ev->et = AST_Expression::EV_ulonglong; - return ev; + tmp.ullval = ev->u.bval; + break; case AST_Expression::EV_float: if (ev->u.fval < 0.0 - || ev->u.fval > (float) ACE_UINT64_MAX) + || ev->u.fval > (ACE_CDR::Float) ACE_UINT64_MAX) { return 0; } - ev->u.ullval = static_cast (ev->u.fval); - - ev->et = AST_Expression::EV_ulonglong; - return ev; + tmp.ullval = static_cast (ev->u.fval); + break; case AST_Expression::EV_double: if (ev->u.dval < 0.0 - || ev->u.dval > (double) ACE_UINT64_MAX) + || ev->u.dval > (ACE_CDR::Double) ACE_UINT64_MAX) { return 0; } - ev->u.ullval = static_cast (ev->u.dval); - - ev->et = AST_Expression::EV_ulonglong; - return ev; + tmp.ullval = static_cast (ev->u.dval); + break; case AST_Expression::EV_char: if ((signed char) ev->u.cval < 0) { return 0; } - ev->u.ullval = ev->u.cval; - ev->et = AST_Expression::EV_ulonglong; - return ev; + tmp.ullval = ev->u.cval; + break; case AST_Expression::EV_wchar: - ev->u.ullval = ev->u.wcval; - ev->et = AST_Expression::EV_ulonglong; - return ev; + tmp.ullval = ev->u.wcval; + break; case AST_Expression::EV_octet: - ev->u.ullval = ev->u.oval; - ev->et = AST_Expression::EV_ulonglong; - return ev; + tmp.ullval = ev->u.oval; + break; case AST_Expression::EV_int8: if (ev->u.int8val < 0) return 0; - ev->u.ullval = static_cast (ev->u.int8val); - ev->et = t; - return ev; + tmp.ullval = static_cast (ev->u.int8val); + break; case AST_Expression::EV_uint8: - ev->u.ullval = static_cast (ev->u.uint8val); - ev->et = t; - return ev; + tmp.ullval = static_cast (ev->u.uint8val); + break; default: return 0; } + break; + case AST_Expression::EV_bool: switch (ev->et) { case AST_Expression::EV_short: - ev->u.bval = (ev->u.sval == 0) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = (ev->u.sval == 0) ? false : true; + break; case AST_Expression::EV_ushort: - ev->u.bval = (ev->u.usval == 0) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = (ev->u.usval == 0) ? false : true; + break; case AST_Expression::EV_long: - ev->u.bval = (ev->u.lval == 0) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = (ev->u.lval == 0) ? false : true; + break; case AST_Expression::EV_ulong: - ev->u.bval = (ev->u.ulval == 0) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = (ev->u.ulval == 0) ? false : true; + break; case AST_Expression::EV_longlong: - ev->u.bval = (ev->u.llval == 0) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = (ev->u.llval == 0) ? false : true; + break; case AST_Expression::EV_ulonglong: - ev->u.bval = (ev->u.ullval == 0) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = (ev->u.ullval == 0) ? false : true; + break; case AST_Expression::EV_float: - ev->u.bval = ACE::is_equal (ev->u.fval, 0.0f) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = ACE::is_equal (ev->u.fval, 0.0f) ? false : true; + break; case AST_Expression::EV_double: - ev->u.bval = ACE::is_equal (ev->u.dval, 0.0) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = ACE::is_equal (ev->u.dval, 0.0) ? false : true; + break; case AST_Expression::EV_char: - ev->u.bval = (ev->u.cval == 0) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = (ev->u.cval == 0) ? false : true; + break; case AST_Expression::EV_wchar: - ev->u.bval = (ev->u.wcval == 0) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = (ev->u.wcval == 0) ? false : true; + break; case AST_Expression::EV_octet: - ev->u.bval = (ev->u.oval == 0) ? false : true; - ev->et = AST_Expression::EV_bool; - return ev; + tmp.bval = (ev->u.oval == 0) ? false : true; + break; case AST_Expression::EV_int8: - ev->u.bval = ev->u.int8val ? true : false; - ev->et = t; - return ev; + tmp.bval = ev->u.int8val ? true : false; + break; case AST_Expression::EV_uint8: - ev->u.bval = ev->u.uint8val ? true : false; - ev->et = t; - return ev; + tmp.bval = ev->u.uint8val ? true : false; + break; default: return 0; } + break; + case AST_Expression::EV_float: switch (ev->et) { case AST_Expression::EV_short: - ev->u.fval = (float) ev->u.sval; - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ev->u.sval; + break; case AST_Expression::EV_ushort: - ev->u.fval = (float) ev->u.usval; - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ev->u.usval; + break; case AST_Expression::EV_long: - ev->u.fval = (float) ev->u.lval; - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ev->u.lval; + break; case AST_Expression::EV_ulong: - ev->u.fval = (float) ev->u.ulval; - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ev->u.ulval; + break; case AST_Expression::EV_longlong: - if (ev->u.llval > FLT_MAX - || ev->u.llval < -(ACE_FLT_MAX)) + if (ev->u.llval > ACE_FLT_MAX + || ev->u.llval < ACE_FLT_LOWEST) { return 0; } - ev->u.fval = (float) ev->u.llval; - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ev->u.llval; + break; case AST_Expression::EV_ulonglong: - ev->u.fval = (float) ((ACE_CDR::LongLong) ev->u.ullval); - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ((ACE_CDR::LongLong) ev->u.ullval); + break; case AST_Expression::EV_bool: - ev->u.fval = (float) ((ev->u.bval == true) ? 1.0 : 0.0); - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ev->u.bval ? 1.0 : 0.0; + break; case AST_Expression::EV_double: if (ev->u.dval > ACE_FLT_MAX - || ev->u.dval < -(ACE_FLT_MAX)) + || ev->u.dval < ACE_FLT_LOWEST) { return 0; } - ev->u.fval = (float) ev->u.dval; - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ev->u.dval; + break; case AST_Expression::EV_char: - ev->u.fval = (float) ev->u.cval; - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ev->u.cval; + break; case AST_Expression::EV_wchar: - ev->u.fval = (float) ev->u.wcval; - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ev->u.wcval; + break; case AST_Expression::EV_octet: - ev->u.fval = (float) ev->u.oval; - ev->et = AST_Expression::EV_float; - return ev; + tmp.fval = (ACE_CDR::Float) ev->u.oval; + break; case AST_Expression::EV_int8: - ev->u.fval = static_cast (ev->u.int8val); - ev->et = t; - return ev; + tmp.fval = static_cast (ev->u.int8val); + break; case AST_Expression::EV_uint8: - ev->u.fval = static_cast (ev->u.uint8val); - ev->et = t; - return ev; + tmp.fval = static_cast (ev->u.uint8val); + break; default: return 0; } + break; + case AST_Expression::EV_double: switch (ev->et) { case AST_Expression::EV_short: - ev->u.dval = (double) ev->u.sval; - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = (ACE_CDR::Double) ev->u.sval; + break; case AST_Expression::EV_ushort: - ev->u.dval = (double) ev->u.usval; - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = (ACE_CDR::Double) ev->u.usval; + break; case AST_Expression::EV_long: - ev->u.dval = (double) ev->u.lval; - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = (ACE_CDR::Double) ev->u.lval; + break; case AST_Expression::EV_ulong: - ev->u.dval = (double) ev->u.ulval; - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = (ACE_CDR::Double) ev->u.ulval; + break; case AST_Expression::EV_longlong: - ev->u.dval = (double) ev->u.llval; - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = (ACE_CDR::Double) ev->u.llval; + break; case AST_Expression::EV_ulonglong: // Some compilers don't implement unsigned 64-bit to double // conversions, so we are stuck with the signed 64-bit max value. @@ -1288,82 +1196,72 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.dval = (double) ((ACE_CDR::LongLong) ev->u.ullval); - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = (ACE_CDR::Double) ((ACE_CDR::LongLong) ev->u.ullval); + break; case AST_Expression::EV_bool: - ev->u.dval = (ev->u.bval == true) ? 1.0 : 0.0; - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = ev->u.bval ? 1.0 : 0.0; + break; case AST_Expression::EV_float: - ev->u.dval = (double) ev->u.fval; - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = (ACE_CDR::Double) ev->u.fval; + break; case AST_Expression::EV_char: - ev->u.dval = (double) ev->u.cval; - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = (ACE_CDR::Double) ev->u.cval; + break; case AST_Expression::EV_wchar: - ev->u.dval = (double) ev->u.wcval; - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = (ACE_CDR::Double) ev->u.wcval; + break; case AST_Expression::EV_octet: - ev->u.dval = (double) ev->u.oval; - ev->et = AST_Expression::EV_double; - return ev; + tmp.dval = (ACE_CDR::Double) ev->u.oval; + break; case AST_Expression::EV_int8: - ev->u.dval = static_cast (ev->u.int8val); - ev->et = t; - return ev; + tmp.dval = static_cast (ev->u.int8val); + break; case AST_Expression::EV_uint8: - ev->u.dval = static_cast (ev->u.uint8val); - ev->et = t; - return ev; + tmp.dval = static_cast (ev->u.uint8val); + break; default: return 0; } + break; + case AST_Expression::EV_int8: case AST_Expression::EV_char: switch (ev->et) { case AST_Expression::EV_short: - if (ev->u.sval > (short) ACE_CHAR_MAX - || ev->u.sval < (short) ACE_CHAR_MIN) + if (ev->u.sval > (ACE_CDR::Short) ACE_CHAR_MAX + || ev->u.sval < (ACE_CDR::Short) ACE_CHAR_MIN) { return 0; } - ev->u.cval = (char) ev->u.sval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.sval; + break; case AST_Expression::EV_ushort: - if (ev->u.usval > (unsigned short) ACE_CHAR_MAX) + if (ev->u.usval > (ACE_CDR::UShort) ACE_CHAR_MAX) { return 0; } - ev->u.cval = (char) ev->u.usval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.usval; + break; case AST_Expression::EV_long: - if (ev->u.lval > (long) ACE_CHAR_MAX - || ev->u.lval < (long) ACE_CHAR_MIN) + if (ev->u.lval > (ACE_CDR::Long) ACE_CHAR_MAX + || ev->u.lval < (ACE_CDR::Long) ACE_CHAR_MIN) { return 0; } - ev->u.cval = (char) ev->u.lval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.lval; + break; case AST_Expression::EV_ulong: - if (ev->u.ulval > (unsigned long) ACE_CHAR_MAX) + if (ev->u.ulval > (ACE_CDR::ULong) ACE_CHAR_MAX) { return 0; } - ev->u.cval = (char) ev->u.ulval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.ulval; + break; case AST_Expression::EV_longlong: if (ev->u.llval > (ACE_CDR::LongLong) ACE_CHAR_MAX || ev->u.llval < (ACE_CDR::LongLong) ACE_CHAR_MIN) @@ -1371,51 +1269,45 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.cval = (char) ev->u.llval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.llval; + break; case AST_Expression::EV_ulonglong: if (( ev->u.ullval & ACE_CHAR_MAX) != ev->u.ullval) { return 0; } - ev->u.cval = (char) ev->u.ullval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.ullval; + break; case AST_Expression::EV_bool: - ev->u.cval = (char) ev->u.bval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.bval; + break; case AST_Expression::EV_float: - if (ev->u.fval > (float) ACE_CHAR_MAX - || ev->u.fval < (float) ACE_CHAR_MIN) + if (ev->u.fval > (ACE_CDR::Float) ACE_CHAR_MAX + || ev->u.fval < (ACE_CDR::Float) ACE_CHAR_MIN) { return 0; } - ev->u.cval = (char) ev->u.fval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.fval; + break; case AST_Expression::EV_double: - if (ev->u.dval > (double) ACE_CHAR_MAX - || ev->u.dval < (double) ACE_CHAR_MIN) + if (ev->u.dval > (ACE_CDR::Double) ACE_CHAR_MAX + || ev->u.dval < (ACE_CDR::Double) ACE_CHAR_MIN) { return 0; } - ev->u.cval = (char) ev->u.dval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.dval; + break; case AST_Expression::EV_wchar: if (ev->u.wcval > (ACE_CDR::WChar) ACE_CHAR_MAX) { return 0; } - ev->u.cval = (char) ev->u.wcval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.wcval; + break; case AST_Expression::EV_uint8: case AST_Expression::EV_octet: if (ev->u.oval > (unsigned char) ACE_CHAR_MAX) @@ -1423,17 +1315,17 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.cval = (char) ev->u.oval; - ev->et = t; - return ev; + tmp.cval = (ACE_CDR::Char) ev->u.oval; + break; case AST_Expression::EV_int8: case AST_Expression::EV_char: - ev->u.cval = static_cast (ev->u.int8val); - ev->et = t; - return ev; + tmp = ev->u; + break; default: return 0; } + break; + case AST_Expression::EV_wchar: switch (ev->et) { @@ -1443,13 +1335,11 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.wcval = (ACE_CDR::WChar) ev->u.sval; - ev->et = AST_Expression::EV_wchar; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.sval; + break; case AST_Expression::EV_ushort: - ev->u.wcval = (ACE_CDR::WChar) ev->u.usval; - ev->et = AST_Expression::EV_char; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.usval; + break; case AST_Expression::EV_long: if (ev->u.lval < 0 || ev->u.lval > ACE_WCHAR_MAX) @@ -1457,18 +1347,16 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.wcval = (ACE_CDR::WChar) ev->u.lval; - ev->et = AST_Expression::EV_wchar; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.lval; + break; case AST_Expression::EV_ulong: if (ev->u.ulval > ACE_WCHAR_MAX) { return 0; } - ev->u.wcval = (ACE_CDR::WChar) ev->u.ulval; - ev->et = AST_Expression::EV_wchar; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.ulval; + break; case AST_Expression::EV_longlong: if (ev->u.llval > (ACE_CDR::LongLong) ACE_WCHAR_MAX || ev->u.llval < 0) @@ -1476,108 +1364,95 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.wcval = (ACE_CDR::WChar) ev->u.llval; - ev->et = AST_Expression::EV_wchar; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.llval; + break; case AST_Expression::EV_ulonglong: if ((ev->u.ullval & ACE_WCHAR_MAX) != ev->u.ullval ) { return 0; } - ev->u.wcval = (ACE_CDR::WChar) ev->u.ullval; - ev->et = AST_Expression::EV_wchar; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.ullval; + break; case AST_Expression::EV_bool: - ev->u.wcval = (ACE_CDR::WChar) ev->u.bval; - ev->et = AST_Expression::EV_wchar; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.bval; + break; case AST_Expression::EV_float: - if (ev->u.fval > (float) ACE_WCHAR_MAX + if (ev->u.fval > (ACE_CDR::Float) ACE_WCHAR_MAX || ev->u.fval < 0) { return 0; } - ev->u.wcval = (ACE_CDR::WChar) ev->u.fval; - ev->et = AST_Expression::EV_wchar; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.fval; + break; case AST_Expression::EV_double: - if (ev->u.dval > (double) ACE_WCHAR_MAX + if (ev->u.dval > (ACE_CDR::Double) ACE_WCHAR_MAX || ev->u.dval < 0) { return 0; } - ev->u.wcval = (ACE_CDR::WChar) ev->u.dval; - ev->et = AST_Expression::EV_wchar; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.dval; + break; case AST_Expression::EV_char: + case AST_Expression::EV_int8: if ((signed char) ev->u.cval < 0) { return 0; } - ev->u.wcval = (ACE_CDR::WChar) ev->u.cval; - ev->et = AST_Expression::EV_wchar; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.cval; + break; case AST_Expression::EV_octet: - ev->u.wcval = (ACE_CDR::WChar) ev->u.oval; - ev->et = AST_Expression::EV_wchar; - return ev; - case AST_Expression::EV_int8: - ev->u.wcval = static_cast (ev->u.int8val); - ev->et = t; - return ev; + tmp.wcval = (ACE_CDR::WChar) ev->u.oval; + break; case AST_Expression::EV_uint8: - ev->u.wcval = static_cast (ev->u.uint8val); - ev->et = t; - return ev; + tmp.wcval = static_cast (ev->u.uint8val); + break; default: return 0; } + break; + case AST_Expression::EV_uint8: case AST_Expression::EV_octet: switch (ev->et) { case AST_Expression::EV_short: if (ev->u.sval < 0 - || ev->u.sval > (short) ACE_OCTET_MAX) + || ev->u.sval > (ACE_CDR::Short) ACE_OCTET_MAX) { return 0; } - ev->u.oval = (unsigned char) ev->u.sval; - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.sval; + break; case AST_Expression::EV_ushort: - if (ev->u.usval > (unsigned short) ACE_OCTET_MAX) + if (ev->u.usval > (ACE_CDR::UShort) ACE_OCTET_MAX) { return 0; } - ev->u.oval = (unsigned char) ev->u.usval; - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.usval; + break; case AST_Expression::EV_long: if (ev->u.lval < 0 - || ev->u.lval > (long) ACE_OCTET_MAX) + || ev->u.lval > (ACE_CDR::Long) ACE_OCTET_MAX) { return 0; } - ev->u.oval = (unsigned char) ev->u.lval; - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.lval; + break; case AST_Expression::EV_ulong: - if (ev->u.ulval > (unsigned long) ACE_OCTET_MAX) + if (ev->u.ulval > (ACE_CDR::ULong) ACE_OCTET_MAX) { return 0; } - ev->u.oval = (unsigned char) ev->u.ulval; - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.ulval; + break; case AST_Expression::EV_longlong: if (ev->u.llval < 0 || ev->u.llval > (ACE_CDR::LongLong) ACE_OCTET_MAX) @@ -1585,42 +1460,37 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.oval = (unsigned char) ev->u.llval; - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.llval; + break; case AST_Expression::EV_ulonglong: if ((ev->u.ullval & ACE_OCTET_MAX) != ev->u.ullval) { return 0; } - ev->u.oval = (unsigned char) ev->u.ullval; - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.ullval; + break; case AST_Expression::EV_bool: - ev->u.oval = (unsigned char) ((ev->u.bval == false) ? 1 : 0); - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.bval ? 1 : 0; + break; case AST_Expression::EV_float: if (ev->u.fval < 0.0 - || ev->u.fval > (float) ACE_OCTET_MAX) + || ev->u.fval > (ACE_CDR::Float) ACE_OCTET_MAX) { return 0; } - ev->u.oval = (unsigned char) ev->u.fval; - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.fval; + break; case AST_Expression::EV_double: if (ev->u.dval < 0.0 - || ev->u.dval > (double) ACE_OCTET_MAX) + || ev->u.dval > (ACE_CDR::Double) ACE_OCTET_MAX) { return 0; } - ev->u.oval = (unsigned char) ev->u.dval; - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.dval; + break; case AST_Expression::EV_int8: case AST_Expression::EV_char: if ((signed char) ev->u.cval < 0) @@ -1628,26 +1498,25 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - ev->u.oval = (unsigned char) ev->u.cval; - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.cval; + break; case AST_Expression::EV_wchar: if (ev->u.wcval > (ACE_CDR::WChar) ACE_OCTET_MAX) { return 0; } - ev->u.oval = (unsigned char) ev->u.wcval; - ev->et = t; - return ev; + tmp.oval = (ACE_CDR::Octet) ev->u.wcval; + break; case AST_Expression::EV_uint8: case AST_Expression::EV_octet: - ev->u.oval = ev->u.oval; - ev->et = t; - return ev; + tmp = ev->u; + break; default: return 0; } + break; + case AST_Expression::EV_enum: switch (ev->et) { @@ -1660,7 +1529,9 @@ coerce_value (AST_Expression::AST_ExprValue *ev, return 0; } - return 0; + ev->et = t; + ev->u = tmp; + return ev; } // Integer literals may not be assigned to floating point constants, diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp index 9fdbf97edd38e..c0c00716c28ac 100644 --- a/TAO/TAO_IDL/be/be_sequence.cpp +++ b/TAO/TAO_IDL/be/be_sequence.cpp @@ -752,6 +752,12 @@ be_sequence::gen_base_class_name (TAO_OutStream *os, { be_predefined_type *const predefined_type = dynamic_cast (base_type); + if (!predefined_type) + ACE_ERROR_RETURN ((LM_ERROR, + "(%N:%l) be_sequence::" + "gen_base_class_name - " + "Bad element type\n"), + -1); switch (predefined_type->pt ()) { case AST_PredefinedType::PT_uint8: diff --git a/TAO/TAO_IDL/include/ast_expression.h b/TAO/TAO_IDL/include/ast_expression.h index 42f7be07f3355..9a40a1a484463 100644 --- a/TAO/TAO_IDL/include/ast_expression.h +++ b/TAO/TAO_IDL/include/ast_expression.h @@ -169,7 +169,7 @@ class TAO_IDL_FE_Export AST_Expression { AST_ExprValue (void); - union + union Value { ACE_CDR::Short sval; // Contains short expression value. ACE_CDR::UShort usval; // Contains unsigned short expr value. @@ -189,9 +189,10 @@ class TAO_IDL_FE_Export AST_Expression ACE_CDR::Fixed fixedval; // Contains IDL fixed value. ACE_CDR::Int8 int8val; // Signed Byte Sized Integer ACE_CDR::UInt8 uint8val; // Unsigned Byte Sized Integer - } u; + }; ExprType et; + Value u; }; // Operations.