Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLv4 Explicitly-named Integer Types #840

Merged
merged 21 commits into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8f4fcb1
TAO_IDL: IDL4 stdint-like Integers
iguessthislldo Dec 21, 2018
c7a6292
Add new limits for new types to Basic_Types.h
iguessthislldo Feb 21, 2019
ce28b30
ast_constant.cpp: Move C++ specific code out of the FE
iguessthislldo Feb 21, 2019
d004d8d
Adding Files As is For Merge
iguessthislldo Jun 7, 2019
9d2523a
Merge remote-tracking branch 'upstream/master' into igtd/stdint
iguessthislldo Jun 7, 2019
7549f0b
tao_idl: Committing Parser as is
iguessthislldo Jun 7, 2019
85a1e61
Merge remote-tracking branch 'upstream/master' into igtd/stdint
iguessthislldo Jun 7, 2021
a4c5b22
Added WIP explicit_ints Test
iguessthislldo Jun 8, 2021
56a61b9
Fix Issues with explicit_ints Test
iguessthislldo Jun 13, 2021
e994776
CDR_Stream.h: Fix Arg Type
iguessthislldo Jun 13, 2021
2afc6a2
Fix Warnings, Add explicit_ints to Test List
iguessthislldo Jun 13, 2021
737b919
Partially Respond to Review of #840
iguessthislldo Jun 14, 2021
2280b39
Respond to Review of #840
iguessthislldo Jun 14, 2021
7471fc9
ast_expression.cpp: Add Include for sprintf
iguessthislldo Jun 15, 2021
800cec4
s/Uint/UInt/g
iguessthislldo Jun 15, 2021
65962ee
Isolate IDL4 Ints in TAO Unless IDL4 is Used
iguessthislldo Jun 15, 2021
71f7ce0
Respond to Review of #840
iguessthislldo Jun 15, 2021
b489eef
explicit_ints: Fix Mixup
iguessthislldo Jun 15, 2021
2ed7fe7
Support int8/uint8 Sequences and Arrays
iguessthislldo Jun 22, 2021
70b28ba
Try to Fix Issues with int8/uint8
iguessthislldo Jun 29, 2021
354b698
Fix Issue with No Inlining
iguessthislldo Jun 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions ACE/ace/Basic_Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -562,18 +562,21 @@ ACE_END_VERSIONED_NAMESPACE_DECL
# endif /* ACE_SIZEOF_LONG_DOUBLE */

// Max and min sizes for the ACE integer types.
#define ACE_CHAR_MAX 0x7F
#define ACE_CHAR_MIN -(ACE_CHAR_MAX)-1
#define ACE_OCTET_MAX 0xFF
#define ACE_INT8_MAX 0x7F
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should convert these to constexpr at some point

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should, but I'd like that to be later because I don't want to make this harder to backport than it already is.

#define ACE_INT8_MIN -(ACE_INT8_MAX) - 1
#define ACE_UINT8_MAX 0xFF
#define ACE_CHAR_MAX (ACE_INT8_MAX)
#define ACE_CHAR_MIN (ACE_INT8_MIN)
#define ACE_OCTET_MAX (ACE_UINT8_MAX)
#define ACE_INT16_MAX 0x7FFF
#define ACE_INT16_MIN -(ACE_INT16_MAX)-1
#define ACE_INT16_MIN -(ACE_INT16_MAX) - 1
#define ACE_UINT16_MAX 0xFFFF
#define ACE_WCHAR_MAX ACE_UINT16_MAX
#define ACE_INT32_MAX 0x7FFFFFFF
#define ACE_INT32_MIN -(ACE_INT32_MAX)-1
#define ACE_INT32_MIN -(ACE_INT32_MAX) - 1
#define ACE_UINT32_MAX 0xFFFFFFFF
#define ACE_INT64_MAX ACE_INT64_LITERAL(0x7FFFFFFFFFFFFFFF)
#define ACE_INT64_MIN -(ACE_INT64_MAX)-1
#define ACE_INT64_MIN -(ACE_INT64_MAX) - 1
#define ACE_UINT64_MAX ACE_UINT64_LITERAL (0xFFFFFFFFFFFFFFFF)

// These use ANSI/IEEE format.
Expand Down
10 changes: 9 additions & 1 deletion ACE/ace/CDR_Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class ACE_Export ACE_CDR
*/
//@{
typedef bool Boolean;
typedef unsigned char Octet;
typedef ACE_Byte Octet;
typedef char Char;
typedef ACE_WCHAR_T WChar;
typedef ACE_INT16 Short;
Expand All @@ -207,6 +207,14 @@ class ACE_Export ACE_CDR
typedef ACE_UINT32 ULong;
typedef ACE_INT64 LongLong;
typedef ACE_UINT64 ULongLong;
typedef ACE_INT8 Int8;
typedef ACE_UINT8 UInt8;
typedef Short Int16;
typedef UShort Uint16;
typedef Long Int32;
typedef ULong Uint32;
iguessthislldo marked this conversation as resolved.
Show resolved Hide resolved
typedef LongLong Int64;
typedef ULongLong Uint64;

# if ACE_SIZEOF_FLOAT == 4
typedef float Float;
Expand Down
12 changes: 12 additions & 0 deletions ACE/ace/CDR_Stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ class ACE_Export ACE_OutputCDR
ACE_CDR::Boolean write_double (const ACE_CDR::Double &x);
ACE_CDR::Boolean write_longdouble (const ACE_CDR::LongDouble &x);
ACE_CDR::Boolean write_fixed (const ACE_CDR::Fixed &x);
ACE_CDR::Boolean write_int8 (ACE_CDR::Int8 x);
ACE_CDR::Boolean write_uint8 (ACE_CDR::UInt8 x);

/// For string we offer methods that accept a precomputed length.
ACE_CDR::Boolean write_string (const ACE_CDR::Char *x);
Expand Down Expand Up @@ -306,6 +308,8 @@ class ACE_Export ACE_OutputCDR
ACE_CDR::ULong length);
ACE_CDR::Boolean write_longdouble_array (const ACE_CDR::LongDouble* x,
ACE_CDR::ULong length);
ACE_CDR::Boolean write_int8_array (const ACE_CDR::Int8 *x, ACE_CDR::ULong length);
ACE_CDR::Boolean write_uint8_array (const ACE_CDR::UInt8 *x, ACE_CDR::ULong length);

/// Write an octet array contained inside a MB, this can be optimized
/// to minimize copies.
Expand Down Expand Up @@ -857,6 +861,8 @@ class ACE_Export ACE_InputCDR
ACE_CDR::Boolean read_double (ACE_CDR::Double &x);
ACE_CDR::Boolean read_longdouble (ACE_CDR::LongDouble &x);
ACE_CDR::Boolean read_fixed (ACE_CDR::Fixed &x);
ACE_CDR::Boolean read_int8 (ACE_CDR::Int8 &x);
ACE_CDR::Boolean read_uint8 (ACE_CDR::UInt8 &x);

ACE_CDR::Boolean read_string (ACE_CDR::Char *&x);
ACE_CDR::Boolean read_string (ACE_CString &x);
Expand Down Expand Up @@ -899,6 +905,8 @@ class ACE_Export ACE_InputCDR
ACE_CDR::ULong length);
ACE_CDR::Boolean read_longdouble_array (ACE_CDR::LongDouble* x,
ACE_CDR::ULong length);
ACE_CDR::Boolean read_int8_array (ACE_CDR::Int8 *x, ACE_CDR::ULong length);
ACE_CDR::Boolean read_uint8_array (ACE_CDR::UInt8 *x, ACE_CDR::ULong length);
//@}

/**
Expand Down Expand Up @@ -1384,6 +1392,8 @@ extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
ACE_CDR::Double x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os,
const ACE_CDR::Fixed &x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, ACE_CDR::UInt8 x);
extern ACE_Export ACE_CDR::Boolean operator<< (ACE_OutputCDR &os, ACE_CDR::Int8 x);

// CDR output operator from helper classes

Expand Down Expand Up @@ -1439,6 +1449,8 @@ extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Double &x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &is,
ACE_CDR::Fixed &x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &os, ACE_CDR::UInt8 &x);
extern ACE_Export ACE_CDR::Boolean operator>> (ACE_InputCDR &os, ACE_CDR::Int8 &x);

// CDR input operator from helper classes

Expand Down
86 changes: 86 additions & 0 deletions ACE/ace/CDR_Stream.inl
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,18 @@ ACE_OutputCDR::write_wstring (const std::wstring &x)
}
#endif

ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_int8 (ACE_CDR::Int8 x)
{
return this->write_1 (reinterpret_cast<ACE_CDR::Octet *> (&x));
}

ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_uint8 (ACE_CDR::UInt8 x)
{
return this->write_1 (reinterpret_cast<ACE_CDR::Octet *> (&x));
}

ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_char_array (const ACE_CDR::Char *x,
ACE_CDR::ULong length)
Expand Down Expand Up @@ -491,6 +503,18 @@ ACE_OutputCDR::write_longdouble_array (const ACE_CDR::LongDouble* x,
length);
}

ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_int8_array (const ACE_CDR::Int8 *x, ACE_CDR::ULong length)
{
return write_array (x, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, length);
}

ACE_INLINE ACE_CDR::Boolean
ACE_OutputCDR::write_uint8_array (const ACE_CDR::UInt8 *x, ACE_CDR::ULong length)
{
return write_array (x, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, length);
}

ACE_INLINE bool
ACE_OutputCDR::good_bit () const
{
Expand Down Expand Up @@ -791,6 +815,18 @@ ACE_InputCDR::read_fixed (ACE_CDR::Fixed &x)
return false;
}

ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_int8 (ACE_CDR::Int8 &x)
{
return read_1 (reinterpret_cast<ACE_CDR::Octet *>(&x));
}

ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_uint8 (ACE_CDR::UInt8 &x)
{
return read_1 (reinterpret_cast<ACE_CDR::Octet *>(&x));
}

ACE_INLINE size_t
ACE_InputCDR::length () const
{
Expand Down Expand Up @@ -1021,6 +1057,30 @@ ACE_InputCDR::read_longdouble_array (ACE_CDR::LongDouble* x,
length);
}

ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_int8_array (ACE_CDR::Int8 *x, ACE_CDR::ULong length)
{
if (length * ACE_CDR::OCTET_SIZE > this->length ())
{
this->good_bit_ = false;
return false;
}

return read_array (x, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, length);
}

ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::read_uint8_array (ACE_CDR::UInt8 *x, ACE_CDR::ULong length)
{
if (length * ACE_CDR::OCTET_SIZE > this->length ())
{
this->good_bit_ = false;
return false;
}

return read_array (x, ACE_CDR::OCTET_SIZE, ACE_CDR::OCTET_ALIGN, length);
}

ACE_INLINE ACE_CDR::Boolean
ACE_InputCDR::skip_octet ()
{
Expand Down Expand Up @@ -1314,6 +1374,20 @@ operator<< (ACE_OutputCDR &os, const std::wstring& x)
}
#endif

ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::UInt8 x)
{
os.write_uint8 (x);
return (ACE_CDR::Boolean) os.good_bit ();
}

ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_CDR::Int8 x)
{
os.write_int8 (x);
return (ACE_CDR::Boolean) os.good_bit ();
}

// The following use the helper classes
ACE_INLINE ACE_CDR::Boolean
operator<< (ACE_OutputCDR &os, ACE_OutputCDR::from_boolean x)
Expand Down Expand Up @@ -1467,6 +1541,18 @@ operator>> (ACE_InputCDR &is, std::wstring& x)
}
#endif

ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::UInt8 &x)
{
return is.read_uint8 (x) && is.good_bit ();
}

ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_CDR::Int8 &x)
{
return is.read_int8 (x) && is.good_bit ();
}

// The following use the helper classes
ACE_INLINE ACE_CDR::Boolean
operator>> (ACE_InputCDR &is, ACE_InputCDR::to_boolean x)
Expand Down
93 changes: 1 addition & 92 deletions TAO/TAO_IDL/ast/ast_constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,51 +77,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc.

// Static functions.

// Convert a value from the enum AST_Expression::ExprType to a char *.
const char *
AST_Constant::exprtype_to_string (AST_Expression::ExprType et)
{
switch (et)
{
case AST_Expression::EV_short:
return "Short";
case AST_Expression::EV_ushort:
return "UShort";
case AST_Expression::EV_long:
return "Long";
case AST_Expression::EV_ulong:
return "ULong";
case AST_Expression::EV_float:
return "Float";
case AST_Expression::EV_double:
return "Double";
case AST_Expression::EV_char:
return "Char";
case AST_Expression::EV_octet:
return "Octet";
case AST_Expression::EV_bool:
return "Boolean";
case AST_Expression::EV_string:
return "Char*";
case AST_Expression::EV_ulonglong:
return "ULongLong";
case AST_Expression::EV_longlong:
return "LongLong";
case AST_Expression::EV_wchar:
return "Wchar";
case AST_Expression::EV_wstring:
return "Wchar*";
case AST_Expression::EV_longdouble:
return "LongDouble";
case AST_Expression::EV_fixed:
return "Fixed";
default:
break;
}

return nullptr;
}

AST_Decl::NodeType const
AST_Constant::NT = AST_Decl::NT_const;

Expand Down Expand Up @@ -182,7 +137,7 @@ void
AST_Constant::dump (ACE_OSTREAM_TYPE &o)
{
this->dump_i (o, "const ");
this->dump_i (o, this->exprtype_to_string ());
dump_i (o, AST_Expression::exprtype_to_string (pd_et));
this->dump_i (o, " ");

this->local_name ()->dump (o);
Expand Down Expand Up @@ -237,52 +192,6 @@ AST_Constant::ifr_added (bool val)
this->ifr_added_ = val;
}

const char *
AST_Constant::exprtype_to_string ()
{
switch (this->pd_et)
{
case AST_Expression::EV_short:
return "CORBA::Short";
case AST_Expression::EV_ushort:
return "CORBA::UShort";
case AST_Expression::EV_long:
return "CORBA::Long";
case AST_Expression::EV_ulong:
return "CORBA::ULong";
case AST_Expression::EV_float:
return "CORBA::Float";
case AST_Expression::EV_double:
return "CORBA::Double";
case AST_Expression::EV_char:
return "CORBA::Char";
case AST_Expression::EV_octet:
return "CORBA::Octet";
case AST_Expression::EV_bool:
return "CORBA::Boolean";
case AST_Expression::EV_string:
return "char *const";
case AST_Expression::EV_void:
return "void";
case AST_Expression::EV_none:
return "none";
case AST_Expression::EV_longlong:
return "CORBA::LongLong";
case AST_Expression::EV_ulonglong:
return "CORBA::ULongLong";
case AST_Expression::EV_wchar:
return "CORBA::WChar";
case AST_Expression::EV_wstring:
return "CORBA::WChar *const";
case AST_Expression::EV_fixed:
return "Fixed";
default:
return nullptr;
}

return nullptr;
}

UTL_ScopedName *
AST_Constant::enum_full_name ()
{
Expand Down
Loading