Skip to content

warning fixes

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

Compiler warning fixes everywhere in the cbomroot.

I only fixed obvious warnings here, like the comparison of int with size_t.

I also fixed warnings that appear in MacOsX compilation during CI tests.

There are three places in the code that still produce warnings and need an expert look.

1. In the MVD hit producer, many important values are not initialized by the CbmMvdPixelCharge constructor:

/home/cbmdock/cbmroot/sim/detectors/mvd/CbmMvdPixelCharge.cxx: In constructor 'CbmMvdPixelCharge::CbmMvdPixelCharge(Float_t, Int_t, Int_t, Int_t, Int_t, Float_t, Float_t, Float_t, Int_t)':
/home/cbmdock/cbmroot/sim/detectors/mvd/CbmMvdPixelCharge.cxx:20:96: warning: unused parameter 'pointId' [-Wunused-parameter]
 CbmMvdPixelCharge::CbmMvdPixelCharge(Float_t charge, Int_t channelNrX, Int_t channelNrY, Int_t pointId, Int_t trackId,
                                                                                          ~~~~~~^~~~~~~
/home/cbmdock/cbmroot/sim/detectors/mvd/CbmMvdPixelCharge.cxx:20:111: warning: unused parameter 'trackId' [-Wunused-parameter]
 CbmMvdPixelCharge::CbmMvdPixelCharge(Float_t charge, Int_t channelNrX, Int_t channelNrY, Int_t pointId, Int_t trackId,
                                                                                                         ~~~~~~^~~~~~~
/home/cbmdock/cbmroot/sim/detectors/mvd/CbmMvdPixelCharge.cxx:21:46: warning: unused parameter 'pointPosX' [-Wunused-parameter]
                                      Float_t pointPosX, Float_t pointPosY, Float_t time, Int_t frame)
                                      ~~~~~~~~^~~~~~~~~
/home/cbmdock/cbmroot/sim/detectors/mvd/CbmMvdPixelCharge.cxx:21:65: warning: unused parameter 'pointPosY' [-Wunused-parameter]
                                      Float_t pointPosX, Float_t pointPosY, Float_t time, Int_t frame)
                                                         ~~~~~~~~^~~~~~~~~

2. In the rich unpacker, subSubEventSize and subSubEventId may be uninitialized. The logic there is quite complicated; I don't trust myself to touch the code.

/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 uninitialized in this function [-Wmaybe-uninitialized]

3. In the dielectron analysis, there are two ifs() with weird, always true, conditions:

analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx
[CTest: warning matched] /Users/fairroot/builds/computing/cbmroot/analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx:1474:35: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
          if (grandmotherId != -1 || grandmotherId == -1) {
[CTest: warning suppressed]               ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
[CTest: warning matched] /Users/fairroot/builds/computing/cbmroot/analysis/PWGDIL/dielectron/conversion/CbmAnaConversion.cxx:1468:26: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
      if (motherId != -1 || motherId == -1) {
[CTest: warning suppressed]           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
[CTest: warning suppressed] 2 warnings generated.
Edited by Sergey Gorbunov

Merge request reports