From ca8a80cf6994a596c9a0e2ae185381de06e8791b Mon Sep 17 00:00:00 2001 From: Adam Mitz Date: Fri, 13 Dec 2024 09:45:37 -0600 Subject: [PATCH] Merge pull request #2306 from mitza-oci/warnings Fixed some warnings (cherry picked from commit 59970076e15259aa0dd180297343f8a24298894a) # Conflicts: # TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp --- TAO/TAO_IDL/be/be_interface.cpp | 2 +- .../be/be_visitor_interface/amh_ss.cpp | 2 +- .../be/be_visitor_interface/interface_ss.cpp | 24 ++++++++--- TAO/tao/Bounded_Array_Sequence_T.h | 43 +++++++++++-------- TAO/tao/Unbounded_Array_Sequence_T.h | 43 +++++++++++-------- 5 files changed, 68 insertions(+), 46 deletions(-) diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index 91c825d790a7c..b7d7a03e50330 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -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; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp index 7d832aa8ebb07..066a4182e4d5e 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/amh_ss.cpp @@ -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; } diff --git a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp index d6aca0bd09737..ea555e422910b 100644 --- a/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp +++ b/TAO/TAO_IDL/be/be_visitor_interface/interface_ss.cpp @@ -107,9 +107,17 @@ 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 @@ -121,11 +129,15 @@ be_visitor_interface_ss::visit_interface (be_interface *node) *os << 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) { diff --git a/TAO/tao/Bounded_Array_Sequence_T.h b/TAO/tao/Bounded_Array_Sequence_T.h index 8a9b6230a047b..904849899dffb 100644 --- a/TAO/tao/Bounded_Array_Sequence_T.h +++ b/TAO/tao/Bounded_Array_Sequence_T.h @@ -94,33 +94,38 @@ class bounded_array_sequence namespace TAO { template - bool demarshal_sequence(stream & strm, TAO::bounded_array_sequence & target) { + bool demarshal_sequence (stream &strm, TAO::bounded_array_sequence &target) { typedef typename TAO::bounded_array_sequence sequence; typedef TAO_Array_Forany_T forany; typedef TAO::Array_Traits 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; } diff --git a/TAO/tao/Unbounded_Array_Sequence_T.h b/TAO/tao/Unbounded_Array_Sequence_T.h index 2de921a3f0b54..0a3346eedf783 100644 --- a/TAO/tao/Unbounded_Array_Sequence_T.h +++ b/TAO/tao/Unbounded_Array_Sequence_T.h @@ -96,33 +96,38 @@ class unbounded_array_sequence namespace TAO { template - bool demarshal_sequence(stream & strm, TAO::unbounded_array_sequence & target) { + bool demarshal_sequence (stream &strm, TAO::unbounded_array_sequence &target) { typedef TAO::unbounded_array_sequence sequence; typedef TAO_Array_Forany_T forany; typedef TAO::Array_Traits 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; }