diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-28 23:29:01 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-28 23:29:01 +0000 |
commit | 67ff03f8610563f55ce1f76087a2debb2daa35a9 (patch) | |
tree | 239a36b751fcd82de264b1a1184ec8a316215ba9 | |
parent | c3e6068c94fcf1cee12f187fa8fb53c4a016118c (diff) | |
download | ATCD-67ff03f8610563f55ce1f76087a2debb2daa35a9.tar.gz |
Final fix to IDL_Test code generation problems.
-rw-r--r-- | TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp index f44a117f706..2e89af77bc8 100644 --- a/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp +++ b/TAO/TAO_IDL/be/be_visitor_array/array_ci.cpp @@ -248,15 +248,27 @@ be_visitor_array_ci::gen_var_impl (be_array *node) // two operator []s instead of -> os->indent (); - *os << "ACE_INLINE const " << nodename << "_slice &" << be_nl; + *os << "ACE_INLINE " << be_nl; + *os << "const " << nodename << "_slice &" << be_nl; *os << fname << "::operator[] (CORBA::ULong index) const" << be_nl; *os << "{" << be_idt_nl; + + // MSVC requires an explicit cast for this. SunCC will + // not accept one, but will do it implicitly with a temporary. + // It's only a problem with multidimensional arrays. +#if defined (ACE_HAS_BROKEN_IMPLICIT_CONST_CAST) *os << "return ACE_const_cast (const " << nodename << "_slice &, this->ptr_[index]);" << be_uidt_nl; +#else + *os << "const " << nodename << "_slice &tmp = this->ptr_[index];" << be_nl; + *os << "return tmp;" << be_uidt_nl; +#endif /* ACE_HAS_BROKEN_IMPLICIT_CONST_CAST */ + *os << "}\n\n"; os->indent (); - *os << "ACE_INLINE " << nodename << "_slice &" << be_nl; + *os << "ACE_INLINE " << be_nl; + *os << nodename << "_slice &" << be_nl; *os << fname << "::operator[] (CORBA::ULong index)" << be_nl; *os << "{" << be_idt_nl; *os << "return this->ptr_[index];" << be_uidt_nl; @@ -585,15 +597,27 @@ be_visitor_array_ci::gen_forany_impl (be_array *node) // two operator []s instead of -> os->indent (); - *os << "ACE_INLINE " << nodename << "_slice const &" << be_nl; + *os << "ACE_INLINE " << be_nl; + *os << "const " << nodename << "_slice &" << be_nl; *os << fname << "::operator[] (CORBA::ULong index) const" << be_nl; *os << "{" << be_idt_nl; - *os << "return ACE_const_cast (" << nodename - << "_slice const &, this->ptr_[index]);" << be_uidt_nl; + + // MSVC requires an explicit cast for this. SunCC will + // not accept one, but will do it implicitly with a temporary. + // It's only a problem with multidimensional arrays. +#if defined (ACE_HAS_BROKEN_IMPLICIT_CONST_CAST) + *os << "return ACE_const_cast (const " << nodename + << "_slice &, this->ptr_[index]);" << be_uidt_nl; +#else + *os << "const " << nodename << "_slice &tmp = this->ptr_[index];" << be_nl; + *os << "return tmp;" << be_uidt_nl; +#endif /* ACE_HAS_BROKEN_IMPLICIT_CONST_CAST */ + *os << "}\n\n"; os->indent (); - *os << "ACE_INLINE " << nodename << "_slice &" << be_nl; + *os << "ACE_INLINE " << be_nl; + *os << nodename << "_slice &" << be_nl; *os << fname << "::operator[] (CORBA::ULong index)" << be_nl; *os << "{" << be_idt_nl; *os << "return this->ptr_[index];" << be_uidt_nl; |