Property - Default initialise temporary to avoid GCC7 warnings.
When building the LHCb stack using GCC7, and I seeing warnings like
[1493/1506] Building CXX object Rich/RichFutureDAQ/CMakeFiles/RichFutureDAQ.dir/src/RichRawBankDecoder.cpp.o
In file included from /usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/TypeNameString.h:3:0,
from /usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/ISvcManager.h:7,
from /usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/ISvcLocator.h:6,
from /usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Algorithm.h:11,
from /usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiAlg/GaudiAlgorithm.h:11,
from ../Rich/RichFutureKernel/RichFutureKernel/RichAlgBase.h:15,
from /var/clus/usera/jonesc/LHCbCMake/Master/LHCb/Rich/RichFutureDAQ/src/RichRawBankDecoder.h:16,
from /var/clus/usera/jonesc/LHCbCMake/Master/LHCb/Rich/RichFutureDAQ/src/RichRawBankDecoder.cpp:3:
/usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Property.h: In member function ‘StatusCode Gaudi::Property<TYPE, VERIFIER, HANDLERS>::fromString(const string&) [with TYPE = std::array<bool, 2>; VERIFIER = Gaudi::Details::Property::NullVerifier; HANDLERS = Gaudi::Details::Property::UpdateHandler]’:
/usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Property.h:468:7: warning: ‘*((void*)& tmp +1)’ may be used uninitialized in this function [-Wmaybe-uninitialized]
m_value = std::forward<T>( v );
^~~~~~~
/usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Property.h:162:16: note: ‘*((void*)& tmp +1)’ was declared here
TYPE tmp;
^~~
/usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Property.h:468:7: warning: ‘tmp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
m_value = std::forward<T>( v );
^~~~~~~
/usera/jonesc/LHCbCMake/Master/Gaudi/InstallArea/x86_64-centos7-gcc7-opt/include/GaudiKernel/Property.h:162:16: note: ‘tmp’ was declared here
TYPE tmp;
^~~
The issue is the method toString
creates a temporary which could (or GCC7 things it could) be used uninitialised. This MR simply adds a default initializer to the temporary.
Edited by Christopher Rob Jones