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

Minor Additions to IDL4 Support #2244

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
12 changes: 12 additions & 0 deletions TAO/NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
USER VISIBLE CHANGES BETWEEN TAO-4.0.0 and TAO-4.0.1
====================================================

- TAO_IDL:
iguessthislldo marked this conversation as resolved.
Show resolved Hide resolved
- Support the following IDL v4 features:
- Empty structs
- `octet` and `wchar` union discriminators
- Allow using empty parentheses in annotation applications to
workaround syntax errors when an annotation with no arguments has to
be followed by a complete scoped name:
`@example_annotation() ::ex::ExampleType`
- Reserve the `bitfield`, `bitmask`, and `bitset` keywords in IDL v4
(these are not implemented yet)
- Allow using `map` as an identifier in IDL v3 again

USER VISIBLE CHANGES BETWEEN TAO-3.1.4 and TAO-4.0.0
====================================================

Expand Down
2 changes: 2 additions & 0 deletions TAO/TAO_IDL/be/be_union.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,12 @@ be_union::gen_empty_default_label ()
return (n_labels < 2);

case AST_PredefinedType::PT_char:
case AST_PredefinedType::PT_octet:
return (n_labels <= ACE_OCTET_MAX);

case AST_PredefinedType::PT_short:
case AST_PredefinedType::PT_ushort:
case AST_PredefinedType::PT_wchar:
return (n_labels <= ACE_UINT16_MAX);

case AST_PredefinedType::PT_long:
Expand Down
1 change: 1 addition & 0 deletions TAO/TAO_IDL/be/be_union_branch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ be_union_branch::gen_default_label_value (TAO_OutStream *os,
*os << dv.u.short_val;
break;
case AST_Expression::EV_ushort:
case AST_Expression::EV_wchar:
*os << dv.u.ushort_val;
break;
case AST_Expression::EV_long:
Expand Down
15 changes: 9 additions & 6 deletions TAO/TAO_IDL/be/be_visitor_structure/cdr_op_cs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ be_visitor_structure_cdr_op_cs::visit_structure (be_structure *node)
<< "TAO_OutputCDR &strm," << be_nl
<< "const " << node->name () << " &_tao_aggregate)" << be_uidt
<< be_uidt_nl
<< "{" << be_idt_nl;
<< "{" << be_idt_nl
<< "ACE_UNUSED_ARG(strm);" << be_nl
iguessthislldo marked this conversation as resolved.
Show resolved Hide resolved
<< "ACE_UNUSED_ARG(_tao_aggregate);" << be_nl;

be_visitor_context new_ctx (*this->ctx_);
be_visitor_cdr_op_field_decl field_decl (&new_ctx);
Expand All @@ -81,7 +83,7 @@ be_visitor_structure_cdr_op_cs::visit_structure (be_structure *node)
-1);
}

*os << ";" << be_uidt << be_uidt_nl
*os << "true;" << be_uidt << be_uidt_nl
jwillemsen marked this conversation as resolved.
Show resolved Hide resolved
<< "}" << be_nl_2;

// Set the substate as generating code for the input operator.
Expand All @@ -104,7 +106,9 @@ be_visitor_structure_cdr_op_cs::visit_structure (be_structure *node)
}

*os << ")" << be_uidt << be_uidt_nl
<< "{" << be_idt_nl;
<< "{" << be_idt_nl
<< "ACE_UNUSED_ARG(strm);" << be_nl
<< "ACE_UNUSED_ARG(_tao_aggregate);" << be_nl;

if (node->is_local ())
{
Expand Down Expand Up @@ -135,7 +139,7 @@ be_visitor_structure_cdr_op_cs::visit_structure (be_structure *node)
-1);
}

*os << ";" << be_uidt << be_uidt;
*os << "true;" << be_uidt << be_uidt;
}

*os << be_uidt_nl << "}" << be_nl;
Expand All @@ -157,8 +161,7 @@ be_visitor_structure_cdr_op_cs::post_process (be_decl *bd)
{
TAO_OutStream *os = this->ctx_->stream ();

if (!this->last_node (bd)
&& bd->node_type () != AST_Decl::NT_enum_val)
if (bd->node_type () != AST_Decl::NT_enum_val)
{
switch (this->ctx_->sub_state ())
{
Expand Down
3 changes: 3 additions & 0 deletions TAO/TAO_IDL/be/be_visitor_union/cdr_op_cs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ namespace {
case AST_Expression::EV_int8:
tmp_suffix = "int8";
break;
case AST_Expression::EV_octet:
tmp_suffix = "octet";
break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions TAO/TAO_IDL/be/be_visitor_union/discriminant_ci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ be_visitor_union_discriminant_ci::visit_predefined_type (
*os << dv.u.short_val;
break;
case AST_Expression::EV_ushort:
case AST_Expression::EV_wchar:
*os << dv.u.ushort_val;
break;
case AST_Expression::EV_long:
Expand Down
2 changes: 1 addition & 1 deletion TAO/TAO_IDL/fe/fe_lookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
unsigned int
TAO_IDL_CPP_Keyword_Table::hash (const char *str, unsigned int len)
{
static const unsigned char asso_values[] =
static constexpr unsigned char asso_values[] =
{
252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
Expand Down
90 changes: 16 additions & 74 deletions TAO/TAO_IDL/fe/idl.ll
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ static AST_Decl * idl_find_node (const char *);
#undef ECHO
#endif

#define IDL4_KEYWORD(TOKEN_NAME) if (idl_global->idl_version_ >= IDL_VERSION_4) return TOKEN_NAME;

%}

/* SO we don't choke on files that use \r\n */
Expand All @@ -138,7 +140,6 @@ enum return IDL_ENUM;
string return IDL_STRING;
wstring return IDL_WSTRING;
sequence return IDL_SEQUENCE;
map return IDL_MAP;
union return IDL_UNION;
fixed return IDL_FIXED;
switch return IDL_SWITCH;
Expand All @@ -158,79 +159,6 @@ native return IDL_NATIVE;
local return IDL_LOCAL;
abstract return IDL_ABSTRACT;

int8 {
if (idl_global->idl_version_ >= IDL_VERSION_4)
return IDL_INT8;
else
{
REJECT;
}
}
uint8 {
if (idl_global->idl_version_ >= IDL_VERSION_4)
return IDL_UINT8;
else
{
REJECT;
}
}
int16 {
if (idl_global->idl_version_ >= IDL_VERSION_4)
return IDL_INT16;
else
{
REJECT;
}
}
uint16 {
if (idl_global->idl_version_ >= IDL_VERSION_4)
return IDL_UINT16;
else
{
REJECT;
}
}
int32 {
if (idl_global->idl_version_ >= IDL_VERSION_4)
return IDL_INT32;
else
{
REJECT;
}
}
uint32 {
if (idl_global->idl_version_ >= IDL_VERSION_4)
return IDL_UINT32;
else
{
REJECT;
}
}
int64 {
if (idl_global->idl_version_ >= IDL_VERSION_4)
return IDL_INT64;
else
{
REJECT;
}
}
uint64 {
if (idl_global->idl_version_ >= IDL_VERSION_4)
return IDL_UINT64;
else
{
REJECT;
}
}
map {
if (idl_global->idl_version_ >= IDL_VERSION_4)
return IDL_MAP;
else
{
REJECT;
}
}

custom return IDL_CUSTOM;
factory return IDL_FACTORY;
private return IDL_PRIVATE;
Expand Down Expand Up @@ -282,6 +210,20 @@ oneway return IDL_ONEWAY;
@annotation[^A-Za-z0-9_] return IDL_ANNOTATION_DECL; // Allow annotation names that start with "annotation"
@ return IDL_ANNOTATION_SYMBOL;

int8 IDL4_KEYWORD(IDL_INT8); REJECT;
uint8 IDL4_KEYWORD(IDL_UINT8); REJECT;
int16 IDL4_KEYWORD(IDL_INT16); REJECT;
uint16 IDL4_KEYWORD(IDL_UINT16); REJECT;
int32 IDL4_KEYWORD(IDL_INT32); REJECT;
uint32 IDL4_KEYWORD(IDL_UINT32); REJECT;
int64 IDL4_KEYWORD(IDL_INT64); REJECT;
uint64 IDL4_KEYWORD(IDL_UINT64); REJECT;

bitfield IDL4_KEYWORD(IDL_BITFIELD); REJECT;
bitmask IDL4_KEYWORD(IDL_BITMASK); REJECT;
bitset IDL4_KEYWORD(IDL_BITSET); REJECT;
map IDL4_KEYWORD(IDL_MAP); REJECT;

[a-ij-rs-zA-IJ-RS-Z_][a-ij-rs-zA-IJ-RS-Z0-9_]* {
// Make sure that this identifier is not a C++ keyword. If it is,
// prepend it with a _cxx_. Lookup in the perfect hash table for C++
Expand Down
Loading
Loading