diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-03-02 07:22:20 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-03-02 07:22:20 +0000 |
commit | 20ea5a7ce5fd0ec80a879e70cfc2b47eeb62f530 (patch) | |
tree | bd761bcaba93b5771ed1f978f0f2ff845a73d9a6 | |
parent | 0960d644307e683f9a1a26fd71d259c42550ec3b (diff) | |
download | ATCD-20ea5a7ce5fd0ec80a879e70cfc2b47eeb62f530.tar.gz |
Fri Mar 2 07:21:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
-rw-r--r-- | TAO/ChangeLog | 10 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_attribute.cpp | 9 | ||||
-rw-r--r-- | TAO/TAO_IDL/be/be_union.cpp | 24 |
3 files changed, 32 insertions, 11 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 9a3252e834c..94366915ba4 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,13 @@ +Fri Mar 2 07:21:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl> + + * TAO_IDL/be/be_attribute.cpp: + No need to set the flag that an operation has been seen + + * TAO_IDL/be/be_union.cpp: + When we have an union with an enum as discriminator and the + number of labels is the same as the enum has members we don't + need to generate a default case. Fixes bugzilla 2838 + Thu Mar 1 21:32:04 UTC 2007 Wallace Zhang <zhang_w@ociweb.com> * tao/DynamicInterface/DII_Reply_Handler.cpp: diff --git a/TAO/TAO_IDL/be/be_attribute.cpp b/TAO/TAO_IDL/be/be_attribute.cpp index ad32663ab16..3856bc4bcdb 100644 --- a/TAO/TAO_IDL/be/be_attribute.cpp +++ b/TAO/TAO_IDL/be/be_attribute.cpp @@ -77,11 +77,6 @@ be_attribute::be_attribute (bool ro, be_operation_default_strategy (0)); this->set_strategy_ = bods; - // TAO_IDL generated attribute methods currently have an exception - // specification containing CORBA::SystemException. Make sure we - // generate a "tao/SystemException.h" include directive. - idl_global->operation_seen_ = true; - if (!this->imported () && !this->is_local ()) { // For the return types of the two operations @@ -147,14 +142,14 @@ be_attribute::destroy (void) delete this->get_strategy_; this->get_strategy_ = 0; } - + if (0 != this->set_strategy_) { this->set_strategy_->destroy (); delete this->set_strategy_; this->set_strategy_ = 0; } - + this->be_decl::destroy (); this->AST_Attribute::destroy (); } diff --git a/TAO/TAO_IDL/be/be_union.cpp b/TAO/TAO_IDL/be/be_union.cpp index 7d23e07703d..88793203862 100644 --- a/TAO/TAO_IDL/be/be_union.cpp +++ b/TAO/TAO_IDL/be/be_union.cpp @@ -26,6 +26,7 @@ #include "be_extern.h" #include "ast_union_branch.h" +#include "ast_enum.h" #include "utl_identifier.h" #include "idl_defines.h" #include "global_extern.h" @@ -124,7 +125,7 @@ be_union::destroy (void) this->be_scope::destroy (); this->be_type::destroy (); this->AST_Union::destroy (); - + } // Visitor method. @@ -146,9 +147,26 @@ be_union::gen_empty_default_label (void) AST_ConcreteType *disc = this->disc_type (); AST_Decl::NodeType nt = disc->node_type (); + unsigned long n_labels = this->nlabels (); + if (nt == AST_Decl::NT_enum) { - return true; + AST_Enum *ast_enum = AST_Enum::narrow_from_decl (disc); + if (ast_enum == 0) + { + return true; + } + + // If we have an enum and the number of labels if as big as the enum + // has members we don't have to generate a default label + if (n_labels == (unsigned long)ast_enum->member_count ()) + { + return false; + } + else + { + return true; + } } AST_PredefinedType *pdt = AST_PredefinedType::narrow_from_decl (disc); @@ -158,8 +176,6 @@ be_union::gen_empty_default_label (void) return true; } - unsigned long n_labels = this->nlabels (); - if (pdt->pt () == AST_PredefinedType::PT_boolean && n_labels == 2) { return false; |