From a9c82db386d1254ffc707ae07b646ad0617c0244 Mon Sep 17 00:00:00 2001 From: "se.gorbunov" <se.gorbunov@gsi.de> Date: Mon, 23 Oct 2023 21:06:29 +0000 Subject: [PATCH] compiler warning fixes in unpackers --- algo/detectors/rich/Unpack.cxx | 39 ++++++++++++++++------------ algo/detectors/tof/HitFinder.cxx | 2 +- algo/detectors/tof/ReadoutConfig.cxx | 1 + algo/detectors/trd/Unpack.cxx | 2 +- reco/tasks/CbmTaskTofHitFinder.cxx | 2 +- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/algo/detectors/rich/Unpack.cxx b/algo/detectors/rich/Unpack.cxx index a66fb923c4..c3b5d5a10d 100644 --- a/algo/detectors/rich/Unpack.cxx +++ b/algo/detectors/rich/Unpack.cxx @@ -39,8 +39,8 @@ namespace cbm::algo::rich // -4*3 for 0xffffffff padding and 2 last words which contain microslice index if (reader.IsNextPadding() && reader.GetOffset() >= reader.GetSize() - 12) break; } - uint32_t msIndexWord1 = reader.NextWord(); - uint32_t msIndexWord2 = reader.NextWord(); + [[maybe_unused]] uint32_t msIndexWord1 = reader.NextWord(); + [[maybe_unused]] uint32_t msIndexWord2 = reader.NextWord(); return std::make_pair(std::move(ctx.digis), std::move(ctx.monitor)); } @@ -72,19 +72,20 @@ namespace cbm::algo::rich if (l > 1) ctx.prevLastCh0ReTime[l - 2] = fullTime; } - const uint32_t trbNum = reader.NextWord(); // TRB trigger number + [[maybe_unused]] const uint32_t trbNum = reader.NextWord(); // TRB trigger number //if (isLog()) L_(debug4) << getLogHeader(reader) << "TRB Num:" << reader.GetWordAsHexString(trbNum); } void Unpack::ProcessHubBlock(rich::MicrosliceReader& reader, MSContext& ctx) const { - uint32_t word = reader.NextWord(); - const uint32_t hubId = word & 0xffff; // 16 bits - const uint32_t hubSize = (word >> 16) & 0xffff; // 16 bits + uint32_t word = reader.NextWord(); + + [[maybe_unused]] const uint32_t hubId = word & 0xffff; // 16 bits + const uint32_t hubSize = (word >> 16) & 0xffff; // 16 bits - bool isLast = false; // if true then it is CTS sub-sub-event - size_t totalSize = 0; + bool isLast = false; // if true then it is CTS sub-sub-event + size_t totalSize = 0; ctx.currentSubSubEvent = 0; uint32_t subSubEventId, subSubEventSize; @@ -125,16 +126,20 @@ namespace cbm::algo::rich } } - int Unpack::ProcessCtsHeader(rich::MicrosliceReader& reader, uint32_t subSubEventSize, uint32_t subSubEventId) const + int Unpack::ProcessCtsHeader(rich::MicrosliceReader& reader, uint32_t subSubEventSize, + uint32_t /*subSubEventId*/) const { - const uint32_t word = reader.NextWord(); - const uint32_t ctsState = word & 0xffff; // 16 bits - const uint32_t nofInputs = (word >> 16) & 0xf; // 4 bits - const uint32_t nofTrigCh = (word >> 20) & 0x1f; // 5 bits - const uint32_t inclLastIdle = (word >> 25) & 0x1; // 1 bit - const uint32_t inclTrigInfo = (word >> 26) & 0x1; // 1 bit - const uint32_t inclTime = (word >> 27) & 0x1; // 1 bit - const uint32_t ETM = (word >> 28) & 0x3; // 2 bits + const uint32_t word = reader.NextWord(); + + [[maybe_unused]] const uint32_t ctsState = word & 0xffff; // 16 bits + + const uint32_t nofInputs = (word >> 16) & 0xf; // 4 bits + const uint32_t nofTrigCh = (word >> 20) & 0x1f; // 5 bits + const uint32_t inclLastIdle = (word >> 25) & 0x1; // 1 bit + const uint32_t inclTrigInfo = (word >> 26) & 0x1; // 1 bit + const uint32_t inclTime = (word >> 27) & 0x1; // 1 bit + const uint32_t ETM = (word >> 28) & 0x3; // 2 bits + uint32_t ctsInfoSize = 2 * nofInputs + 2 * nofTrigCh + 2 * inclLastIdle + 3 * inclTrigInfo + inclTime; // in words switch (ETM) { case 0: break; diff --git a/algo/detectors/tof/HitFinder.cxx b/algo/detectors/tof/HitFinder.cxx index a784900be8..caca727cca 100644 --- a/algo/detectors/tof/HitFinder.cxx +++ b/algo/detectors/tof/HitFinder.cxx @@ -41,7 +41,7 @@ namespace cbm::algo::tof //reset counter numSameSide = 0; - for (int32_t chan = 0; chan < fParams.fChanPar.size(); chan++) { + for (int32_t chan = 0; chan < (int32_t) fParams.fChanPar.size(); chan++) { std::vector<CbmTofDigi*>& storDigiExp = digisExp[chan]; std::vector<int32_t>& storDigiInd = digisInd[chan]; diff --git a/algo/detectors/tof/ReadoutConfig.cxx b/algo/detectors/tof/ReadoutConfig.cxx index d519b7d547..012aadd654 100644 --- a/algo/detectors/tof/ReadoutConfig.cxx +++ b/algo/detectors/tof/ReadoutConfig.cxx @@ -412,6 +412,7 @@ namespace cbm::algo::tof } } } + [[fallthrough]]; // fall through is intended case 7: { // clang-format off const int32_t iChMap[160]={ diff --git a/algo/detectors/trd/Unpack.cxx b/algo/detectors/trd/Unpack.cxx index 3e7667371e..0d4bbf46a8 100644 --- a/algo/detectors/trd/Unpack.cxx +++ b/algo/detectors/trd/Unpack.cxx @@ -226,7 +226,7 @@ namespace cbm::algo::trd { /// Save info message if needed. //if (fOptOutBVec) { fOptOutBVec->emplace_back(std::make_pair(ctx.fLastFulltime, frame)); } - Spadic::MsInfoType infotype = getInfoType(frame); + [[maybe_unused]] Spadic::MsInfoType infotype = getInfoType(frame); // "Spadic_Info_Types"; } diff --git a/reco/tasks/CbmTaskTofHitFinder.cxx b/reco/tasks/CbmTaskTofHitFinder.cxx index 722c88e678..5015088a31 100644 --- a/reco/tasks/CbmTaskTofHitFinder.cxx +++ b/reco/tasks/CbmTaskTofHitFinder.cxx @@ -50,7 +50,7 @@ using cbm::algo::tof::Cluster; using cbm::algo::tof::HitFinderRpcPar; const int32_t numClWalkBinX = 20; -const double TTotMean = 2.E4; +// const double TTotMean = 2.E4; /************************************************************************************/ CbmTaskTofHitFinder::CbmTaskTofHitFinder() : FairTask("CbmTaskTofHitFinder"), fGeoHandler(new CbmTofGeoHandler()) {} -- GitLab