Skip to content

Commit

Permalink
Merge pull request #2307 from mitza-oci/ace6tao2
Browse files Browse the repository at this point in the history
[ACE6_TAO2] Fixed some warnings
  • Loading branch information
mitza-oci authored Jan 10, 2025
2 parents e30e2e9 + a2d38e2 commit dad2329
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 53 deletions.
2 changes: 1 addition & 1 deletion TAO/TAO_IDL/be/be_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2322,7 +2322,7 @@ be_interface::copy_ctor_helper (be_interface *derived,
{
// We can't call ourselves in a copy constructor, and
// abstract interfaces don't exist on the skeleton side.
if (derived == base || base->is_abstract ())
if (derived == base || base->is_abstract () || derived->nmembers () > 0)
{
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ TAO_IDL_Copy_Ctor_Worker::emit (be_interface *derived,
TAO_OutStream *os,
be_interface *base)
{
if (derived == base)
if (derived == base || derived->nmembers () > 0)
{
return 0;
}
Expand Down
7 changes: 6 additions & 1 deletion TAO/TAO_IDL/be/be_visitor_interface/interface_ih.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@ be_visitor_interface_ih::visit_interface (be_interface *node)
<< be_global->impl_class_prefix () << namebuf
<< be_global->impl_class_suffix () << " (const "
<< be_global->impl_class_prefix () << namebuf
<< be_global->impl_class_suffix () << "&);" <<be_nl <<be_nl;
<< be_global->impl_class_suffix () << "&)\n"
<< "#ifdef ACE_HAS_CPP11" << be_idt_nl
<< "= default\n"
<< "#endif" << be_uidt_nl
<< ";" << be_nl
<< be_nl;
}

if (be_global->gen_assign_op ())
Expand Down
6 changes: 4 additions & 2 deletions TAO/TAO_IDL/be/be_visitor_interface/interface_is.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ be_visitor_interface_is::visit_interface (be_interface *node)

if (be_global->gen_copy_ctor () && !node->is_local ())
{
*os << "//Implementation Skeleton Copy Constructor" << be_nl;
*os << "//Implementation Skeleton Copy Constructor\n"
<< "#ifndef ACE_HAS_CPP11" << be_nl;

*os << be_global->impl_class_prefix () << node->flat_name ()
<< be_global->impl_class_suffix () <<"::"
Expand Down Expand Up @@ -105,7 +106,8 @@ be_visitor_interface_is::visit_interface (be_interface *node)

*os << be_uidt_nl
<< "{" << be_nl
<< "}" << be_nl << be_uidt_nl;
<< "}\n"
<< "#endif" << be_nl << be_uidt_nl;
}

if (be_global->gen_assign_op ())
Expand Down
6 changes: 5 additions & 1 deletion TAO/TAO_IDL/be/be_visitor_interface/interface_sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ be_visitor_interface_sh::visit_interface (be_interface *node)

// Copy constructor and destructor.
*os << class_name.c_str () << " (const "
<< class_name.c_str () << "& rhs);" << be_nl
<< class_name.c_str () << "& rhs)\n"
<< "#ifdef ACE_HAS_CPP11" << be_idt_nl
<< "= default\n"
<< "#endif" << be_uidt_nl
<< ";" << be_nl
<< "virtual ~" << class_name.c_str () << " (void);" << be_nl_2;

// _is_a
Expand Down
32 changes: 23 additions & 9 deletions TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,25 +107,38 @@ be_visitor_interface_ss::visit_interface (be_interface *node)

*os << full_skel_name << "::"
<< local_name_prefix << node_local_name
<< " (void)" << be_idt_nl;
<< " ()";

*os << ": TAO_ServantBase ()" << be_uidt_nl;
bool const init_bases = node->nmembers () == 0;
if (init_bases)
{
*os << be_idt_nl << ": TAO_ServantBase ()" << be_uidt_nl;
}
else
{
*os << be_nl;
}

// Default constructor body.
*os << "{" << be_idt_nl
<< "this->optable_ = &tao_" << flat_name
<< "_optable;" << be_uidt_nl
<< "}" << be_nl_2;
<< "}\n\n";

// find if we are at the top scope or inside some module
*os << full_skel_name << "::"
*os << "#ifndef ACE_HAS_CPP11" << be_nl
<< full_skel_name << "::"
<< local_name_prefix << node_local_name << " ("
<< "const " << local_name_prefix
<< node_local_name << "& rhs)";
<< node_local_name << " &"
<< (init_bases ? "rhs" : "") << ")";

*os << be_idt_nl
<< ": TAO_Abstract_ServantBase (rhs)," << be_nl
<< " TAO_ServantBase (rhs)";
if (init_bases)
{
*os << be_idt_nl
<< ": TAO_Abstract_ServantBase (rhs)," << be_nl
<< " TAO_ServantBase (rhs)";
}

if (this->generate_copy_ctor (node, os) == -1)
{
Expand All @@ -138,7 +151,8 @@ be_visitor_interface_ss::visit_interface (be_interface *node)

*os << be_uidt_nl
<< "{" << be_nl
<< "}" << be_nl_2;
<< "}\n"
<< "#endif" << be_nl_2;

*os << full_skel_name << "::~"
<< local_name_prefix << node_local_name
Expand Down
43 changes: 24 additions & 19 deletions TAO/tao/Bounded_Array_Sequence_T.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,33 +94,38 @@ class bounded_array_sequence
namespace TAO
{
template <typename stream, typename T_array, typename T_slice, typename T_tag, CORBA::ULong MAX>
bool demarshal_sequence(stream & strm, TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> & target) {
bool demarshal_sequence (stream &strm, TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> &target) {
typedef typename TAO::bounded_array_sequence<T_array, T_slice, T_tag, MAX> sequence;
typedef TAO_Array_Forany_T<T_array, T_slice, T_tag> forany;
typedef TAO::Array_Traits<forany> array_traits;

::CORBA::ULong new_length = 0;
if (!(strm >> new_length)) {
return false;
}
if ((new_length > strm.length()) || (new_length > target.maximum ())) {
return false;
}
sequence tmp;
tmp.length(new_length);
typename sequence::value_type * buffer = tmp.get_buffer();
for(CORBA::ULong i = 0; i < new_length; ++i) {
forany tmp (array_traits::alloc ());
bool const _tao_marshal_flag = (strm >> tmp);
if (_tao_marshal_flag) {
array_traits::copy (buffer[i], tmp.in ());
if (!(strm >> new_length))
{
return false;
}
array_traits::free (tmp.inout ());
if (!_tao_marshal_flag) {
if ((new_length > strm.length ()) || (new_length > target.maximum ()))
{
return false;
}
}
tmp.swap(target);
sequence tmp;
tmp.length (new_length);
typename sequence::value_type *const buffer = tmp.get_buffer ();
for (CORBA::ULong i = 0; i < new_length; ++i)
{
forany wrapper (array_traits::alloc ());
bool const _tao_marshal_flag = strm >> wrapper;
if (_tao_marshal_flag)
{
array_traits::copy (buffer[i], wrapper.in ());
}
array_traits::free (wrapper.inout ());
if (!_tao_marshal_flag)
{
return false;
}
}
tmp.swap (target);
return true;
}

Expand Down
43 changes: 24 additions & 19 deletions TAO/tao/Unbounded_Array_Sequence_T.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,38 @@ class unbounded_array_sequence
namespace TAO
{
template <typename stream, typename T_array, typename T_slice, typename T_tag>
bool demarshal_sequence(stream & strm, TAO::unbounded_array_sequence<T_array, T_slice, T_tag> & target) {
bool demarshal_sequence (stream &strm, TAO::unbounded_array_sequence<T_array, T_slice, T_tag> &target) {
typedef TAO::unbounded_array_sequence<T_array, T_slice, T_tag> sequence;
typedef TAO_Array_Forany_T <T_array, T_slice, T_tag> forany;
typedef TAO::Array_Traits<forany> array_traits;

::CORBA::ULong new_length = 0;
if (!(strm >> new_length)) {
return false;
}
if (new_length > strm.length()) {
return false;
}
sequence tmp(new_length);
tmp.length(new_length);
typename sequence::value_type * buffer = tmp.get_buffer();
for(CORBA::ULong i = 0; i < new_length; ++i) {
forany tmp (array_traits::alloc ());
bool const _tao_marshal_flag = (strm >> tmp);
if (_tao_marshal_flag) {
array_traits::copy (buffer[i], tmp.in ());
if (!(strm >> new_length))
{
return false;
}
array_traits::free (tmp.inout ());
if (!_tao_marshal_flag) {
if (new_length > strm.length ())
{
return false;
}
}
tmp.swap(target);
sequence tmp (new_length);
tmp.length (new_length);
typename sequence::value_type *const buffer = tmp.get_buffer ();
for (CORBA::ULong i = 0; i < new_length; ++i)
{
forany wrapper (array_traits::alloc ());
bool const _tao_marshal_flag = strm >> wrapper;
if (_tao_marshal_flag)
{
array_traits::copy (buffer[i], wrapper.in ());
}
array_traits::free (wrapper.inout ());
if (!_tao_marshal_flag)
{
return false;
}
}
tmp.swap (target);
return true;
}

Expand Down

0 comments on commit dad2329

Please sign in to comment.