diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-05-24 02:50:40 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-05-24 02:50:40 +0000 |
commit | 8bb48b274ff2be8834627b09d8db10fd2124e075 (patch) | |
tree | df64bf401ce34eb0b00eab09e5bc8908b92aa71e | |
parent | 7d0fb960ba7cf79e11ba4977ae2ec389395a367b (diff) | |
download | ATCD-8bb48b274ff2be8834627b09d8db10fd2124e075.tar.gz |
ChangeLogTag: Wed May 23 21:27:28 2001 Jeff Parsons <parsons@cs.wustl.edu>
32 files changed, 709 insertions, 602 deletions
diff --git a/TAO/TAO_IDL/ast/ast_decl.cpp b/TAO/TAO_IDL/ast/ast_decl.cpp index b19f564b5e6..060389221a3 100644 --- a/TAO/TAO_IDL/ast/ast_decl.cpp +++ b/TAO/TAO_IDL/ast/ast_decl.cpp @@ -748,10 +748,7 @@ AST_Decl::compute_name (const char *prefix, // Identifier for the resulting local name. Identifier *result_local_id = 0; ACE_NEW_RETURN (result_local_id, - Identifier (result_local_str.c_str (), - 1, - 0, - I_FALSE), + Identifier (result_local_str.c_str ()), 0); // UTL_Scoped name for the resulting local name. @@ -837,10 +834,7 @@ AST_Decl::compute_local_name (const char *prefix, // Identifier for the resulting local name. Identifier *result_id = 0; ACE_NEW_RETURN (result_id, - Identifier (result_str.c_str (), - 1, - 0, - I_FALSE), + Identifier (result_str.c_str ()), 0); return result_id; @@ -868,10 +862,7 @@ AST_Decl::original_local_name (Identifier *local_name) // Assign to the Identifier variable. ACE_NEW (this->pd_original_local_name, - Identifier (name_str.c_str (), - 1, - 0, - I_FALSE)); + Identifier (name_str.c_str ())); } else { diff --git a/TAO/TAO_IDL/ast/ast_module.cpp b/TAO/TAO_IDL/ast/ast_module.cpp index 98089a900d6..bed4a9aeb23 100644 --- a/TAO/TAO_IDL/ast/ast_module.cpp +++ b/TAO/TAO_IDL/ast/ast_module.cpp @@ -799,10 +799,7 @@ AST_Module::add_CORBA_members (void) Identifier *id = 0; ACE_NEW (id, - Identifier ("TypeCode", - 1, - 0, - I_FALSE)); + Identifier ("TypeCode")); ACE_NEW (sn, UTL_ScopedName (id, @@ -818,10 +815,7 @@ AST_Module::add_CORBA_members (void) this->fe_add_predefined_type (pdt); ACE_NEW (id, - Identifier ("TCKind", - 1, - 0, - I_FALSE)); + Identifier ("TCKind")); ACE_NEW (sn, UTL_ScopedName (id, @@ -840,10 +834,7 @@ AST_Module::add_CORBA_members (void) if (idl_global->obv_support ()) { ACE_NEW (id, - Identifier ("ValueBase", - 1, - 0, - I_FALSE)); + Identifier ("ValueBase")); ACE_NEW (sn, UTL_ScopedName (id, diff --git a/TAO/TAO_IDL/ast/ast_root.cpp b/TAO/TAO_IDL/ast/ast_root.cpp index 98c9a8be645..60fcccfdce4 100644 --- a/TAO/TAO_IDL/ast/ast_root.cpp +++ b/TAO/TAO_IDL/ast/ast_root.cpp @@ -105,10 +105,7 @@ AST_Root::fe_add_sequence (AST_Sequence *t) Identifier *id = 0; ACE_NEW_RETURN (id, - Identifier ("local type", - 1, - 0, - I_FALSE), + Identifier ("local type"), 0); UTL_ScopedName *sn = 0; @@ -133,10 +130,7 @@ AST_Root::fe_add_string (AST_String *t) Identifier *id = 0; ACE_NEW_RETURN (id, - Identifier ("local type", - 1, - 0, - I_FALSE), + Identifier ("local type"), 0); UTL_ScopedName *sn = 0; @@ -161,10 +155,7 @@ AST_Root::fe_add_array (AST_Array *t) Identifier *id = 0; ACE_NEW_RETURN (id, - Identifier ("local type", - 1, - 0, - I_FALSE), + Identifier ("local type"), 0); UTL_ScopedName *sn = 0; diff --git a/TAO/TAO_IDL/ast/ast_sequence.cpp b/TAO/TAO_IDL/ast/ast_sequence.cpp index 5848d510cf4..8671c214961 100644 --- a/TAO/TAO_IDL/ast/ast_sequence.cpp +++ b/TAO/TAO_IDL/ast/ast_sequence.cpp @@ -87,10 +87,7 @@ AST_Sequence::AST_Sequence (AST_Expression *ms, idl_bool local, idl_bool abstract) : AST_Decl(AST_Decl::NT_sequence, - new UTL_ScopedName (new Identifier ("sequence", - 1, - 0, - I_FALSE), + new UTL_ScopedName (new Identifier ("sequence"), 0), 0, I_TRUE), diff --git a/TAO/TAO_IDL/ast/ast_string.cpp b/TAO/TAO_IDL/ast/ast_string.cpp index 808ded87706..0f179f000a7 100644 --- a/TAO/TAO_IDL/ast/ast_string.cpp +++ b/TAO/TAO_IDL/ast/ast_string.cpp @@ -82,10 +82,7 @@ AST_String::AST_String (void) AST_String::AST_String (AST_Expression *ms) : AST_Decl (AST_Decl::NT_string, - new UTL_ScopedName (new Identifier ("string", - 1, - 0, - I_FALSE), + new UTL_ScopedName (new Identifier ("string"), 0), 0, I_TRUE), @@ -100,14 +97,8 @@ AST_String::AST_String (AST_Expression *ms, ? AST_Decl::NT_string : AST_Decl::NT_wstring, new UTL_ScopedName (wide == (long) sizeof (char) - ? new Identifier ("string", - 1, - 0, - I_FALSE) - : new Identifier ("wstring", - 1, - 0, - I_FALSE), + ? new Identifier ("string") + : new Identifier ("wstring"), 0), 0, I_TRUE), diff --git a/TAO/TAO_IDL/be/be_array.cpp b/TAO/TAO_IDL/be/be_array.cpp index 9c08bcdfb22..04a32cf5e51 100644 --- a/TAO/TAO_IDL/be/be_array.cpp +++ b/TAO/TAO_IDL/be/be_array.cpp @@ -175,9 +175,7 @@ be_array::create_name (void) n = (UTL_ScopedName *)scope->name ()->copy () ; // add our local name as the last component - n->nconc (new UTL_ScopedName (new Identifier (ACE_OS::strdup - (namebuf), 1, - 0, I_FALSE), + n->nconc (new UTL_ScopedName (new Identifier (ACE_OS::strdup (namebuf)), NULL)); // set the fully scoped name this->set_name (n); diff --git a/TAO/TAO_IDL/be/be_predefined_type.cpp b/TAO/TAO_IDL/be/be_predefined_type.cpp index b1f7675d6c3..18fe835b145 100644 --- a/TAO/TAO_IDL/be/be_predefined_type.cpp +++ b/TAO/TAO_IDL/be/be_predefined_type.cpp @@ -46,10 +46,7 @@ be_predefined_type::be_predefined_type (AST_PredefinedType::PredefinedType t, { Identifier *corba_id = 0; ACE_NEW (corba_id, - Identifier ("CORBA", - 1, - 0, - I_FALSE)); + Identifier ("CORBA")); UTL_ScopedName *new_name = 0; ACE_NEW (new_name, @@ -63,115 +60,67 @@ be_predefined_type::be_predefined_type (AST_PredefinedType::PredefinedType t, { case AST_PredefinedType::PT_long: ACE_NEW (id, - Identifier ("Long", - 1, - 0, - I_FALSE)); + Identifier ("Long")); break; case AST_PredefinedType::PT_ulong: ACE_NEW (id, - Identifier ("ULong", - 1, - 0, - I_FALSE)); + Identifier ("ULong")); break; case AST_PredefinedType::PT_short: ACE_NEW (id, - Identifier ("Short", - 1, - 0, - I_FALSE)); + Identifier ("Short")); break; case AST_PredefinedType::PT_ushort: ACE_NEW (id, - Identifier ("UShort", - 1, - 0, - I_FALSE)); + Identifier ("UShort")); break; case AST_PredefinedType::PT_float: ACE_NEW (id, - Identifier ("Float", - 1, - 0, - I_FALSE)); + Identifier ("Float")); break; case AST_PredefinedType::PT_double: ACE_NEW (id, - Identifier ("Double", - 1, - 0, - I_FALSE)); + Identifier ("Double")); break; case AST_PredefinedType::PT_char: ACE_NEW (id, - Identifier ("Char", - 1, - 0, - I_FALSE)); + Identifier ("Char")); break; case AST_PredefinedType::PT_octet: ACE_NEW (id, - Identifier ("Octet", - 1, - 0, - I_FALSE)); + Identifier ("Octet")); break; case AST_PredefinedType::PT_wchar: ACE_NEW (id, - Identifier ("WChar", - 1, - 0, - I_FALSE)); + Identifier ("WChar")); break; case AST_PredefinedType::PT_boolean: ACE_NEW (id, - Identifier ("Boolean", - 1, - 0, - I_FALSE)); + Identifier ("Boolean")); break; case AST_PredefinedType::PT_longlong: ACE_NEW (id, - Identifier ("LongLong", - 1, - 0, - I_FALSE)); + Identifier ("LongLong")); break; case AST_PredefinedType::PT_ulonglong: ACE_NEW (id, - Identifier ("ULongLong", - 1, - 0, - I_FALSE)); + Identifier ("ULongLong")); break; case AST_PredefinedType::PT_longdouble: ACE_NEW (id, - Identifier ("LongDouble", - 1, - 0, - I_FALSE)); + Identifier ("LongDouble")); break; case AST_PredefinedType::PT_any: ACE_NEW (id, - Identifier ("Any", - 1, - 0, - I_FALSE)); + Identifier ("Any")); break; case AST_PredefinedType::PT_pseudo: ACE_NEW (id, - Identifier (n->last_component ()->get_string (), - 1, - 0, - I_FALSE)); + Identifier (n->last_component ()->get_string ())); break; default: ACE_NEW (id, - Identifier (this->local_name ()->get_string (), - 1, - 0, - I_FALSE)); + Identifier (this->local_name ()->get_string ())); } ACE_NEW (conc_name, @@ -202,10 +151,7 @@ be_predefined_type::compute_tc_name (void) // Start with the head as the CORBA namespace. Identifier *corba_id = 0; ACE_NEW (corba_id, - Identifier ("CORBA", - 1, - 0, - I_FALSE)); + Identifier ("CORBA")); ACE_NEW (this->tc_name_, UTL_ScopedName (corba_id, @@ -218,108 +164,63 @@ be_predefined_type::compute_tc_name (void) { case AST_PredefinedType::PT_void: ACE_NEW (id, - Identifier ("_tc_void", - 1, - 0, - I_FALSE)); + Identifier ("_tc_void")); break; case AST_PredefinedType::PT_long: ACE_NEW (id, - Identifier ("_tc_long", - 1, - 0, - I_FALSE)); + Identifier ("_tc_long")); break; case AST_PredefinedType::PT_longlong: ACE_NEW (id, - Identifier ("_tc_longlong", - 1, - 0, - I_FALSE)); + Identifier ("_tc_longlong")); break; case AST_PredefinedType::PT_ulong: ACE_NEW (id, - Identifier ("_tc_ulong", - 1, - 0, - I_FALSE)); + Identifier ("_tc_ulong")); break; case AST_PredefinedType::PT_ulonglong: ACE_NEW (id, - Identifier ("_tc_ulonglong", - 1, - 0, - I_FALSE)); + Identifier ("_tc_ulonglong")); break; case AST_PredefinedType::PT_short: ACE_NEW (id, - Identifier ("_tc_short", - 1, - 0, - I_FALSE)); + Identifier ("_tc_short")); break; case AST_PredefinedType::PT_ushort: ACE_NEW (id, - Identifier ("_tc_ushort", - 1, - 0, - I_FALSE)); + Identifier ("_tc_ushort")); break; case AST_PredefinedType::PT_float: ACE_NEW (id, - Identifier ("_tc_float", - 1, - 0, - I_FALSE)); + Identifier ("_tc_float")); break; case AST_PredefinedType::PT_double: ACE_NEW (id, - Identifier ("_tc_double", - 1, - 0, - I_FALSE)); + Identifier ("_tc_double")); break; case AST_PredefinedType::PT_longdouble: ACE_NEW (id, - Identifier ("_tc_longdouble", - 1, - 0, - I_FALSE)); + Identifier ("_tc_longdouble")); break; case AST_PredefinedType::PT_char: ACE_NEW (id, - Identifier ("_tc_char", - 1, - 0, - I_FALSE)); + Identifier ("_tc_char")); break; case AST_PredefinedType::PT_wchar: ACE_NEW (id, - Identifier ("_tc_wchar", - 1, - 0, - I_FALSE)); + Identifier ("_tc_wchar")); break; case AST_PredefinedType::PT_octet: ACE_NEW (id, - Identifier ("_tc_octet", - 1, - 0, - I_FALSE)); + Identifier ("_tc_octet")); break; case AST_PredefinedType::PT_boolean: ACE_NEW (id, - Identifier ("_tc_boolean", - 1, - 0, - I_FALSE)); + Identifier ("_tc_boolean")); break; case AST_PredefinedType::PT_any: ACE_NEW (id, - Identifier ("_tc_any", - 1, - 0, - I_FALSE)); + Identifier ("_tc_any")); break; case AST_PredefinedType::PT_pseudo: { @@ -329,10 +230,7 @@ be_predefined_type::compute_tc_name (void) this->name ()->last_component ()->get_string ()); ACE_NEW (id, - Identifier (tcname, - 1, - 0, - I_FALSE)); + Identifier (tcname)); break; } default: diff --git a/TAO/TAO_IDL/be/be_sequence.cpp b/TAO/TAO_IDL/be/be_sequence.cpp index b8bb731911b..8f3cde1fc82 100644 --- a/TAO/TAO_IDL/be/be_sequence.cpp +++ b/TAO/TAO_IDL/be/be_sequence.cpp @@ -170,10 +170,7 @@ be_sequence::create_name (be_typedef *node) Identifier *id = 0; ACE_NEW_RETURN (id, - Identifier (ACE_OS::strdup (namebuf), - 1, - 0, - I_FALSE), + Identifier (ACE_OS::strdup (namebuf)), -1); UTL_ScopedName *conc_name = 0; diff --git a/TAO/TAO_IDL/be/be_string.cpp b/TAO/TAO_IDL/be/be_string.cpp index 91467af973f..4153e8f819c 100644 --- a/TAO/TAO_IDL/be/be_string.cpp +++ b/TAO/TAO_IDL/be/be_string.cpp @@ -34,10 +34,7 @@ be_string::be_string (void) be_string::be_string (AST_Expression *v) : AST_String (v), AST_Decl (AST_Decl::NT_string, - new UTL_ScopedName (new Identifier ("string", - 1, - 0, - I_FALSE), + new UTL_ScopedName (new Identifier ("string"), 0), 0, I_TRUE) @@ -53,15 +50,9 @@ be_string::be_string (AST_Expression *v, ? AST_Decl::NT_string : AST_Decl::NT_wstring, wide == (long) sizeof (char) - ? new UTL_ScopedName (new Identifier ("string", - 1, - 0, - I_FALSE), + ? new UTL_ScopedName (new Identifier ("string"), 0) - : new UTL_ScopedName (new Identifier ("wstring", - 1, - 0, - I_FALSE), + : new UTL_ScopedName (new Identifier ("wstring"), 0), 0, I_TRUE) @@ -77,10 +68,7 @@ be_string::compute_tc_name (void) // Start with the head as the CORBA namespace. Identifier *corba_id = 0; ACE_NEW (corba_id, - Identifier ("CORBA", - 1, - 0, - I_FALSE)); + Identifier ("CORBA")); ACE_NEW (this->tc_name_, UTL_ScopedName (corba_id, @@ -88,10 +76,7 @@ be_string::compute_tc_name (void) Identifier *id = 0; ACE_NEW (id, - Identifier ("_tc_string", - 1, - 0, - I_FALSE)); + Identifier ("_tc_string")); UTL_ScopedName *conc_name = 0; ACE_NEW (conc_name, diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp index 185f110c6d6..f25a36f757c 100644 --- a/TAO/TAO_IDL/be/be_type.cpp +++ b/TAO/TAO_IDL/be/be_type.cpp @@ -91,10 +91,7 @@ be_type::compute_tc_name (void) Identifier *id = 0; ACE_NEW (id, - Identifier (namebuf, - 1, - 0, - I_FALSE)); + Identifier (namebuf)); // Does not exist. if (this->tc_name_ == 0) @@ -164,10 +161,7 @@ be_type::compute_tc_name (const char *prefix, Identifier *id = 0; ACE_NEW_RETURN (id, - Identifier (namebuf, - 1, - 0, - I_FALSE), + Identifier (namebuf), 0); if (result == 0) diff --git a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp index e57f7a4b75b..f5583c3a36f 100644 --- a/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_amh_pre_proc.cpp @@ -265,13 +265,10 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node) // Create a virtual module named "Messaging" and an valuetype "ExceptionHolder" // from which we inherit. UTL_ScopedName *inherit_name = - new UTL_ScopedName (new Identifier ("Messaging", 0,0,0), + new UTL_ScopedName (new Identifier ("Messaging"), 0); - inherit_name->nconc (new UTL_ScopedName (new Identifier ("ExceptionHolder", - 0, - 0, - 0), + inherit_name->nconc (new UTL_ScopedName (new Identifier ("ExceptionHolder"), 0)); be_valuetype *inherit_vt = new be_valuetype (inherit_name, @@ -280,11 +277,8 @@ be_visitor_amh_pre_proc::create_exception_holder (be_interface *node) 0); inherit_vt->set_name (inherit_name); - be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging", - 0, - 0, - 0), - 0), + be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"), + 0), 0); // Notice the valuetype "ExceptionHolder" that it is defined in the @@ -507,7 +501,7 @@ be_visitor_amh_pre_proc::create_amh_operation (be_operation *node, UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, amh_class->name ()-> copy ()); op_name->nconc (new UTL_ScopedName ( new Identifier ( - original_op_name.rep (), 1, 0, I_FALSE), + original_op_name.rep ()), 0)); // Create the operation @@ -617,10 +611,10 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node, // Create a virtual module named "Messaging" and an interface "responseHandler" // from which we inherit. UTL_ScopedName *inherit_name = - new UTL_ScopedName (new Identifier ("Messaging", 0,0,0), + new UTL_ScopedName (new Identifier ("Messaging"), 0); - inherit_name->nconc (new UTL_ScopedName (new Identifier ("responseHandler", 0,0,0), + inherit_name->nconc (new UTL_ScopedName (new Identifier ("responseHandler"), 0)); be_interface *inherit_intf = new be_interface (inherit_name, @@ -633,7 +627,7 @@ be_visitor_amh_pre_proc::create_response_handler (be_interface *node, 0); // not abstract inherit_intf->set_name (inherit_name); - be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging", 0,0,0), + be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"), 0), 0); @@ -763,10 +757,7 @@ be_visitor_amh_pre_proc::create_raise_operation (be_decl *node, // Create the return type, which is "void" be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName - (new Identifier ("void", - 1, - 0, - I_FALSE), + (new Identifier ("void"), 0), 0); @@ -786,7 +777,7 @@ be_visitor_amh_pre_proc::create_raise_operation (be_decl *node, op_name->nconc (new UTL_ScopedName ( new Identifier ( - new_local_name.rep (), 1, 0, I_FALSE), + new_local_name.rep ()), 0)); be_operation *operation = new be_operation (rt, @@ -1285,7 +1276,7 @@ be_visitor_amh_pre_proc::generate_set_operation (be_attribute *node) be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName (new Identifier - ("void", 1, 0, I_FALSE), 0), + ("void"), 0), 0); // argument type is the same as the attribute type diff --git a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp index 9d3b213d645..2480039d9c1 100644 --- a/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp +++ b/TAO/TAO_IDL/be/be_visitor_ami_pre_proc.cpp @@ -241,13 +241,10 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node) // Create a virtual module named "Messaging" and an valuetype "ExceptionHolder" // from which we inherit. UTL_ScopedName *inherit_name = - new UTL_ScopedName (new Identifier ("Messaging", 0,0,0), + new UTL_ScopedName (new Identifier ("Messaging"), 0); - inherit_name->nconc (new UTL_ScopedName (new Identifier ("ExceptionHolder", - 0, - 0, - 0), + inherit_name->nconc (new UTL_ScopedName (new Identifier ("ExceptionHolder"), 0)); be_valuetype *inherit_vt = new be_valuetype (inherit_name, @@ -256,10 +253,7 @@ be_visitor_ami_pre_proc::create_exception_holder (be_interface *node) 0); inherit_vt->set_name (inherit_name); - be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging", - 0, - 0, - 0), + be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"), 0), 0); @@ -354,10 +348,10 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node, // Create a virtual module named "Messaging" and an interface "ReplyHandler" // from which we inherit. UTL_ScopedName *inherit_name = - new UTL_ScopedName (new Identifier ("Messaging", 0,0,0), + new UTL_ScopedName (new Identifier ("Messaging"), 0); - inherit_name->nconc (new UTL_ScopedName (new Identifier ("ReplyHandler", 0,0,0), + inherit_name->nconc (new UTL_ScopedName (new Identifier ("ReplyHandler"), 0)); be_interface *inherit_intf = new be_interface (inherit_name, @@ -370,7 +364,7 @@ be_visitor_ami_pre_proc::create_reply_handler (be_interface *node, 0); // not abstract inherit_intf->set_name (inherit_name); - be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging", 0,0,0), + be_module *msg = new be_module (new UTL_ScopedName (new Identifier ("Messaging"), 0), 0); @@ -499,10 +493,7 @@ be_visitor_ami_pre_proc::create_raise_operation (be_decl *node, // Create the return type, which is "void" be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName - (new Identifier ("void", - 1, - 0, - I_FALSE), + (new Identifier ("void"), 0), 0); @@ -522,7 +513,7 @@ be_visitor_ami_pre_proc::create_raise_operation (be_decl *node, op_name->nconc (new UTL_ScopedName ( new Identifier ( - new_local_name.rep (), 1, 0, I_FALSE), + new_local_name.rep ()), 0)); be_operation *operation = new be_operation (rt, @@ -571,7 +562,7 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, // Create the return type, which is "void" be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName - (new Identifier ("void", 1, 0, I_FALSE), + (new Identifier ("void"), 0), 0); @@ -627,10 +618,7 @@ be_visitor_ami_pre_proc::create_sendc_operation (be_operation *node, field_type, // is also a valuetype new UTL_ScopedName ( new Identifier ( - "ami_handler", - 1, - 0, - I_FALSE + "ami_handler" ), 0 ), @@ -705,7 +693,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, // Create the return type, which is "void" be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName - (new Identifier ("void", 1, 0, I_FALSE), + (new Identifier ("void"), 0), 0); @@ -717,7 +705,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, reply_handler->name ()-> copy ()); op_name->nconc (new UTL_ScopedName ( new Identifier ( - original_op_name.rep (), 1, 0, I_FALSE), + original_op_name.rep ()), 0)); // Create the operation @@ -739,7 +727,7 @@ be_visitor_ami_pre_proc::create_reply_handler_operation (be_operation *node, node->return_type (), new UTL_ScopedName (new Identifier - ("ami_return_val", 1, 0, I_FALSE), + ("ami_return_val"), 0), 0); @@ -823,7 +811,7 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node, // Create the return type, which is "void" be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName - (new Identifier ("void", 1, 0, I_FALSE), + (new Identifier ("void"), 0), 0); @@ -832,7 +820,7 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node, excep_holder, // is also a valuetype new UTL_ScopedName ( new Identifier ( - "excep_holder", 1, 0, I_FALSE), + "excep_holder"), 0), 0); @@ -847,7 +835,7 @@ be_visitor_ami_pre_proc::create_excep_operation (be_operation *node, UTL_ScopedName *op_name = ACE_static_cast (UTL_ScopedName *, reply_handler->name ()-> copy ()); op_name->nconc (new UTL_ScopedName (new Identifier - (new_op_name.rep (), 1, 0, I_FALSE), + (new_op_name.rep ()), 0)); // create the operation @@ -1020,7 +1008,7 @@ be_visitor_ami_pre_proc::generate_set_operation (be_attribute *node) be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName (new Identifier - ("void", 1, 0, I_FALSE), 0), + ("void"), 0), 0); // argument type is the same as the attribute type diff --git a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp index 7471325c568..14f61f6631d 100644 --- a/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp +++ b/TAO/TAO_IDL/be/be_visitor_attribute/attribute.cpp @@ -221,7 +221,7 @@ be_visitor_attribute::visit_attribute (be_attribute *node) be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName (new Identifier - ("void", 1, 0, I_FALSE), 0), + ("void"), 0), 0); // argument type is the same as the attribute type be_argument *arg = new be_argument (AST_Argument::dir_IN, diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp index 00932f05f65..bb75e14bfb3 100644 --- a/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp +++ b/TAO/TAO_IDL/be/be_visitor_valuetype/valuetype.cpp @@ -223,7 +223,7 @@ be_visitor_valuetype::visit_attribute (be_attribute *node) be_predefined_type *rt = new be_predefined_type (AST_PredefinedType::PT_void, new UTL_ScopedName (new Identifier - ("void", 1, 0, I_FALSE), 0), + ("void"), 0), 0); // argument type is the same as the attribute type be_argument *arg = new be_argument (AST_Argument::dir_IN, diff --git a/TAO/TAO_IDL/fe/fe_init.cpp b/TAO/TAO_IDL/fe/fe_init.cpp index 7eb18f9196f..0f63d775f22 100644 --- a/TAO/TAO_IDL/fe/fe_init.cpp +++ b/TAO/TAO_IDL/fe/fe_init.cpp @@ -81,7 +81,6 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #include "idl.h" #include "idl_extern.h" - #include "fe_private.h" ACE_RCSID(fe, fe_init, "$Id$") @@ -92,10 +91,7 @@ create_scoped_name (const char *s) { Identifier *id = 0; ACE_NEW_RETURN (id, - Identifier (s, - 1, - 0, - I_FALSE), + Identifier (s), 0); UTL_ScopedName *retval = 0; @@ -107,9 +103,9 @@ create_scoped_name (const char *s) return retval; } -// Populate the global scope with all predefined entities +// Populate the global scope with all predefined entities. void -fe_populate (AST_Module *m) +fe_populate_global_scope (AST_Module *m) { AST_PredefinedType *pdt = 0; @@ -513,6 +509,79 @@ fe_populate (AST_Module *m) # endif /* IDL_HAS_VALUETYPE */ } +// Populate idl_global's hash map with upper case versions of +// all the IDL keywords +void +fe_populate_idl_keywords (void) +{ + static const char *keywords[] = + { + "ABSTRACT", + "ANY", + "ATTRIBUTE", + "BOOLEAN", + "CASE", + "CHAR", + "CONST", + "CONTEXT", + "CUSTOM", + "DEFAULT", + "DOUBLE", + "EXCEPTION", + "ENUM", + "FACTORY", + "FALSE", + "FIXED", + "FLOAT", + "IN", + "INOUT", + "INTERFACE", + "LOCAL", + "LONG", + "MODULE", + "NATIVE", + "OBJECT", + "OCTET", + "ONEWAY", + "OUT", + "PRIVATE", + "PUBLIC", + "RAISES", + "READONLY", + "SEQUENCE", + "SHORT", + "STRING", + "STRUCT", + "SUPPORTS", + "SWITCH", + "TRUE", + "TRUNCATABLE", + "TYPEDEF", + "UNION", + "UNSIGNED", + "VALUEBASE", + "VALUETYPE", + "VOID", + "WCHAR", + "WSTRING" + }; + + ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> &map = + idl_global->idl_keywords (); + + u_long length = sizeof (keywords) / sizeof (char *); + ACE_CString ext_id; + int int_id = 0; + + for (u_long i = 0; i < length; ++i) + { + ext_id.set (keywords[i], + 0); + (void) map.bind (ext_id, + int_id); + } +} + // Initialization stage 1: create global scopes stack. void FE_init_stage1 (void) @@ -565,8 +634,11 @@ FE_init_stage2 (void) idl_global->scopes ()->push (idl_global->root ()); // Populate it with nodes for predefined types. - fe_populate (idl_global->root ()); + fe_populate_global_scope (idl_global->root ()); // Set flag to indicate we are processing the main file now. idl_global->set_in_main_file (I_TRUE); + + // Populate the IDL keyword container, for checking local identifiers. + fe_populate_idl_keywords (); } diff --git a/TAO/TAO_IDL/fe/idl.ll b/TAO/TAO_IDL/fe/idl.ll index 4ca025e4c0e..d8253782dd8 100644 --- a/TAO/TAO_IDL/fe/idl.ll +++ b/TAO/TAO_IDL/fe/idl.ll @@ -187,16 +187,14 @@ oneway return IDL_ONEWAY; // keyword and grab the mapping. BTW, the reason for the odd // regular expression is to handle EBCDIC, as well as ASCII. - char *tmp = (ace_yytext[0] == '_' ? ace_yytext + 1 : ace_yytext); - TAO_IDL_CPP_Keyword_Table cpp_key_tbl; const TAO_IDL_CPP_Keyword_Entry *entry = - cpp_key_tbl.lookup (tmp, - ACE_OS::strlen (tmp)); + cpp_key_tbl.lookup (ace_yytext, + ACE_OS::strlen (ace_yytext)); if (entry) yylval.strval = ACE_OS::strdup (entry->mapping_); else - yylval.strval = ACE_OS::strdup (tmp); + yylval.strval = ACE_OS::strdup (ace_yytext); return IDENTIFIER; } diff --git a/TAO/TAO_IDL/fe/idl.yy b/TAO/TAO_IDL/fe/idl.yy index 308f05c4e0c..a494510a7cd 100644 --- a/TAO/TAO_IDL/fe/idl.yy +++ b/TAO/TAO_IDL/fe/idl.yy @@ -322,7 +322,7 @@ module : IDL_MODULE IDENTIFIER { UTL_ScopedName *n = - new UTL_ScopedName(new Identifier($3, 1, 0, I_FALSE), NULL); + new UTL_ScopedName(new Identifier($3), NULL); AST_Module *m = NULL; UTL_Scope *s = idl_global->scopes()->top_non_null(); UTL_StrList *p = idl_global->pragmas(); @@ -857,7 +857,7 @@ scoped_name { idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); - $$ = new UTL_IdList(new Identifier($1, 1, 0, I_FALSE), + $$ = new UTL_IdList(new Identifier($1), new UTL_IdList($3, NULL)); } | scoped_name @@ -876,7 +876,7 @@ scoped_name id: IDENTIFIER { - $$ = new Identifier($1, 1, 0, I_FALSE); + $$ = new Identifier($1); } ; @@ -2109,7 +2109,7 @@ enumerator : { UTL_Scope *s = idl_global->scopes()->top_non_null(); UTL_ScopedName *n = - new UTL_ScopedName(new Identifier($1, 1, 0, I_FALSE), NULL); + new UTL_ScopedName(new Identifier($1), NULL); AST_EnumVal *e = NULL; AST_Enum *c = NULL; UTL_StrList *p = idl_global->pragmas(); @@ -2521,7 +2521,7 @@ operation : { UTL_Scope *s = idl_global->scopes()->top_non_null(); UTL_ScopedName *n = - new UTL_ScopedName(new Identifier($4, 1, 0, I_FALSE), NULL); + new UTL_ScopedName(new Identifier($4), NULL); AST_Operation *o = NULL; UTL_StrList *p = idl_global->pragmas(); diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp b/TAO/TAO_IDL/fe/lex.yy.cpp index 4f61ed9b6f7..848fb9b7579 100644 --- a/TAO/TAO_IDL/fe/lex.yy.cpp +++ b/TAO/TAO_IDL/fe/lex.yy.cpp @@ -728,7 +728,7 @@ char *tao_yytext_ptr; #line 1 "fe/idl.ll" #define INITIAL 0 #line 2 "fe/idl.ll" -/* $Id: idl.ll,v 1.51 2001/01/24 21:35:31 parsons Exp $ +/* $Id: idl.ll,v 1.52 2001/01/24 22:41:00 parsons Exp $ COPYRIGHT @@ -1341,23 +1341,21 @@ TAO_YY_RULE_SETUP // keyword and grab the mapping. BTW, the reason for the odd // regular expression is to handle EBCDIC, as well as ASCII. - char *tmp = (ace_tao_yytext[0] == '_' ? ace_tao_yytext + 1 : ace_tao_yytext); - TAO_IDL_CPP_Keyword_Table cpp_key_tbl; const TAO_IDL_CPP_Keyword_Entry *entry = - cpp_key_tbl.lookup (tmp, - ACE_OS::strlen (tmp)); + cpp_key_tbl.lookup (ace_tao_yytext, + ACE_OS::strlen (ace_tao_yytext)); if (entry) tao_yylval.strval = ACE_OS::strdup (entry->mapping_); else - tao_yylval.strval = ACE_OS::strdup (tmp); + tao_yylval.strval = ACE_OS::strdup (ace_tao_yytext); return IDENTIFIER; } TAO_YY_BREAK case 51: TAO_YY_RULE_SETUP -#line 204 "fe/idl.ll" +#line 202 "fe/idl.ll" { tao_yylval.dval = idl_atof(ace_tao_yytext); return IDL_FLOATING_PT_LITERAL; @@ -1365,7 +1363,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 52: TAO_YY_RULE_SETUP -#line 208 "fe/idl.ll" +#line 206 "fe/idl.ll" { tao_yylval.dval = idl_atof(ace_tao_yytext); return IDL_FLOATING_PT_LITERAL; @@ -1373,7 +1371,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 53: TAO_YY_RULE_SETUP -#line 213 "fe/idl.ll" +#line 211 "fe/idl.ll" { tao_yylval.ival = idl_atoi(ace_tao_yytext, 10); return IDL_INTEGER_LITERAL; @@ -1381,7 +1379,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 54: TAO_YY_RULE_SETUP -#line 217 "fe/idl.ll" +#line 215 "fe/idl.ll" { tao_yylval.uival = idl_atoui(ace_tao_yytext, 10); return IDL_UINTEGER_LITERAL; @@ -1389,7 +1387,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 55: TAO_YY_RULE_SETUP -#line 221 "fe/idl.ll" +#line 219 "fe/idl.ll" { tao_yylval.ival = idl_atoi(ace_tao_yytext, 16); return IDL_INTEGER_LITERAL; @@ -1397,7 +1395,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 56: TAO_YY_RULE_SETUP -#line 225 "fe/idl.ll" +#line 223 "fe/idl.ll" { tao_yylval.uival = idl_atoui(ace_tao_yytext, 16); return IDL_UINTEGER_LITERAL; @@ -1405,7 +1403,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 57: TAO_YY_RULE_SETUP -#line 229 "fe/idl.ll" +#line 227 "fe/idl.ll" { tao_yylval.ival = idl_atoi(ace_tao_yytext, 8); return IDL_INTEGER_LITERAL; @@ -1413,7 +1411,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 58: TAO_YY_RULE_SETUP -#line 233 "fe/idl.ll" +#line 231 "fe/idl.ll" { tao_yylval.uival = idl_atoui(ace_tao_yytext, 8); return IDL_UINTEGER_LITERAL; @@ -1421,7 +1419,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 59: TAO_YY_RULE_SETUP -#line 238 "fe/idl.ll" +#line 236 "fe/idl.ll" { /* Skip the quotes */ char *tmp = ace_tao_yytext; @@ -1432,7 +1430,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 60: TAO_YY_RULE_SETUP -#line 245 "fe/idl.ll" +#line 243 "fe/idl.ll" { /* Skip the bookends */ char *tmp = ACE_OS::strdup (ace_tao_yytext); @@ -1443,7 +1441,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 61: TAO_YY_RULE_SETUP -#line 252 "fe/idl.ll" +#line 250 "fe/idl.ll" { tao_yylval.cval = ace_tao_yytext [1]; return IDL_CHARACTER_LITERAL; @@ -1451,7 +1449,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 62: TAO_YY_RULE_SETUP -#line 256 "fe/idl.ll" +#line 254 "fe/idl.ll" { // octal character constant tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1); @@ -1460,7 +1458,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 63: TAO_YY_RULE_SETUP -#line 261 "fe/idl.ll" +#line 259 "fe/idl.ll" { // hexadecimal character constant tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1); @@ -1469,7 +1467,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 64: TAO_YY_RULE_SETUP -#line 266 "fe/idl.ll" +#line 264 "fe/idl.ll" { tao_yylval.cval = idl_escape_reader(ace_tao_yytext + 1); return IDL_CHARACTER_LITERAL; @@ -1477,7 +1475,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 65: TAO_YY_RULE_SETUP -#line 270 "fe/idl.ll" +#line 268 "fe/idl.ll" { // wide character constant tao_yylval.wcval = ace_tao_yytext [2]; @@ -1486,7 +1484,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 66: TAO_YY_RULE_SETUP -#line 275 "fe/idl.ll" +#line 273 "fe/idl.ll" { // hexadecimal wide character constant tao_yylval.wcval = idl_wchar_escape_reader(ace_tao_yytext + 2); @@ -1494,65 +1492,65 @@ TAO_YY_RULE_SETUP } TAO_YY_BREAK case 67: -#line 281 "fe/idl.ll" +#line 279 "fe/idl.ll" case 68: TAO_YY_RULE_SETUP -#line 281 "fe/idl.ll" +#line 279 "fe/idl.ll" {/* remember pragma */ idl_global->set_lineno(idl_global->lineno() + 1); idl_store_pragma(ace_tao_yytext); } break; case 69: -#line 286 "fe/idl.ll" +#line 284 "fe/idl.ll" case 70: TAO_YY_RULE_SETUP -#line 286 "fe/idl.ll" +#line 284 "fe/idl.ll" {/* ignore file */ idl_global->set_lineno(idl_global->lineno() + 1); } TAO_YY_BREAK case 71: -#line 290 "fe/idl.ll" +#line 288 "fe/idl.ll" case 72: TAO_YY_RULE_SETUP -#line 290 "fe/idl.ll" +#line 288 "fe/idl.ll" { idl_parse_line_and_file(ace_tao_yytext); } break; case 73: -#line 294 "fe/idl.ll" +#line 292 "fe/idl.ll" case 74: TAO_YY_RULE_SETUP -#line 294 "fe/idl.ll" +#line 292 "fe/idl.ll" { idl_parse_line_and_file(ace_tao_yytext); } break; case 75: -#line 298 "fe/idl.ll" +#line 296 "fe/idl.ll" case 76: TAO_YY_RULE_SETUP -#line 298 "fe/idl.ll" +#line 296 "fe/idl.ll" { idl_parse_line_and_file(ace_tao_yytext); } break; case 77: -#line 302 "fe/idl.ll" +#line 300 "fe/idl.ll" case 78: TAO_YY_RULE_SETUP -#line 302 "fe/idl.ll" +#line 300 "fe/idl.ll" { idl_parse_line_and_file(ace_tao_yytext); } break; case 79: -#line 306 "fe/idl.ll" +#line 304 "fe/idl.ll" case 80: TAO_YY_RULE_SETUP -#line 306 "fe/idl.ll" +#line 304 "fe/idl.ll" { /* ignore cpp ident */ idl_global->set_lineno(idl_global->lineno() + 1); @@ -1560,7 +1558,7 @@ TAO_YY_RULE_SETUP TAO_YY_BREAK case 81: TAO_YY_RULE_SETUP -#line 310 "fe/idl.ll" +#line 308 "fe/idl.ll" { /* ignore comments */ idl_global->set_lineno(idl_global->lineno() + 1); @@ -1568,7 +1566,7 @@ TAO_YY_RULE_SETUP break; case 82: TAO_YY_RULE_SETUP -#line 314 "fe/idl.ll" +#line 312 "fe/idl.ll" { for(;;) { char c = tao_yyinput(); @@ -1586,24 +1584,24 @@ TAO_YY_RULE_SETUP break; case 83: TAO_YY_RULE_SETUP -#line 328 "fe/idl.ll" +#line 326 "fe/idl.ll" ; break; case 84: TAO_YY_RULE_SETUP -#line 329 "fe/idl.ll" +#line 327 "fe/idl.ll" { idl_global->set_lineno(idl_global->lineno() + 1); } break; case 85: TAO_YY_RULE_SETUP -#line 332 "fe/idl.ll" +#line 330 "fe/idl.ll" return ace_tao_yytext [0]; TAO_YY_BREAK case 86: TAO_YY_RULE_SETUP -#line 334 "fe/idl.ll" +#line 332 "fe/idl.ll" TAO_YY_ECHO; break; case TAO_YY_STATE_EOF(INITIAL): @@ -2493,7 +2491,7 @@ int main() return 0; } #endif -#line 334 "fe/idl.ll" +#line 332 "fe/idl.ll" /* subroutines */ diff --git a/TAO/TAO_IDL/fe/lex.yy.cpp.diff b/TAO/TAO_IDL/fe/lex.yy.cpp.diff index eb83b2f65fc..f0058382ca5 100644 --- a/TAO/TAO_IDL/fe/lex.yy.cpp.diff +++ b/TAO/TAO_IDL/fe/lex.yy.cpp.diff @@ -18,61 +18,61 @@ register int tao_yy_act; #line 126 "fe/idl.ll" -@@ -1502,7 +1502,7 @@ +@@ -1500,7 +1500,7 @@ idl_global->set_lineno(idl_global->lineno() + 1); idl_store_pragma(ace_tao_yytext); } - TAO_YY_BREAK + break; case 69: - #line 286 "fe/idl.ll" + #line 284 "fe/idl.ll" case 70: -@@ -1511,7 +1511,7 @@ +@@ -1509,7 +1509,7 @@ {/* ignore file */ idl_global->set_lineno(idl_global->lineno() + 1); } - TAO_YY_BREAK + break; case 71: -#line 290 "fe/idl.ll" +#line 288 "fe/idl.ll" case 72: -@@ -1520,7 +1520,7 @@ +@@ -1518,7 +1518,7 @@ { idl_parse_line_and_file(ace_tao_yytext); } - TAO_YY_BREAK + break; case 73: - #line 294 "fe/idl.ll" + #line 292 "fe/idl.ll" case 74: -@@ -1529,7 +1529,7 @@ +@@ -1527,7 +1527,7 @@ { idl_parse_line_and_file(ace_tao_yytext); } - TAO_YY_BREAK + break; case 75: - #line 298 "fe/idl.ll" + #line 296 "fe/idl.ll" case 76: -@@ -1538,7 +1538,7 @@ +@@ -1536,7 +1536,7 @@ { idl_parse_line_and_file(ace_tao_yytext); } - TAO_YY_BREAK + break; case 77: - #line 302 "fe/idl.ll" + #line 300 "fe/idl.ll" case 78: -@@ -1547,7 +1547,7 @@ +@@ -1545,7 +1545,7 @@ { idl_parse_line_and_file(ace_tao_yytext); } - TAO_YY_BREAK + break; case 79: - #line 306 "fe/idl.ll" + #line 304 "fe/idl.ll" case 80: -@@ -1556,7 +1556,7 @@ +@@ -1554,7 +1554,7 @@ { /* store cpp ident */ idl_global->ident_string (ace_tao_yytext); @@ -82,8 +82,8 @@ case 72: + break; case 81: TAO_YY_RULE_SETUP - #line 311 "fe/idl.ll" -@@ -1565,7 +1565,7 @@ + #line 308 "fe/idl.ll" +@@ -1563,7 +1563,7 @@ /* ignore comments */ idl_global->set_lineno(idl_global->lineno() + 1); } @@ -91,8 +91,8 @@ case 72: + break; case 82: TAO_YY_RULE_SETUP - #line 314 "fe/idl.ll" -@@ -1583,19 +1583,19 @@ + #line 312 "fe/idl.ll" +@@ -1581,19 +1581,19 @@ } } } @@ -100,13 +100,13 @@ case 72: + break; case 83: TAO_YY_RULE_SETUP - #line 328 "fe/idl.ll" + #line 326 "fe/idl.ll" ; - TAO_YY_BREAK + break; case 84: TAO_YY_RULE_SETUP - #line 329 "fe/idl.ll" + #line 327 "fe/idl.ll" { idl_global->set_lineno(idl_global->lineno() + 1); } @@ -114,10 +114,10 @@ case 72: + break; case 85: TAO_YY_RULE_SETUP - #line 332 "fe/idl.ll" -@@ -1605,7 +1605,7 @@ + #line 330 "fe/idl.ll" +@@ -1603,7 +1603,7 @@ TAO_YY_RULE_SETUP - #line 334 "fe/idl.ll" + #line 332 "fe/idl.ll" TAO_YY_ECHO; - TAO_YY_BREAK + break; diff --git a/TAO/TAO_IDL/fe/y.tab.cpp b/TAO/TAO_IDL/fe/y.tab.cpp index 83c4bb5239c..f0503754012 100644 --- a/TAO/TAO_IDL/fe/y.tab.cpp +++ b/TAO/TAO_IDL/fe/y.tab.cpp @@ -1387,7 +1387,7 @@ case 19: #line 323 "fe/idl.tao_yy" { UTL_ScopedName *n = - new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval, 1, 0, I_FALSE), NULL); + new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval), NULL); AST_Module *m = NULL; UTL_Scope *s = idl_global->scopes()->top_non_null(); UTL_StrList *p = idl_global->pragmas(); @@ -1935,7 +1935,7 @@ case 90: { idl_global->set_parse_state(IDL_GlobalData::PS_SN_IDSeen); - tao_yyval.idlist = new UTL_IdList(new Identifier(tao_yyvsp[-2].strval, 1, 0, I_FALSE), + tao_yyval.idlist = new UTL_IdList(new Identifier(tao_yyvsp[-2].strval), new UTL_IdList(tao_yyvsp[0].idval, NULL)); } break; @@ -1957,7 +1957,7 @@ break; case 93: #line 878 "fe/idl.tao_yy" { - tao_yyval.idval = new Identifier(tao_yyvsp[0].strval, 1, 0, I_FALSE); + tao_yyval.idval = new Identifier(tao_yyvsp[0].strval); } break; case 94: @@ -3229,7 +3229,7 @@ case 263: { UTL_Scope *s = idl_global->scopes()->top_non_null(); UTL_ScopedName *n = - new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval, 1, 0, I_FALSE), NULL); + new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval), NULL); AST_EnumVal *e = NULL; AST_Enum *c = NULL; UTL_StrList *p = idl_global->pragmas(); @@ -3667,7 +3667,7 @@ case 300: { UTL_Scope *s = idl_global->scopes()->top_non_null(); UTL_ScopedName *n = - new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval, 1, 0, I_FALSE), NULL); + new UTL_ScopedName(new Identifier(tao_yyvsp[0].strval), NULL); AST_Operation *o = NULL; UTL_StrList *p = idl_global->pragmas(); diff --git a/TAO/TAO_IDL/include/ast_module.h b/TAO/TAO_IDL/include/ast_module.h index 502388a63a3..345d8526397 100644 --- a/TAO/TAO_IDL/include/ast_module.h +++ b/TAO/TAO_IDL/include/ast_module.h @@ -125,7 +125,7 @@ public: virtual int ast_accept (ast_visitor *visitor); private: - friend void fe_populate (AST_Module *m); + friend void fe_populate_global_scope (AST_Module *m); friend int tao_yyparse (void); // Scope Management Protocol diff --git a/TAO/TAO_IDL/include/idl_global.h b/TAO/TAO_IDL/include/idl_global.h index f965747e430..04eb011da38 100644 --- a/TAO/TAO_IDL/include/idl_global.h +++ b/TAO/TAO_IDL/include/idl_global.h @@ -68,6 +68,7 @@ trademarks or registered trademarks of Sun Microsystems, Inc. #define _IDL_IDL_GLOBAL_HH #include "ace/SString.h" +#include "ace/Hash_Map_Manager_T.h" // idl_global.hh // @@ -364,6 +365,10 @@ public: virtual const char *idl_flags (void) const; // Get a string representation of the flags passed to the idl compiler. + + ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> & + idl_keywords (void); + // Accessor for the IDL keyword container. private: // Data @@ -431,6 +436,33 @@ private: ACE_CString idl_flags_; // Concatenation of all the command line options. + + ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> idl_keywords_; + // Container for all the IDL keywords so local names can be checked. }; +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Hash_Map_Entry<ACE_CString, int>; +template class ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Equal_To<ACE_CString>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash<ACE_CString>; +template class ACE_Hash_Map_Manager_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, int> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Equal_To<ACE_CString> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash<ACE_CString> +#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_CString, int, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif //_IDL_IDL_GLOBAL_HH diff --git a/TAO/TAO_IDL/include/utl_err.h b/TAO/TAO_IDL/include/utl_err.h index ef3b19fc873..61b440ccf3c 100644 --- a/TAO/TAO_IDL/include/utl_err.h +++ b/TAO/TAO_IDL/include/utl_err.h @@ -88,8 +88,7 @@ public: EIDL_REDEF, // Redefinition EIDL_REDEF_SCOPE, // Redefinition inside defining scope EIDL_DEF_USE, // Definition after use - EIDL_MULTIPLE_BRANCH, // More than one union branch with this - // label + EIDL_MULTIPLE_BRANCH, // More than one union branch with this label EIDL_COERCION_FAILURE, // Coercion failure EIDL_SCOPE_CONFLICT, // Between fwd declare and full declare EIDL_ONEWAY_CONFLICT, // Between op decl and argument direction @@ -105,6 +104,8 @@ public: EIDL_CONSTANT_EXPECTED, // We got something else.. EIDL_NAME_CASE_ERROR, // Identifier spellings differ only in case EIDL_NAME_CASE_WARNING, // Same as above, but only a warning + EIDL_KEYWORD_ERROR, // Case-insensitive clash with IDL keyword + EIDL_KEYWORD_WARNING, // Same as above, but only a warning EIDL_ENUM_VAL_EXPECTED, // Expected an enumerator EIDL_ENUM_VAL_NOT_FOUND, // Didnt find an enumerator with that name EIDL_EVAL_ERROR, // Error in evaluating expression @@ -121,78 +122,111 @@ public: // Operations // Report errors with varying numbers of arguments - void error0(ErrorCode e); - void error1(ErrorCode e, AST_Decl *t); - void error2(ErrorCode e, AST_Decl *t1, AST_Decl *t2); - void error3(ErrorCode e, AST_Decl *t1, AST_Decl *t2, AST_Decl *t3); + void error0 (ErrorCode e); + void error1 (ErrorCode e, + AST_Decl *t); + void error2 (ErrorCode e, + AST_Decl *t1, + AST_Decl *t2); + void error3 (ErrorCode e, + AST_Decl *t1, + AST_Decl *t2, + AST_Decl *t3); // Report warnings with varying numbers of arguments - void warning0(ErrorCode e); - void warning1(ErrorCode e, AST_Decl *t); - void warning2(ErrorCode e, AST_Decl *t1, AST_Decl *t2); - void warning3(ErrorCode e, AST_Decl *t1, AST_Decl *t2, AST_Decl *t3); + void warning0 (ErrorCode e); + void warning1 (ErrorCode e, + AST_Decl *t); + void warning2 (ErrorCode e, + AST_Decl *t1, + AST_Decl *t2); + void warning3 (ErrorCode e, + AST_Decl *t1, + AST_Decl *t2, + AST_Decl *t3); // Report a syntax error in IDL input - void syntax_error(IDL_GlobalData::ParseState ps); + void syntax_error(IDL_GlobalData::ParseState ps); // Report clash of declared and referenced indentifiers - void redef_error (char *n, char *t); + void redef_error (char *n, + char *t); // Report a name being used with different spellings - void name_case_error(char *n, char *t); + void name_case_error (char *n, + char *t); - // Same as above, but don't increment the error count. - void name_case_warning(char *n, char *t); + // Same as above, but doesn't increment the error count. + void name_case_warning (char *n, + char *t); + + // Differs from spelling of IDL keyword only by case. + void idl_keyword_error (char *n); + + // Same as above, but doesn't increment the error count. + void idl_keyword_warning (char *n); // Report an unsuccesful coercion attempt - void coercion_error(AST_Expression *v, AST_Expression::ExprType t); + void coercion_error (AST_Expression *v, + AST_Expression::ExprType t); // Report a failed name lookup attempt - void lookup_error(UTL_ScopedName *n); + void lookup_error (UTL_ScopedName *n); // Report an attempt to use a forward declared interface which // hasn't been defined yet in an inheritance spec - void inheritance_fwd_error(UTL_ScopedName *n, AST_Interface *f); + void inheritance_fwd_error (UTL_ScopedName *n, + AST_Interface *f); // Report an attempt to inherit from something other than an interface - void inheritance_error(UTL_ScopedName *n, AST_Decl *d); + void inheritance_error (UTL_ScopedName *n, + AST_Decl *d); - void abstract_inheritance_error (UTL_ScopedName *n); + void abstract_inheritance_error (UTL_ScopedName *n); // Report an error while evaluating an expression (division by zero, etc.) - void eval_error(AST_Expression *d); + void eval_error (AST_Expression *d); // Report a situation where a constant was expected but we got // something else instead. This most likely is a case where a union // label did not evaluate to a constant - void constant_expected(UTL_ScopedName *n, AST_Decl *d); + void constant_expected (UTL_ScopedName *n, + AST_Decl *d); // Report a situation where an enumerator was expected but we got // something else instead. This occurs when a union with an enum // discriminator is being parsed and one of the branch labels is // not an enumerator in that enum - void enum_val_expected(AST_Union *t, AST_UnionLabel *l); + void enum_val_expected (AST_Union *t, + AST_UnionLabel *l); // Report a failed enumerator lookup in an enum - void enum_val_lookup_failure(AST_Union *t, AST_Enum *e, UTL_ScopedName *n); + void enum_val_lookup_failure (AST_Union *t, + AST_Enum *e, + UTL_ScopedName *n); // Report an ambiguous name definition - void ambiguous(UTL_Scope *s, AST_Decl *l, AST_Decl *d); + void ambiguous (UTL_Scope *s, + AST_Decl *l, + AST_Decl *d); // Report a forward declared interface which was never defined - void fwd_decl_not_defined(AST_Interface *d); + void fwd_decl_not_defined (AST_Interface *d); // Report attempt to lookup in forward declared interface - void fwd_decl_lookup(AST_Interface *d, UTL_ScopedName *n); + void fwd_decl_lookup (AST_Interface *d, + UTL_ScopedName *n); // Report a redefinition in scope - void redefinition_in_scope(AST_Decl *t, AST_Decl *s); + void redefinition_in_scope (AST_Decl *t, + AST_Decl *s); // Report not a type error - void not_a_type(AST_Decl *d); + void not_a_type (AST_Decl *d); // Report back-end error - void back_end(long lineno, UTL_String *s); + void back_end (long lineno, + UTL_String *s); }; #endif // _UTL_ERR_UTL_ERR_HH diff --git a/TAO/TAO_IDL/include/utl_identifier.h b/TAO/TAO_IDL/include/utl_identifier.h index a9cdf0e5df2..1d82a0eddb1 100644 --- a/TAO/TAO_IDL/include/utl_identifier.h +++ b/TAO/TAO_IDL/include/utl_identifier.h @@ -86,10 +86,7 @@ public: Identifier (); // Default Constructor. - Identifier (const char *s, - long x = 1, - long y = 0, - long z = I_FALSE); + Identifier (const char *s); // Constructor. virtual ~Identifier (); @@ -115,6 +112,9 @@ public: Identifier *copy (void); // Create a deep copy. + idl_bool escaped (void) const; + // Accessor for the member. + virtual void dump (ostream &o); // Dump to an ostream. @@ -124,6 +124,9 @@ public: private: // Storage for data. char *pv_string; + + // Did the IDL string have a leading underscore? + idl_bool escaped_; }; #endif // _UTL_IDENTIFIER_UTL_IDENTIFIER_HH diff --git a/TAO/TAO_IDL/include/utl_scope.h b/TAO/TAO_IDL/include/utl_scope.h index 21f7de1e8ab..1fa13d18b8c 100644 --- a/TAO/TAO_IDL/include/utl_scope.h +++ b/TAO/TAO_IDL/include/utl_scope.h @@ -238,13 +238,14 @@ protected: // interface. virtual AST_Decl *look_in_inherited (UTL_ScopedName *, idl_bool treat_as_ref); -protected: - // Operations. - // Lookup based on the local name. virtual AST_Decl *lookup_for_add (AST_Decl *d, idl_bool treat_as_ref); + // Is there a (case-insensitive) clash between a local name + // and an IDL keyword? + int idl_keyword_clash (Identifier *e); + private: // Data. diff --git a/TAO/TAO_IDL/util/utl_err.cpp b/TAO/TAO_IDL/util/utl_err.cpp index e1f79b07ac3..cc048ae5152 100644 --- a/TAO/TAO_IDL/util/utl_err.cpp +++ b/TAO/TAO_IDL/util/utl_err.cpp @@ -128,6 +128,10 @@ error_string(UTL_Error::ErrorCode c) return ACE_TEXT ("identifier spellings differ only in case: "); case UTL_Error::EIDL_NAME_CASE_WARNING: return ACE_TEXT ("Warning - identifier spellings differ only in case: "); + case UTL_Error::EIDL_KEYWORD_ERROR: + return ACE_TEXT ("spelling differs from IDL keyword only in case: "); + case UTL_Error::EIDL_KEYWORD_WARNING: + return ACE_TEXT ("Warning - spelling differs from IDL keyword only in case: "); case UTL_Error::EIDL_ENUM_VAL_EXPECTED: return ACE_TEXT ("enumerator expected: "); case UTL_Error::EIDL_ENUM_VAL_NOT_FOUND: @@ -155,7 +159,9 @@ error_string(UTL_Error::ErrorCode c) // Print out an error message header on cerr static void -idl_error_header(UTL_Error::ErrorCode c, long lineno, UTL_String *s) +idl_error_header (UTL_Error::ErrorCode c, + long lineno, + UTL_String *s) { cerr << idl_global->prog_name() << ": \"" @@ -166,9 +172,9 @@ idl_error_header(UTL_Error::ErrorCode c, long lineno, UTL_String *s) << error_string(c); } -// Convert the type of an AST_Expression to a char * +// Convert the type of an AST_Expression to a char *. static const char * -exprtype_to_string(AST_Expression::ExprType t) +exprtype_to_string (AST_Expression::ExprType t) { switch (t) { case AST_Expression::EV_short: @@ -208,9 +214,7 @@ exprtype_to_string(AST_Expression::ExprType t) return NULL; } -/* - * Convert a parse state into a possible error message - */ +// Convert a parse state into a possible error message static const char * parse_state_to_error_message(IDL_GlobalData::ParseState ps) { @@ -461,64 +465,81 @@ parse_state_to_error_message(IDL_GlobalData::ParseState ps) return ACE_TEXT ("Some syntax error"); } } -/* - * Public methods - */ -// Report error messages with various numbers of arguments +// Public methods. + +// Report error messages with various numbers of arguments. void -UTL_Error::syntax_error(IDL_GlobalData::ParseState ps) +UTL_Error::syntax_error (IDL_GlobalData::ParseState ps) { - idl_error_header(EIDL_SYNTAX_ERROR, - idl_global->lineno(), - idl_global->filename()); - cerr << parse_state_to_error_message(ps) << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_error_header (EIDL_SYNTAX_ERROR, + idl_global->lineno (), + idl_global->filename ()); + cerr << parse_state_to_error_message (ps) << "\n"; + idl_global->set_err_count (idl_global->err_count () + 1); } void -UTL_Error::error0(UTL_Error::ErrorCode c) +UTL_Error::error0 (UTL_Error::ErrorCode c) { - idl_error_header(c, idl_global->lineno(), idl_global->filename()); + idl_error_header (c, + idl_global->lineno (), + idl_global->filename ()); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } void -UTL_Error::error1(UTL_Error::ErrorCode c, AST_Decl *d) +UTL_Error::error1 (UTL_Error::ErrorCode c, + AST_Decl *d) { - idl_error_header(c, d->line(), d->file_name()); - d->name()->dump(cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_error_header (c, + d->line (), + d->file_name ()); + d->name ()->dump (cerr); cerr << "\n"; + idl_global->set_err_count (idl_global->err_count () + 1); } void -UTL_Error::error2(UTL_Error::ErrorCode c, AST_Decl *d1, AST_Decl *d2) +UTL_Error::error2 (UTL_Error::ErrorCode c, + AST_Decl *d1, + AST_Decl *d2) { - idl_error_header(c, d1->line(), d1->file_name()); - d1->name()->dump(cerr); cerr << ", "; - d2->name()->dump(cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_error_header (c, + d1->line (), + d1->file_name ()); + d1->name ()->dump (cerr); + cerr << ", "; + d2->name ()->dump (cerr); + cerr << "\n"; + idl_global->set_err_count (idl_global->err_count () + 1); } void -UTL_Error::error3(UTL_Error::ErrorCode c, - AST_Decl *d1, - AST_Decl *d2, - AST_Decl *d3) +UTL_Error::error3 (UTL_Error::ErrorCode c, + AST_Decl *d1, + AST_Decl *d2, + AST_Decl *d3) { - idl_error_header(c, d1->line(), d1->file_name()); - d1->name()->dump(cerr); cerr << ", "; - d2->name()->dump(cerr); cerr << ", "; - d3->name()->dump(cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_error_header (c, + d1->line (), + d1->file_name ()); + d1->name ()->dump (cerr); + cerr << ", "; + d2->name ()->dump (cerr); + cerr << ", "; + d3->name ()->dump (cerr); + cerr << "\n"; + idl_global->set_err_count (idl_global->err_count () + 1); } void UTL_Error::warning0 (UTL_Error::ErrorCode c) { - idl_error_header(c, idl_global->lineno(), idl_global->filename()); + idl_error_header (c, + idl_global->lineno (), + idl_global->filename ()); cerr << "\n"; } @@ -526,8 +547,11 @@ void UTL_Error::warning1 (UTL_Error::ErrorCode c, AST_Decl *d) { - idl_error_header(c, d->line(), d->file_name()); - d->name()->dump(cerr); cerr << "\n"; + idl_error_header (c, + d->line(), + d->file_name()); + d->name ()->dump (cerr); + cerr << "\n"; } void @@ -535,9 +559,13 @@ UTL_Error::warning2 (UTL_Error::ErrorCode c, AST_Decl *d1, AST_Decl *d2) { - idl_error_header(c, d1->line(), d1->file_name()); - d1->name()->dump(cerr); cerr << ", "; - d2->name()->dump(cerr); cerr << "\n"; + idl_error_header (c, + d1->line (), + d1->file_name ()); + d1->name ()->dump (cerr); + cerr << ", "; + d2->name ()->dump (cerr); + cerr << "\n"; } void @@ -546,233 +574,293 @@ UTL_Error::warning3 (UTL_Error::ErrorCode c, AST_Decl *d2, AST_Decl *d3) { - idl_error_header(c, d1->line(), d1->file_name()); - d1->name()->dump(cerr); cerr << ", "; - d2->name()->dump(cerr); cerr << ", "; - d3->name()->dump(cerr); cerr << "\n"; + idl_error_header (c, + d1->line (), + d1->file_name ()); + d1->name ()->dump (cerr); + cerr << ", "; + d2->name ()->dump (cerr); + cerr << ", "; + d3->name ()->dump (cerr); + cerr << "\n"; } -// Report a failed coercion attempt +// Report a failed coercion attempt. void -UTL_Error::coercion_error(AST_Expression *v, AST_Expression::ExprType t) +UTL_Error::coercion_error (AST_Expression *v, + AST_Expression::ExprType t) { - idl_error_header(EIDL_COERCION_FAILURE, v->line(), v->file_name()); - v->dump(cerr); - cerr << ACE_TEXT (" to ") << exprtype_to_string(t) << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_error_header (EIDL_COERCION_FAILURE, + v->line (), + v->file_name ()); + v->dump (cerr); + cerr << ACE_TEXT (" to ") << exprtype_to_string (t) << "\n"; + idl_global->set_err_count (idl_global->err_count () + 1); } -// Report a failed name lookup attempt +// Report a failed name lookup attempt. void -UTL_Error::lookup_error(UTL_ScopedName *n) +UTL_Error::lookup_error (UTL_ScopedName *n) { idl_error_header(EIDL_LOOKUP_ERROR, - idl_global->lineno(), - idl_global->filename()); - n->dump(cerr); + idl_global->lineno (), + idl_global->filename ()); + n->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } // Report an attempt to inherit from an interface which was only -// declared forward but not yet defined +// declared forward but not yet defined. void -UTL_Error::inheritance_fwd_error(UTL_ScopedName *n, AST_Interface *f) +UTL_Error::inheritance_fwd_error (UTL_ScopedName *n, + AST_Interface *f) { - idl_error_header(EIDL_INHERIT_FWD_ERROR, f->line(), f->file_name()); + idl_error_header (EIDL_INHERIT_FWD_ERROR, + f->line (), + f->file_name ()); cerr << "interface "; - n->dump(cerr); + n->dump (cerr); cerr << ACE_TEXT (" cannot inherit from forward declared interface "); - f->local_name()->dump(cerr); + f->local_name ()->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } -// Report an attempt to inherit from something other than an interface +// Report an attempt to inherit from something other than an interface. void -UTL_Error::inheritance_error(UTL_ScopedName *n, AST_Decl *d) +UTL_Error::inheritance_error (UTL_ScopedName *n, + AST_Decl *d) { - idl_error_header(EIDL_CANT_INHERIT, idl_global->lineno(), idl_global->filename()); - /* cerr << " interface "; */ - n->dump(cerr); + idl_error_header (EIDL_CANT_INHERIT, + idl_global->lineno (), + idl_global->filename ()); + n->dump (cerr); cerr << ACE_TEXT (" attempts to inherit from "); - d->name()->dump(cerr); + d->name ()->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } -// Report inheritance from non-abstract valuetype +// Report inheritance from non-abstract valuetype. void UTL_Error::abstract_inheritance_error (UTL_ScopedName *n) { - idl_error_header(EIDL_CANT_INHERIT, idl_global->lineno(), idl_global->filename()); + idl_error_header (EIDL_CANT_INHERIT, + idl_global->lineno (), + idl_global->filename ()); cerr << " abstract valuetype "; - n->dump(cerr); + n->dump (cerr); cerr << ACE_TEXT (" attempts to inherit from nonabstract type\n"); - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } -// Report an error while evaluating an expression +// Report an error while evaluating an expression. void -UTL_Error::eval_error(AST_Expression *v) +UTL_Error::eval_error (AST_Expression *v) { - idl_error_header(EIDL_EVAL_ERROR, v->line(), v->file_name()); - v->dump(cerr); + idl_error_header (EIDL_EVAL_ERROR, + v->line (), + v->file_name ()); + v->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } // Report a situation where a constant was expected but we // got something else. This may occur in a union when a label -// evaluates to a non-constant +// evaluates to a non-constant. void -UTL_Error::constant_expected(UTL_ScopedName *n, AST_Decl *d) +UTL_Error::constant_expected (UTL_ScopedName *n, + AST_Decl *d) { - idl_error_header(EIDL_CONSTANT_EXPECTED, d->line(), d->file_name()); - n->dump(cerr); + idl_error_header (EIDL_CONSTANT_EXPECTED, + d->line (), + d->file_name ()); + n->dump (cerr); cerr << ACE_TEXT (" bound to "); - d->dump(cerr); + d->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } // Report a situation where an enumerator was expected but we // got something else. This may occur in a union with an enum // discriminator where a label did not evaluate to a constant -// enumerator +// enumerator. void -UTL_Error::enum_val_expected(AST_Union *u, AST_UnionLabel *l) +UTL_Error::enum_val_expected (AST_Union *u, + AST_UnionLabel *l) { - idl_error_header(EIDL_ENUM_VAL_EXPECTED, u->line(), u->file_name()); - cerr << " union " << u->local_name()->get_string() << ", "; - l->dump(cerr); + idl_error_header (EIDL_ENUM_VAL_EXPECTED, + u->line (), + u->file_name ()); + cerr << " union " << u->local_name ()->get_string () << ", "; + l->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } // Report a situation where an enumerator was received but we // could not find it (by name) in an enum. This occurs when // a union with an enum discriminator is being parsed, and a // label evaluates to an enumerator which is not a member of -// the enum discriminator type +// the enum discriminator type. void -UTL_Error::enum_val_lookup_failure(AST_Union *u, - AST_Enum *e, - UTL_ScopedName *n) +UTL_Error::enum_val_lookup_failure (AST_Union *u, + AST_Enum *e, + UTL_ScopedName *n) { - idl_error_header(EIDL_ENUM_VAL_NOT_FOUND, u->line(), u->file_name()); - cerr << " union " << u->local_name()->get_string() << ", "; - cerr << " enum " << e->local_name()->get_string() << ", "; + idl_error_header (EIDL_ENUM_VAL_NOT_FOUND, + u->line (), + u->file_name ()); + cerr << " union " << u->local_name ()->get_string () << ", "; + cerr << " enum " << e->local_name ()->get_string () << ", "; cerr << " enumerator "; - n->dump(cerr); + n->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } -// Report clash between declared and referenced indentifiers +// Report clash between declared and referenced indentifiers. void -UTL_Error::redef_error (char *b, char *n) +UTL_Error::redef_error (char *b, + char *n) { - idl_error_header(EIDL_REDEF, - idl_global->lineno(), - idl_global->filename()); + idl_error_header (EIDL_REDEF, + idl_global->lineno (), + idl_global->filename ()); cerr << "\"" << b << ACE_TEXT ("\" and ") << "\"" << n << "\"\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } -// Report two or more spellings for an identifier +// Report two or more spellings for an identifier. void -UTL_Error::name_case_error (char *b, char *n) +UTL_Error::name_case_error (char *b, + char *n) { - idl_error_header(EIDL_NAME_CASE_ERROR, - idl_global->lineno(), - idl_global->filename()); + idl_error_header (EIDL_NAME_CASE_ERROR, + idl_global->lineno (), + idl_global->filename ()); cerr << "\"" << b << ACE_TEXT ("\" and ") << "\"" << n << "\"\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } void -UTL_Error::name_case_warning (char *b, char *n) +UTL_Error::name_case_warning (char *b, + char *n) { - idl_error_header(EIDL_NAME_CASE_WARNING, - idl_global->lineno(), - idl_global->filename()); + idl_error_header (EIDL_NAME_CASE_WARNING, + idl_global->lineno (), + idl_global->filename ()); cerr << "\"" << b << ACE_TEXT ("\" and ") << "\"" << n << "\"\n"; } -// Report an ambiguous definition of a name void -UTL_Error::ambiguous(UTL_Scope *s, AST_Decl *l, AST_Decl *d) +UTL_Error::idl_keyword_error (char *n) { - idl_error_header(EIDL_AMBIGUOUS, d->line(), d->file_name()); + idl_error_header (EIDL_KEYWORD_ERROR, + idl_global->lineno (), + idl_global->filename ()); + cerr << "\"" << n << "\"\n"; + idl_global->set_err_count (idl_global->err_count () + 1); +} + +void +UTL_Error::idl_keyword_warning (char *n) +{ + idl_error_header (EIDL_KEYWORD_WARNING, + idl_global->lineno (), + idl_global->filename ()); + cerr << "\"" << n << "\"\n"; +} + +// Report an ambiguous definition of a name. +void +UTL_Error::ambiguous (UTL_Scope *s, + AST_Decl *l, + AST_Decl *d) +{ + idl_error_header (EIDL_AMBIGUOUS, + d->line (), + d->file_name ()); cerr << ACE_TEXT (" scope: ") - << (ScopeAsDecl(s))->local_name()->get_string() + << (ScopeAsDecl (s))->local_name ()->get_string () << ", "; cerr << ACE_TEXT (" collision: "); - d->name()->dump(cerr); + d->name ()->dump (cerr); cerr << " vs. "; - l->name()->dump(cerr); + l->name ()->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } -// Report a forward declared interface which was never defined +// Report a forward declared interface which was never defined. void -UTL_Error::fwd_decl_not_defined(AST_Interface *d) +UTL_Error::fwd_decl_not_defined (AST_Interface *d) { - idl_error_header(EIDL_DECL_NOT_DEFINED, d->line(), d->file_name()); + idl_error_header (EIDL_DECL_NOT_DEFINED, + d->line(), + d->file_name()); cerr << "interface "; - d->local_name()->dump(cerr); + d->local_name ()->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } -// Report lookup in undefined forward declared but undefined interface +// Report lookup in undefined forward declared but undefined interface. void -UTL_Error::fwd_decl_lookup(AST_Interface *d, UTL_ScopedName *n) +UTL_Error::fwd_decl_lookup (AST_Interface *d, + UTL_ScopedName *n) { - idl_error_header(EIDL_FWD_DECL_LOOKUP, - idl_global->lineno(), - idl_global->filename()); + idl_error_header (EIDL_FWD_DECL_LOOKUP, + idl_global->lineno(), + idl_global->filename()); cerr << ACE_TEXT ("trying to look up "); - n->dump(cerr); + n->dump (cerr); cerr << ACE_TEXT (" in undefined forward declared interface "); - d->local_name()->dump(cerr); + d->local_name ()->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } -// Report a redefinition inside its own scope +// Report a redefinition inside its own scope. void -UTL_Error::redefinition_in_scope(AST_Decl *d, AST_Decl *s) +UTL_Error::redefinition_in_scope (AST_Decl *d, + AST_Decl *s) { - idl_error_header(EIDL_REDEF_SCOPE, d->line(), d->file_name()); - d->name()->dump(cerr); + idl_error_header (EIDL_REDEF_SCOPE, + d->line (), + d->file_name ()); + d->name ()->dump (cerr); cerr << ", "; - s->name()->dump(cerr); + s->name ()->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } -// Report not a type error +// Report not a type error. void -UTL_Error::not_a_type(AST_Decl *d) +UTL_Error::not_a_type (AST_Decl *d) { - idl_error_header(EIDL_NOT_A_TYPE, - idl_global->lineno(), + idl_error_header (EIDL_NOT_A_TYPE, + idl_global->lineno(), idl_global->filename()); - if (d == NULL || d->name() == NULL) + if (d == 0 || d->name () == 0) cerr << ACE_TEXT ("unknown symbol"); else - d->name()->dump(cerr); + d->name ()->dump (cerr); cerr << "\n"; - idl_global->set_err_count(idl_global->err_count() + 1); + idl_global->set_err_count (idl_global->err_count () + 1); } void -UTL_Error::back_end(long lineno, UTL_String *s) +UTL_Error::back_end (long lineno, + UTL_String *s) { - idl_error_header(EIDL_BACK_END, lineno, s); - idl_global->set_err_count(idl_global->err_count() + 1); + idl_error_header (EIDL_BACK_END, + lineno, + s); + idl_global->set_err_count (idl_global->err_count () + 1); } diff --git a/TAO/TAO_IDL/util/utl_global.cpp b/TAO/TAO_IDL/util/utl_global.cpp index ba9cbb1cd63..ac359565446 100644 --- a/TAO/TAO_IDL/util/utl_global.cpp +++ b/TAO/TAO_IDL/util/utl_global.cpp @@ -861,4 +861,11 @@ const char * IDL_GlobalData::idl_flags (void) const { return idl_flags_.c_str (); -} +} + +ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> & +IDL_GlobalData::idl_keywords (void) +{ + return this->idl_keywords_; +} + diff --git a/TAO/TAO_IDL/util/utl_identifier.cpp b/TAO/TAO_IDL/util/utl_identifier.cpp index 318f8780c2c..3c7fb60dc38 100644 --- a/TAO/TAO_IDL/util/utl_identifier.cpp +++ b/TAO/TAO_IDL/util/utl_identifier.cpp @@ -76,25 +76,51 @@ ACE_RCSID(util, utl_identifier, "$Id$") */ Identifier::Identifier () - : pv_string (NULL) + : pv_string (0), + escaped_ (0) { } -Identifier::Identifier (const char *s, long, long, long) - : pv_string (ACE_OS::strdup (s)) +Identifier::Identifier (const char *s) { + idl_bool shift = 0; + this->escaped_ = 0; + + if (*s == '_') + { + shift = 1; + this->escaped_ = 1; + + ACE_CString str (s, + 0, + 0); + + if (str.find ("_cxx_") == 0) + { + shift = 0; + } + } + + if (shift) + { + this->pv_string = ACE_OS::strdup (s + 1); + } + else + { + this->pv_string = ACE_OS::strdup (s); + } } -Identifier::~Identifier () +Identifier::~Identifier (void) { } -// Operations +// Operations. char * Identifier::get_string (void) { - return pv_string; + return this->pv_string; } void @@ -105,17 +131,24 @@ Identifier::replace_string (const char * s) ACE_OS::free (this->pv_string); } - pv_string = ACE_OS::strdup (s); + this->pv_string = ACE_OS::strdup (s); } // Compare two Identifier * long Identifier::compare (Identifier *o) { - if (o == NULL) return I_FALSE; - if (pv_string == NULL || o->get_string() == NULL) - return I_FALSE; - return (ACE_OS::strcmp (pv_string, o->get_string ()) == 0) ? I_TRUE : I_FALSE; + if (o == 0) + { + return I_FALSE; + }; + + if (this->pv_string == 0 || o->get_string () == 0) + { + return I_FALSE; + } + + return (ACE_OS::strcmp (this->pv_string, o->get_string ()) == 0); } // Report the appropriate error if the two identifiers differ only in case. @@ -153,22 +186,30 @@ Identifier::copy (void) { Identifier *retval = 0; ACE_NEW_RETURN (retval, - Identifier (this->pv_string, - 1, - 0, - I_FALSE), + Identifier (this->pv_string), 0); + retval->escaped_ = this->escaped_; + return retval; } -// Dumping +idl_bool +Identifier::escaped (void) const +{ + return this->escaped_; +} + +// Dumping. void Identifier::dump (ostream &o) { - if (pv_string == NULL) return; + if (this->pv_string == 0) + { + return; + } - o << get_string(); + o << get_string (); } void diff --git a/TAO/TAO_IDL/util/utl_scope.cpp b/TAO/TAO_IDL/util/utl_scope.cpp index 97b6c422e92..040a3a85a7b 100644 --- a/TAO/TAO_IDL/util/utl_scope.cpp +++ b/TAO/TAO_IDL/util/utl_scope.cpp @@ -92,20 +92,14 @@ is_global_name (Identifier *i) if (_global_scope_name == 0) { ACE_NEW_RETURN (_global_scope_name, - Identifier ("::", - 1, - 0, - I_FALSE), + Identifier ("::"), 0); } if (_global_scope_root_name == 0) { ACE_NEW_RETURN (_global_scope_root_name, - Identifier ("", - 1, - 0, - I_FALSE), + Identifier (""), 0); } @@ -317,10 +311,54 @@ UTL_Scope::lookup_for_add (AST_Decl *d, return 0; } - return lookup_by_name_local (d->local_name (), + Identifier *id = d->local_name (); + + if (this->idl_keyword_clash (id) != 0) + { + return 0; + } + + return lookup_by_name_local (id, 0); } +int +UTL_Scope::idl_keyword_clash (Identifier *e) +{ + if (e->escaped ()) + { + return 0; + } + + char *tmp = e->get_string (); + + UTL_String utl_tmp (tmp); + + ACE_CString ext_id (utl_tmp.get_canonical_rep (), + 0, + 0); + + int status = idl_global->idl_keywords ().find (ext_id); + + utl_tmp.destroy (); + + if (status == 0) + { + if (idl_global->case_diff_error ()) + { + idl_global->err ()->idl_keyword_error (tmp); + } + else + { + idl_global->err ()->idl_keyword_warning (tmp); + } + + return -1; + } + + return 0; +} + // Public operations. // Narrowing @@ -1090,21 +1128,6 @@ UTL_Scope::lookup_by_name_local (Identifier *e, return 0; } - // Temporary hack to disallow 'fixed' without - // implementing all the classes for it. - UTL_String arg (e->get_string ()); - UTL_String test ("fixed"); - - long equal = arg.compare (&test); - - arg.destroy (); - test.destroy (); - - if (equal) - { - return 0; - } - UTL_ScopeActiveIterator *i = 0; ACE_NEW_RETURN (i, UTL_ScopeActiveIterator (this, diff --git a/TAO/orbsvcs/orbsvcs/CosLifeCycle.idl b/TAO/orbsvcs/orbsvcs/CosLifeCycle.idl index 456e2fdd5d2..f71e9cd2610 100644 --- a/TAO/orbsvcs/orbsvcs/CosLifeCycle.idl +++ b/TAO/orbsvcs/orbsvcs/CosLifeCycle.idl @@ -43,8 +43,8 @@ module CosLifeCycle // The purpose of the life cycle service is to typedef CosNaming::Name Key; - typedef Object Factory; - typedef sequence <Factory> Factories; + typedef Object _Factory; + typedef sequence <_Factory> Factories; typedef struct NVP { diff --git a/TAO/orbsvcs/orbsvcs/FT_CORBA.idl b/TAO/orbsvcs/orbsvcs/FT_CORBA.idl index 1331c711692..6dde090bee2 100644 --- a/TAO/orbsvcs/orbsvcs/FT_CORBA.idl +++ b/TAO/orbsvcs/orbsvcs/FT_CORBA.idl @@ -104,7 +104,7 @@ module FT typedef Properties Criteria; struct FactoryInfo { - GenericFactory factory; + GenericFactory _factory; Location the_location; Criteria the_criteria; }; diff --git a/TAO/tao/orb.idl b/TAO/tao/orb.idl index 8eeae1e1e87..a7a16b9f9bb 100644 --- a/TAO/tao/orb.idl +++ b/TAO/tao/orb.idl @@ -30,10 +30,8 @@ module CORBA SYSTEM_EXCEPTION }; - interface Object; interface Request; interface NVList; - interface Exception; typedef sequence<Request> RequestSeq; |