diff options
author | Fred Hornsey <hornseyf@objectcomputing.com> | 2021-06-07 23:43:19 -0500 |
---|---|---|
committer | Fred Hornsey <hornseyf@objectcomputing.com> | 2021-06-07 23:43:19 -0500 |
commit | a4c5b22c20a1f1298a23d3ab57571237284b1963 (patch) | |
tree | 8ad2522b013ea2c8fd6f0dffa8e60e60342ae614 /TAO/TAO_IDL/be | |
parent | 85a1e615810419950f8f1280f80df9da9f5dee4d (diff) | |
download | ATCD-a4c5b22c20a1f1298a23d3ab57571237284b1963.tar.gz |
Added WIP explicit_ints Test
And a bunch of fixes to get it to (sorta) work.
Diffstat (limited to 'TAO/TAO_IDL/be')
-rw-r--r-- | TAO/TAO_IDL/be/be_helper.cpp | 20 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_predefined_type.cpp | 25 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_constant/constant.cpp | 4 |
3 files changed, 38 insertions, 11 deletions
diff --git a/TAO/TAO_IDL/be/be_helper.cpp b/TAO/TAO_IDL/be/be_helper.cpp index bc982a5988e..218bc0ac534 100644 --- a/TAO/TAO_IDL/be/be_helper.cpp +++ b/TAO/TAO_IDL/be/be_helper.cpp @@ -530,8 +530,24 @@ TAO_OutStream::print (AST_Expression *expr) break; case AST_Expression::EV_longlong: this->TAO_OutStream::print ("ACE_INT64_LITERAL ("); - this->TAO_OutStream::print (ACE_INT64_FORMAT_SPECIFIER_ASCII, - ev->u.llval); + { + ACE_CDR::LongLong value = ev->u.llval; + /* + * It seem in C/C++ compilers the minus sign and the bare number are + * parsed separately for negative integer literals. This can cause + * compilers to complain when using the minimum value of a signed integer + * because the number without the minus sign is 1 past the max signed + * value. + * + * https://stackoverflow.com/questions/65007935/integer-constant-is-so-large-that-it-is-unsigned-compiler-warning-rational + * + * Apparently the workaround is to write it as `VALUE_PLUS_ONE - 1`. + */ + const bool min_value = value == ACE_INT64_MIN; + if (min_value) value += 1; + TAO_OutStream::print (ACE_INT64_FORMAT_SPECIFIER_ASCII, value); + if (min_value) TAO_OutStream::print (" - 1"); + } this->TAO_OutStream::print (")"); break; case AST_Expression::EV_ulonglong: diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp index 7aa8a813c9b..d311d098c33 100644 --- a/TAO/TAO_IDL/be/be_predefined_type.cpp +++ b/TAO/TAO_IDL/be/be_predefined_type.cpp @@ -14,9 +14,12 @@ #include "be_predefined_type.h" #include "be_visitor.h" #include "be_helper.h" -#include "utl_identifier.h" + #include "global_extern.h" +#include "utl_identifier.h" +#include "utl_err.h" + #include "ace/Log_Msg.h" #include "ace/ACE.h" #include "ace/OS_NS_stdio.h" @@ -198,19 +201,19 @@ be_predefined_type::compute_tc_name () case AST_PredefinedType::PT_any: ACE_NEW (id, Identifier ("_tc_any")); - break; + break; case AST_PredefinedType::PT_object: ACE_NEW (id, Identifier ("_tc_Object")); - break; + break; case AST_PredefinedType::PT_value: ACE_NEW (id, Identifier ("_tc_ValueBase")); - break; + break; case AST_PredefinedType::PT_abstract: ACE_NEW (id, Identifier ("_tc_AbstractBase")); - break; + break; case AST_PredefinedType::PT_pseudo: { char tcname [100]; @@ -222,9 +225,17 @@ be_predefined_type::compute_tc_name () Identifier (tcname)); break; } - default: - ACE_ERROR ((LM_WARNING, "Unknown or invalid predefined type")); + case AST_PredefinedType::PT_uint8: + ACE_NEW (id, Identifier ("_tc_Uint8")); break; + case AST_PredefinedType::PT_int8: + ACE_NEW (id, Identifier ("_tc_Int8")); + break; + default: + idl_global->err ()->misc_error ( + "be_predefined_type::compute_tc_name: Unknown or invalid predefined type", this); + // Nothing else to do. We will segfault if we continue, return, or throw Bailout + ACE_OS::abort (); } ACE_NEW (conc_name, diff --git a/TAO/TAO_IDL/be/be_visitor_constant/constant.cpp b/TAO/TAO_IDL/be/be_visitor_constant/constant.cpp index 1c11373df70..a841b6f20d6 100644 --- a/TAO/TAO_IDL/be/be_visitor_constant/constant.cpp +++ b/TAO/TAO_IDL/be/be_visitor_constant/constant.cpp @@ -39,9 +39,9 @@ const char *exprtype_to_cpp_corba_type (AST_Expression::ExprType et) case AST_Expression::EV_fixed: return "Fixed"; case AST_Expression::EV_int8: - return "CORBA::Octet"; + return "CORBA::Int8"; case AST_Expression::EV_uint8: - return "CORBA::Octet"; + return "CORBA::Uint8"; default: return 0; } |