Skip to content

compiler warning fixes in unpackers & hitfinders

Sergey Gorbunov requested to merge se.gorbunov/cbmroot:warnDominic into master

compiler warning fixes in unpackers & hitfinders.

@d.smith, I made you a reviewer because your name is in the author list.

@d.smith ,

In addition, there also a warning in the rich unpacker: subSubEventSize and subSubEventId may be uninitialized:

/home/cbmdock/cbmroot/algo/detectors/rich/Unpack.cxx: In member function 'void cbm::algo::rich::Unpack::ProcessHubBlock(cbm::algo::rich::MicrosliceReader&, cbm::algo::rich::Unpack::MSContext&) const':
/home/cbmdock/cbmroot/algo/detectors/rich/Unpack.cxx:113:39: warning: 'subSubEventSize' may be used uninitialized in this function [-Wmaybe-uninitialized]
     subSubEventSize = ProcessCtsHeader(reader, subSubEventSize, subSubEventId);
                       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/cbmdock/cbmroot/algo/detectors/rich/Unpack.cxx:113:39: warning: 'subSubEventId' may be used uninitiali

I assume one should replace these lines:

 //last event ist expected to be CTS
    if (totalSize != hubSize || !isLast) { ctx.monitor.fNumErrInvalidHubSize++; }
    subSubEventSize = ProcessCtsHeader(reader, subSubEventSize, subSubEventId);
    ProcessSubSubEvent(reader, subSubEventSize, subSubEventId, ctx);

with:

 //last event ist expected to be CTS
    if (totalSize != hubSize || !isLast) { ctx.monitor.fNumErrInvalidHubSize++; }
    else{
     subSubEventSize = ProcessCtsHeader(reader, subSubEventSize, subSubEventId);
     ProcessSubSubEvent(reader, subSubEventSize, subSubEventId, ctx);
    }

or even:

 //last event ist expected to be CTS
    if (totalSize != hubSize || !isLast) { ctx.monitor.fNumErrInvalidHubSize++; }
    else{ return;}

But I don't trust myself to touch the unpacked code. Please have a look.

Edited by Sergey Gorbunov

Merge request reports