Skip to content
Snippets Groups Projects

compiler warning fixes in unpackers & hitfinders

Merged 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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Sergey Gorbunov resolved all threads

    resolved all threads

  • Sergey Gorbunov
  • Sergey Gorbunov resolved all threads

    resolved all threads

  • Sergey Gorbunov added 2 commits

    added 2 commits

    • 96b18db2 - 1 commit from branch computing:master
    • d7efc709 - compiler warning fixes in unpackers

    Compare with previous version

  • Dear @f.uhlig, @v.friese, @p.-a.loizeau, @s.lebedev,

    you have been identified as code owner of at least one file which was changed with this merge request.

    Please check the changes and approve them or request changes.

  • Sergey Gorbunov changed the description

    changed the description

  • @se.gorbunov Some of the variables are indeed unused, as they were used for monitoring in the original code, but full monitoring is not implemented here. The reader.NextWord() are necessary, as they change the state of reader by moving it one word forward. The return value is indeed not always used, as some words are padding. If we remove the variable assignments, then perhaps there will be a compiler warning that the return value is ignored.

    I will comment on the proposed changes individually.

  • Dominik Smith
  • Dominik Smith
  • Dominik Smith
  • Dominik Smith
  • Dominik Smith
  • Dominik Smith
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading