diff options
author | Fred Hornsey <hornseyf@objectcomputing.com> | 2021-06-29 18:53:04 -0500 |
---|---|---|
committer | Fred Hornsey <hornseyf@objectcomputing.com> | 2021-06-29 18:53:04 -0500 |
commit | 70b28ba29efaed433c3bfbdca14332c39a99883c (patch) | |
tree | 5ed6b8bdf39cb6dbcfdb4d7977e0e6a9db14027b | |
parent | 2ed7fe7c1c6492c7f920581ec3ac8e7ec4278efd (diff) | |
download | ATCD-70b28ba29efaed433c3bfbdca14332c39a99883c.tar.gz |
Try to Fix Issues with int8/uint8
-rw-r--r-- | TAO/NEWS | 5 | ||||
-rw-r--r-- | TAO/TAO_IDL/ast/ast_sequence.cpp | 6 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_codegen.cpp | 6 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_global.cpp | 13 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_sequence.cpp | 54 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_global.h | 3 | ||||
-rw-r--r-- | TAO/TAO_IDL/be_include/be_sequence.h | 8 | ||||
-rw-r--r-- | TAO/tao/.gitignore | 2 | ||||
-rw-r--r-- | TAO/tao/AnyTypeCode/AnyTypeCode.mpc | 7 | ||||
-rw-r--r-- | TAO/tao/AnyTypeCode/TypeCode_Constants.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/AnyTypeCode/TypeCode_Constants.h | 2 | ||||
-rw-r--r-- | TAO/tao/Int8Seq.pidl | 11 | ||||
-rw-r--r-- | TAO/tao/UInt8Seq.pidl | 11 |
13 files changed, 108 insertions, 22 deletions
@@ -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 ==================================================== diff --git a/TAO/TAO_IDL/ast/ast_sequence.cpp b/TAO/TAO_IDL/ast/ast_sequence.cpp index d8b57129573..ed33c7094b6 100644 --- a/TAO/TAO_IDL/ast/ast_sequence.cpp +++ b/TAO/TAO_IDL/ast/ast_sequence.cpp @@ -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; diff --git a/TAO/TAO_IDL/be/be_codegen.cpp b/TAO/TAO_IDL/be/be_codegen.cpp index 07a3a0db99a..34150c8bd95 100644 --- a/TAO/TAO_IDL/be/be_codegen.cpp +++ b/TAO/TAO_IDL/be/be_codegen.cpp @@ -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 diff --git a/TAO/TAO_IDL/be/be_global.cpp b/TAO/TAO_IDL/be/be_global.cpp index 2aeaa3f633b..b29c9a85154 100644 --- a/TAO/TAO_IDL/be/be_global.cpp +++ b/TAO/TAO_IDL/be/be_global.cpp @@ -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), @@ -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_ (), @@ -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 @@ -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". diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp index abb53381d2b..64de99f0e02 100644 --- a/TAO/TAO_IDL/be/be_sequence.cpp +++ b/TAO/TAO_IDL/be/be_sequence.cpp @@ -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 () @@ -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) " @@ -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, @@ -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); @@ -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); @@ -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); diff --git a/TAO/TAO_IDL/be_include/be_global.h b/TAO/TAO_IDL/be_include/be_global.h index 01dfa862b74..a3a4a16d924 100644 --- a/TAO/TAO_IDL/be_include/be_global.h +++ b/TAO/TAO_IDL/be_include/be_global.h @@ -55,6 +55,9 @@ public: COREDX }; + static const char *const core_versioned_ns_begin; + static const char *const core_versioned_ns_end; + BE_GlobalData (); ~BE_GlobalData (); diff --git a/TAO/TAO_IDL/be_include/be_sequence.h b/TAO/TAO_IDL/be_include/be_sequence.h index 6d2deb80317..7bce2c9e839 100644 --- a/TAO/TAO_IDL/be_include/be_sequence.h +++ b/TAO/TAO_IDL/be_include/be_sequence.h @@ -53,9 +53,15 @@ public: 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); diff --git a/TAO/tao/.gitignore b/TAO/tao/.gitignore index 8a019505f28..2e8d674c148 100644 --- a/TAO/tao/.gitignore +++ b/TAO/tao/.gitignore @@ -33,7 +33,6 @@ /IOPC.cpp /IOPC.h /IOPS.h -/Int8Seq.pidl /Int8SeqC.cpp /Int8SeqC.h /Int8SeqS.h @@ -97,7 +96,6 @@ /TimeBaseC.cpp /TimeBaseC.h /TimeBaseS.h -/UInt8Seq.pidl /UInt8SeqC.cpp /UInt8SeqC.h /UInt8SeqS.h diff --git a/TAO/tao/AnyTypeCode/AnyTypeCode.mpc b/TAO/tao/AnyTypeCode/AnyTypeCode.mpc index aab09a00a2f..6555efd66b7 100644 --- a/TAO/tao/AnyTypeCode/AnyTypeCode.mpc +++ b/TAO/tao/AnyTypeCode/AnyTypeCode.mpc @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/TAO/tao/AnyTypeCode/TypeCode_Constants.cpp b/TAO/tao/AnyTypeCode/TypeCode_Constants.cpp index 45f10d386e2..da113fb0934 100644 --- a/TAO/tao/AnyTypeCode/TypeCode_Constants.cpp +++ b/TAO/tao/AnyTypeCode/TypeCode_Constants.cpp @@ -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; diff --git a/TAO/tao/AnyTypeCode/TypeCode_Constants.h b/TAO/tao/AnyTypeCode/TypeCode_Constants.h index 78520ca9669..0444ec9866f 100644 --- a/TAO/tao/AnyTypeCode/TypeCode_Constants.h +++ b/TAO/tao/AnyTypeCode/TypeCode_Constants.h @@ -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; diff --git a/TAO/tao/Int8Seq.pidl b/TAO/tao/Int8Seq.pidl new file mode 100644 index 00000000000..a970dcbf55e --- /dev/null +++ b/TAO/tao/Int8Seq.pidl @@ -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 */ diff --git a/TAO/tao/UInt8Seq.pidl b/TAO/tao/UInt8Seq.pidl new file mode 100644 index 00000000000..e43b19c2656 --- /dev/null +++ b/TAO/tao/UInt8Seq.pidl @@ -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 */ |