[omniORB] Warnings regarding copy ctors with new gcc
Tingle, Alex
Alex.Tingle at bronermetals.com
Mon Feb 2 10:02:11 GMT 2004
> - inline ServantBase(const ServantBase&) {}
> + inline ServantBase(const ServantBase&) : omniServant() {}
Shouldn't you be calling the base class's copy constructor rather than its
default constructor? Like this:
- inline ServantBase(const ServantBase&) {}
+ inline ServantBase(const ServantBase& right) : omniServant(right) {}
-Alex
--
> -----Original Message-----
> From: Matej Kenda [mailto:matej.kenda at hermes.si]
> Sent: 30 January 2004 10:42
> To: omniORB
> Subject: Re: [omniORB] Warnings regarding copy ctors with new gcc
>
>
> Hi,
>
> This patch removes the warnings, issued by gcc 3.3:
>
> Index: include/omniORB4/poa.h
> ===================================================================
> RCS file: /cvsroot/omniorb/omni/include/omniORB4/Attic/poa.h,v
> retrieving revision 1.2.2.13
> diff --unified -r1.2.2.13 poa.h
> --- include/omniORB4/poa.h 26 Jul 2003 22:52:22 -0000
> 1.2.2.13
> +++ include/omniORB4/poa.h 30 Jan 2004 10:38:53 -0000
> @@ -682,7 +682,7 @@
>
> protected:
> inline ServantBase() {}
> - inline ServantBase(const ServantBase&) {}
> + inline ServantBase(const ServantBase&) : omniServant() {}
> inline ServantBase& operator = (const ServantBase&) {
> return *this; }
>
> void* _do_this(const char* repoId);
> @@ -706,7 +706,7 @@
>
> protected:
> inline RefCountServantBase() : pd_refCount(1) {}
> - inline RefCountServantBase(const RefCountServantBase&) :
> pd_refCount(1) {}
> + inline RefCountServantBase(const RefCountServantBase&) :
> omniServant(), ServantBase(), pd_refCount(1) {}
> inline RefCountServantBase& operator = (const
> RefCountServantBase&)
> { return *this; }
>
>
> Best regards,
>
> Matej
>
> On Wed, 2004-01-21 at 16:52, Matej Kenda wrote:
> > Hi,
> >
> > I have noticed that newer versions of g++ (3.3.1 on SUSE9
> or 3.3.2 on
> > Fedora 1) issue warnings about explicit initialisation of
> base classes
> > when including headers of omniORB 4.0.3.
> >
> > I have checked the headers, but I'm not sure what's the problem or
> > whether I should do anything to remove this warning.
> >
> > I have copied relevant portions of header files and the
> warning messages
> > to the end of this e-mail.
> >
> > Regards,
> >
> > Matej
> >
> > ----
> > omniServant.h:
> >
> > class omniServant {
> > protected:
> > inline omniServant() {}
> > inline omniServant(const omniServant&) {}
> > inline omniServant& operator = (const omniServant&) {
> return *this; }
> > ...
> >
> > ----
> > poa.h:
> >
> > class ServantBase : public virtual omniServant {
> > public:
> > virtual ~ServantBase();
> >
> > ...
> > protected:
> > inline ServantBase() {}
> > inline ServantBase(const ServantBase&) {}
> > inline ServantBase& operator = (const ServantBase&) {
> return *this;
> > }
> >
> > ** Warning messages:
> >
> > In file included from
> > /home/matejk/3rdparty/omniORB4/include/omniORB4/CORBA.h:449,
> > from
> > /home/matejk/src/include/ivd/i_types.h:10,
> > from .linux.ia32/i_types.cc:3:
> > /home/matejk/3rdparty/omniORB4/include/omniORB4/poa.h:
> > In copy constructor
> `PortableServer::ServantBase::ServantBase(const
> PortableServer::ServantBase&)':
> > /home/matejk/3rdparty/omniORB4/include/omniORB4/poa.h:691: warning:
> > base class `class omniServant' should be explicitly
> initialized in the copy constructor
> > /home/matejk/3rdparty/omniORB4/include/omniORB4/poa.h:
> > In copy constructor
> `PortableServer::RefCountServantBase::RefCountServantBase(cons
> t PortableServer::RefCountServantBase&)':
> > /home/matejk/3rdparty/omniORB4/include/omniORB4/poa.h:715: warning:
> > base class `class omniServant' should be explicitly
> initialized in the copy constructor
> > /home/matejk/3rdparty/omniORB4/include/omniORB4/poa.h:715: warning:
> > base class `class PortableServer::ServantBase' should be
> explicitly initialized in the copy constructor
> --
> Matej Kenda, Lead Engineer
> HERMES SoftLab (www.hermes-softlab.com)
> Erjavčeva 2, 5000 Nova Gorica, Slovenia
>
>
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>
More information about the omniORB-list
mailing list