Skip to content

Commit

Permalink
Try to Fix Issues with int8/uint8
Browse files Browse the repository at this point in the history
  • Loading branch information
iguessthislldo committed Jun 29, 2021
1 parent 2ed7fe7 commit 70b28ba
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 22 deletions.
5 changes: 5 additions & 0 deletions TAO/NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
USER VISIBLE CHANGES BETWEEN TAO-3.0.2 and TAO-3.0.3
====================================================

. Support for IDL 4 explicitly-named integer types like `int64` in TAO_IDL.
Support for `uint8` and `int8` is limited in TAO. Unlike the larger types,
these are new distinct types that are not aliases of existing types covered
by the CORBA specification.

USER VISIBLE CHANGES BETWEEN TAO-3.0.1 and TAO-3.0.2
====================================================

Expand Down
6 changes: 3 additions & 3 deletions TAO/TAO_IDL/ast/ast_sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@ AST_Sequence::base_type () const
AST_Type *
AST_Sequence::primitive_base_type () const
{
AST_Type *type_node = dynamic_cast<AST_Type *> (base_type ());
AST_Type *type_node = base_type ();
if (type_node && type_node->node_type () == AST_Decl::NT_typedef)
{
AST_Typedef *typedef_node = dynamic_cast<AST_Typedef*> (type_node);
if (typedef_node) return nullptr;
AST_Typedef *const typedef_node = dynamic_cast<AST_Typedef *> (type_node);
if (!typedef_node) return nullptr;
type_node = typedef_node->primitive_base_type ();
}
return type_node;
Expand Down
6 changes: 4 additions & 2 deletions TAO/TAO_IDL/be/be_codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2451,11 +2451,13 @@ TAO_CodeGen::gen_stub_hdr_includes ()
idl4 ? "tao/Basic_Types_IDLv4.h" : "tao/Basic_Types.h");
if (idl4)
{
*client_header_ << "\n"
*client_header_ <<
BE_GlobalData::core_versioned_ns_begin << "\n"
"namespace CORBA\n"
"{\n"
" using namespace IDLv4;\n"
"}";
"}\n" <<
BE_GlobalData::core_versioned_ns_end;
}

// May need ORB_Constants if users check SystemException minor
Expand Down
13 changes: 9 additions & 4 deletions TAO/TAO_IDL/be/be_global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@

TAO_IDL_BE_Export BE_GlobalData *be_global = nullptr;

const char *const BE_GlobalData::core_versioned_ns_begin =
"\nTAO_BEGIN_VERSIONED_NAMESPACE_DECL\n";
const char *const BE_GlobalData::core_versioned_ns_end =
"\nTAO_END_VERSIONED_NAMESPACE_DECL\n";

BE_GlobalData::BE_GlobalData ()
: changing_standard_include_files_ (1),
skel_export_macro_ (nullptr),
Expand All @@ -55,8 +60,8 @@ BE_GlobalData::BE_GlobalData ()
safe_include_ (nullptr),
unique_include_ (nullptr),
stripped_filename_ (nullptr),
core_versioning_begin_ ("\nTAO_BEGIN_VERSIONED_NAMESPACE_DECL\n"),
core_versioning_end_ ("\nTAO_END_VERSIONED_NAMESPACE_DECL\n"),
core_versioning_begin_ (core_versioned_ns_begin),
core_versioning_end_ (core_versioned_ns_end),
versioning_begin_ (),
versioning_end_ (),
versioning_include_ (),
Expand Down Expand Up @@ -1144,7 +1149,7 @@ BE_GlobalData::versioning_end (const char * s)

this->core_versioning_begin_ =
this->versioning_end_ + // Yes, "end".
"\nTAO_BEGIN_VERSIONED_NAMESPACE_DECL\n";
core_versioned_ns_begin;
}

void
Expand All @@ -1156,7 +1161,7 @@ BE_GlobalData::versioning_begin (const char * s)
+ ACE_CString ("\n\n");

this->core_versioning_end_ =
"\nTAO_END_VERSIONED_NAMESPACE_DECL\n"
core_versioned_ns_end
+ this->versioning_begin_; // Yes, "begin".

// Yes, "begin".
Expand Down
54 changes: 46 additions & 8 deletions TAO/TAO_IDL/be/be_sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ be_sequence::base_type () const
this->AST_Sequence::base_type ());
}

be_type *
be_sequence::primitive_base_type () const
{
be_type *type_node = base_type ();
if (type_node && type_node->node_type () == AST_Decl::NT_typedef)
{
be_typedef *const typedef_node = dynamic_cast<be_typedef *> (type_node);
if (!typedef_node) return nullptr;
type_node = typedef_node->primitive_base_type ();
}
return type_node;
}

// Helper to create_name.
char *
be_sequence::gen_name ()
Expand Down Expand Up @@ -268,7 +281,7 @@ be_sequence::managed_type ()
if (this->mt_ == be_sequence::MNG_UNKNOWN) // Not calculated yet.
{
// Base types.
be_type *const base_type = dynamic_cast<be_type*> (primitive_base_type ());
be_type *const base_type = primitive_base_type ();
if (!base_type)
ACE_ERROR_RETURN ((LM_ERROR,
"TAO_IDL (%N:%l) "
Expand Down Expand Up @@ -399,7 +412,7 @@ be_sequence::instance_name ()
'\0',
NAMEBUFSIZE);

be_type *const prim_type = dynamic_cast<be_type *> (primitive_base_type ());
be_type *const prim_type = primitive_base_type ();
if (!prim_type)
{
ACE_ERROR ((LM_ERROR,
Expand Down Expand Up @@ -580,8 +593,16 @@ be_sequence::gen_base_class_name (TAO_OutStream *os,
break;
case be_sequence::MNG_STRING:
{
be_type *const prim_type = dynamic_cast<be_type *> (primitive_base_type ());
if (prim_type && prim_type->node_type () == AST_Decl::NT_string)
be_type *const prim_type = primitive_base_type ();
if (!prim_type)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_sequence::"
"gen_base_class_name - "
"Bad element type\n"),
-1);
}
if (prim_type->node_type () == AST_Decl::NT_string)
{
be_string *str =
dynamic_cast<be_string*> (prim_type);
Expand Down Expand Up @@ -628,8 +649,16 @@ be_sequence::gen_base_class_name (TAO_OutStream *os,
break;
case be_sequence::MNG_WSTRING:
{
be_type *const prim_type = dynamic_cast<be_type *> (primitive_base_type ());
if (prim_type && prim_type->node_type () == AST_Decl::NT_wstring)
be_type *const prim_type = primitive_base_type ();
if (!prim_type)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_sequence::"
"gen_base_class_name - "
"Bad element type\n"),
-1);
}
if (prim_type->node_type () == AST_Decl::NT_wstring)
{
be_string *str =
dynamic_cast<be_string*> (prim_type);
Expand Down Expand Up @@ -708,9 +737,18 @@ be_sequence::gen_base_class_name (TAO_OutStream *os,
break;
default:
{
be_type *const base_type = primitive_base_type ();
if (!base_type)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_sequence::"
"gen_base_class_name - "
"Bad element type\n"),
-1);
}

const char *tag = "";
be_type *const base_type = dynamic_cast<be_type*> (primitive_base_type ());
if (base_type && base_type->node_type () == AST_Decl::NT_pre_defined)
if (base_type->node_type () == AST_Decl::NT_pre_defined)
{
be_predefined_type *const predefined_type =
dynamic_cast<be_predefined_type*> (base_type);
Expand Down
3 changes: 3 additions & 0 deletions TAO/TAO_IDL/be_include/be_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ class TAO_IDL_BE_Export BE_GlobalData
COREDX
};

static const char *const core_versioned_ns_begin;
static const char *const core_versioned_ns_end;

BE_GlobalData ();
~BE_GlobalData ();

Expand Down
8 changes: 7 additions & 1 deletion TAO/TAO_IDL/be_include/be_sequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,15 @@ class be_sequence : public virtual AST_Sequence,
bool local,
bool abstract);

// Non-virtual override of frontend method.
/// Non-virtual override of frontend method.
be_type *base_type () const;

/**
* Returns the fully dealiased base type if it's a typedef. If it's not a
* typedef, the it returns the same value as as base_type().
*/
be_type *primitive_base_type () const;

/// Create a name for ourselves. If we are typedefed, then we get the name of
/// the typedef node, else we generate a name for ourselves.
virtual int create_name (be_typedef *node);
Expand Down
2 changes: 0 additions & 2 deletions TAO/tao/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
/IOPC.cpp
/IOPC.h
/IOPS.h
/Int8Seq.pidl
/Int8SeqC.cpp
/Int8SeqC.h
/Int8SeqS.h
Expand Down Expand Up @@ -97,7 +96,6 @@
/TimeBaseC.cpp
/TimeBaseC.h
/TimeBaseS.h
/UInt8Seq.pidl
/UInt8SeqC.cpp
/UInt8SeqC.h
/UInt8SeqS.h
Expand Down
7 changes: 5 additions & 2 deletions TAO/tao/AnyTypeCode/AnyTypeCode.mpc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ project(AnyTypeCode) : taolib, tao_output, install, extra_anytypecode, taoidldef
FloatSeqA.cpp
GIOPA.cpp
IIOPA.cpp
IOPA.cpp
IIOP_EndpointsA.cpp
IOPA.cpp
Indirected_Type_TypeCode.cpp
Int8SeqA.cpp
LongDoubleSeqA.cpp
LongLongSeqA.cpp
LongSeqA.cpp
Expand Down Expand Up @@ -93,6 +94,7 @@ project(AnyTypeCode) : taolib, tao_output, install, extra_anytypecode, taoidldef
TypeCodeA.cpp
TypeCode_CDR_Extraction.cpp
TypeCode_Constants.cpp
UInt8SeqA.cpp
ULongLongSeqA.cpp
ULongSeqA.cpp
Union_TypeCode_Static.cpp
Expand All @@ -117,9 +119,9 @@ project(AnyTypeCode) : taolib, tao_output, install, extra_anytypecode, taoidldef
DoubleSeqA.h
FloatSeqA.h
IIOPA.h
IOPA.h
IIOP_EndpointsA.h
IOPA.h
Int8SeqA.h
LongDoubleSeqA.h
LongLongSeqA.h
LongSeqA.h
Expand All @@ -139,6 +141,7 @@ project(AnyTypeCode) : taolib, tao_output, install, extra_anytypecode, taoidldef
StringSeqA.h
TAOA.h
TimeBaseA.h
UInt8SeqA.h
ULongLongSeqA.h
ULongSeqA.h
UShortSeqA.h
Expand Down
2 changes: 2 additions & 0 deletions TAO/tao/AnyTypeCode/TypeCode_Constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ namespace CORBA
TypeCode_ptr const _tc_wchar = &TAO::TypeCode::tc_wchar;
TypeCode_ptr const _tc_short = &TAO::TypeCode::tc_short;
TypeCode_ptr const _tc_ushort = &TAO::TypeCode::tc_ushort;
TypeCode_ptr const _tc_int8 = nullptr;
TypeCode_ptr const _tc_uint8 = nullptr;
TypeCode_ptr const _tc_long = &TAO::TypeCode::tc_long;
TypeCode_ptr const _tc_ulong = &TAO::TypeCode::tc_ulong;
TypeCode_ptr const _tc_longlong = &TAO::TypeCode::tc_longlong;
Expand Down
2 changes: 2 additions & 0 deletions TAO/tao/AnyTypeCode/TypeCode_Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ namespace CORBA
extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_boolean;
extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_char;
extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_wchar;
extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_int8;
extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_uint8;
extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_short;
extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_ushort;
extern TAO_AnyTypeCode_Export TypeCode_ptr const _tc_long;
Expand Down
11 changes: 11 additions & 0 deletions TAO/tao/Int8Seq.pidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef TAO_CORBA_INT8_SEQ_IDL
#define TAO_CORBA_INT8_SEQ_IDL

#pragma prefix "omg.org"

module CORBA
{
typedef sequence<int8> Int8Seq;
};

#endif /* TAO_CORBA_INT8_SEQ_IDL */
11 changes: 11 additions & 0 deletions TAO/tao/UInt8Seq.pidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef TAO_CORBA_UINT8_SEQ_IDL
#define TAO_CORBA_UINT8_SEQ_IDL

#pragma prefix "omg.org"

module CORBA
{
typedef sequence<uint8> UInt8Seq;
};

#endif /* TAO_CORBA_UINT8_SEQ_IDL */

0 comments on commit 70b28ba

Please sign in to comment.