warning fix in the bmon unpacker
Compare changes
+ 8
− 6
@@ -24,11 +24,6 @@ namespace cbm::algo::bmon
@@ -63,6 +58,13 @@ namespace cbm::algo::bmon
@@ -71,7 +73,7 @@ namespace cbm::algo::bmon
This MR fixes the following compiler warning:
/home/cbmdock/cbmroot/algo/detectors/bmon/Unpack.cxx: In member function 'cbm::algo::bmon::Unpack::resultType cbm::algo::bmon::Unpack::operator()(const uint8_t*, const fles::MicrosliceDescriptor&, uint64_t) const':
/home/cbmdock/cbmroot/algo/detectors/bmon/Unpack.cxx:130:50: warning: '*((void*)& time +8)' may be used uninitialized in this function [-Wmaybe-uninitialized]
double messageTime = message.getMsgFullTimeD(time.currentEpochInTs) - elinkPar.fTimeOffset;
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/home/cbmdock/cbmroot/algo/detectors/bmon/Unpack.cxx:27:14: note: '*((void*)& time +8)' was declared here
TimeSpec time;
^~~~
The compiler complains that time.currentEpochInTs field may be used uninitialized. In fact, the code logic is correct because there is a check that ensures the first message is an epoch message. But it is too complicated for the compiler. I rewrote the code to read the first message explicitly as an epoch message. It makes the compiler happy.