EPICS Home

Experimental Physics and Industrial Control System


 
2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EPICS 7.0.1-pre1 (pdbsingle.cpp)
From: Dirk Zimoch <[email protected]>
To: Michael Davidsaver <[email protected]>
Cc: [email protected]
Date: Thu, 23 Nov 2017 11:19:08 +0100
On 22.11.2017 17:24, Michael Davidsaver wrote:
On 11/22/2017 06:28 AM, Dirk Zimoch wrote:
ELDK 4.2 ppc 4xx cross build fails here:
../pvif.h: In constructor 'PDBSinglePut::PDBSinglePut(const
std::tr1::shared_ptr<PDBSingleChannel>&, const
std::tr1::shared_ptr<epics::pvAccess::ChannelPutRequester>&, const
std::tr1::shared_ptr<epics::pvData::PVStructure>&)':
../pvif.h:291: error: 'FieldName::FieldName(const FieldName&)' is private
../pdbsingle.cpp:300: error: within this context
../pvif.h: In member function 'virtual void PDBSinglePut::put(const
std::tr1::shared_ptr<epics::pvData::PVStructure>&, const
std::tr1::shared_ptr<epics::pvData::BitSet>&)':
../pvif.h:291: error: 'FieldName::FieldName(const FieldName&)' is private
../pdbsingle.cpp:364: error: within this context
../pvif.h:291: error: 'FieldName::FieldName(const FieldName&)' is private
../pdbsingle.cpp:386: error: within this context
make[4]: *** [pdbsingle.o] Error 1


Can you provide the full set of arguments passed to GCC?  Also, can you
confirm that this is gcc 4.2.2?


Here is the compiler call for vxWorks 6.6:
/afs/psi.ch/project/vxworks/VxWorks6.6/gnu/4.1.2-vxworks-6.6/x86-linux2/bin/ccppc -DUSE_TYPED_RSET -I../../common -I../../p2pApp -DFINAL_LOCATION="\"/usr/local/epics/base-7.0.1\"" -DCPU=PPC603 -DvxWorks=vxWorks -include /afs/psi.ch/project/vxworks/VxWorks6.6/vxworks-6.6/target/h/vxWorks.h -O2 -Wall -mcpu=603 -mstrict-align -mlongcall -fno-builtin -I. -I../O.Common -I. -I. -I.. -I/usr/local/epics/base-7.0.1/include/compiler/gcc -I/usr/local/epics/base-7.0.1/include/os/vxWorks -I/usr/local/epics/base-7.0.1/include -I/usr/local/epics/base-7.0.1/include/compiler/gcc -I/usr/local/epics/base-7.0.1/include/os/vxWorks -I/usr/local/epics/base-7.0.1/include -I/afs/psi.ch/project/vxworks/VxWorks6.6/vxworks-6.6/target/h -I/afs/psi.ch/project/vxworks/VxWorks6.6/vxworks-6.6/target/h/wrn/coreip -c ../pdbsingle.cpp

This is the call for ELDK 4.2:
/net/gfa-eldk/export/home/eldk-4.2/usr/bin/ppc_4xxFP-g++ -D_GNU_SOURCE -D_DEFAULT_SOURCE -DUSE_TYPED_RSET -I../../common -I../../p2pApp -DFINAL_LOCATION="\"/usr/local/epics/base-7.0.1\"" -DUNIX -Dlinux -O3 -Wall -I /net/gfa-eldk/export/home/eldk-4.2/ppc_4xxFP/usr/include/c++/4.2.2 -I /net/gfa-eldk/export/home/eldk-4.2/ppc_4xxFP/usr/include/c++/4.2.2/powerpc-linux -I /net/gfa-eldk/export/home/eldk-4.2/ppc_4xxFP/usr/include/c++/4.2.2/backward -fPIC -I. -I../O.Common -I. -I. -I.. -I/usr/local/epics/base-7.0.1/include/compiler/gcc -I/usr/local/epics/base-7.0.1/include/os/Linux -I/usr/local/epics/base-7.0.1/include -I/usr/local/epics/base-7.0.1/include/compiler/gcc -I/usr/local/epics/base-7.0.1/include/os/Linux -I/usr/local/epics/base-7.0.1/include -c ../pdbsingle.cpp

These are the compilers:
ELDK 4.2: gcc version 4.2.2
vxWorks 6.6, 6.7: gcc 4.1.2


The following compilers have no problem with this call:

Scientific Linux 6.8:
gcc version 4.4.7 20120313 (Red Hat 4.4.7-8) (GCC)

RH Enterprise Linux 7.3:
gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)

Yocto 2.1:
gcc version 6.2.1 20161016 (Linaro GCC 6.2-2016.11)

Freescale Linux 2.0:
gcc version 4.9.2 (GCC)

ELDK 5.1:
gcc version 4.6.1 20110627 (prerelease) (GCC)

ELDK 5.2:
gcc version 4.6.4 20120303 (prerelease) (GCC)



I intentionally made the FieldName class non-copyable so that I wouldn't
accidentally copy it (and its std::vector).  The lines in question eg.
pdbsingle.cpp:300 look like:

...attach(channel->pv->chan, value, FieldName())

Where the last argument is "const FieldName&".

To my understanding, this shouldn't involve a copy.  Before I change
this code I'd like to find where my understanding is wrong.


Clang 3.4.2 gives an interesting hint with its warnings. It seems that this call creates a temporary, for which of course a copy is needed. If you wanted to detect accidental copies, this is such a case.

Here are the clang warnings:

../pdbsingle.cpp:300:64: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] ,pvif(channel->pv->builder->attach(channel->pv->chan, pvf, FieldName()))
                                                               ^
../pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../pdbsingle.cpp:364:92: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> putpvif(channel->pv->builder->attach(channel->pv->chan, value, FieldName()));

                   ^
../pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../pdbsingle.cpp:386:92: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> putpvif(channel->pv->builder->attach(channel->pv->chan, value, FieldName()));

                   ^
../pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../testpvif.cpp:75:63: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> pvif_li(builder.attach(chan_li, root, FieldName("li")));
                                                              ^
../../pdbApp/pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../testpvif.cpp:76:63: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> pvif_si(builder.attach(chan_si, root, FieldName("si")));
                                                              ^
../../pdbApp/pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../testpvif.cpp:77:63: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> pvif_ai(builder.attach(chan_ai, root, FieldName("ai")));
                                                              ^
../../pdbApp/pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../testpvif.cpp:78:73: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> pvif_ai_rval(builder.attach(chan_ai_rval, root, FieldName("ai_rval")));
                                                                        ^
../../pdbApp/pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../testpvif.cpp:79:67: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> pvif_mbbi(builder.attach(chan_mbbi, root, FieldName("mbbi")));
                                                                  ^
../../pdbApp/pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../testpvif.cpp:337:64: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> pvif_li(builder->attach(chan_li, root, FieldName("li")));
                                                               ^
../../pdbApp/pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../testpvif.cpp:338:64: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> pvif_si(builder->attach(chan_si, root, FieldName("si")));
                                                               ^
../../pdbApp/pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../testpvif.cpp:339:64: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> pvif_ai(builder->attach(chan_ai, root, FieldName("ai")));
                                                               ^
../../pdbApp/pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^
../testpvif.cpp:340:68: warning: C++98 requires an accessible copy constructor for class 'FieldName' when binding a reference to a temporary; was private [-Wbind-to-temporary-copy] p2p::auto_ptr<PVIF> pvif_mbbi(builder->attach(chan_mbbi, root, FieldName("mbbi")));
                                                                   ^
../../pdbApp/pvif.h:291:5: note: declared private here
    FieldName(const FieldName&);
    ^


Replies:
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
References:
EPICS 7.0.1-pre1 Andrew Johnson
Re: EPICS 7.0.1-pre1 Dirk Zimoch
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Michael Davidsaver

Navigate by Date:
Prev: Re: EPICS 7.0.1-pre1 (typeCast.h) Dirk Zimoch
Next: Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Michael Davidsaver
Next: Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024