From e939afdf1084974ef2012064105b5db0edf0991b Mon Sep 17 00:00:00 2001 From: Pascal Raisig <praisig@ikf.uni-frankfurt.de> Date: Wed, 21 Jul 2021 16:36:08 +0200 Subject: [PATCH] Silence llu to lu conversion warnings on macos --- fles/mcbm2018/unpacker/CbmCriGet4RawPrint.cxx | 4 +++- reco/detectors/psd/unpack/CbmPsdUnpackAlgo.cxx | 3 ++- reco/detectors/tof/unpack/CbmTofUnpackAlgo.cxx | 12 ++++++++---- reco/detectors/trd/unpack/CbmTrdUnpackAlgoFasp2D.cxx | 3 ++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/fles/mcbm2018/unpacker/CbmCriGet4RawPrint.cxx b/fles/mcbm2018/unpacker/CbmCriGet4RawPrint.cxx index fd0713209b..7559369555 100644 --- a/fles/mcbm2018/unpacker/CbmCriGet4RawPrint.cxx +++ b/fles/mcbm2018/unpacker/CbmCriGet4RawPrint.cxx @@ -181,9 +181,11 @@ Bool_t CbmCriGet4RawPrint::DoUnpack(const fles::Timeslice& ts, size_t /*componen procEpochUntilError++; if (lastGlobalEpoch != 0xFFFFFF) { if ((lastGlobalEpoch + 1) != epoch) { + // Cast required to silence a warning on macos (there a uint64_t is a llu) snprintf(buf, sizeof(buf), "Error global epoch, last epoch, current epoch, diff 0x%06x 0x%06x %d 0x%016lx %d", - lastGlobalEpoch, epoch, lastGlobalEpoch - epoch, ulData, procEpochUntilError); + lastGlobalEpoch, epoch, lastGlobalEpoch - epoch, static_cast<size_t>(ulData), + procEpochUntilError); std::cout << buf << std::endl; procEpochUntilError = 0; diff --git a/reco/detectors/psd/unpack/CbmPsdUnpackAlgo.cxx b/reco/detectors/psd/unpack/CbmPsdUnpackAlgo.cxx index 33e42e95f8..360c18ccfa 100644 --- a/reco/detectors/psd/unpack/CbmPsdUnpackAlgo.cxx +++ b/reco/detectors/psd/unpack/CbmPsdUnpackAlgo.cxx @@ -195,7 +195,8 @@ bool CbmPsdUnpackAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp, UI while (PsdReader.GetTotalGbtWordsRead() < uNbMessages) { int ReadResult = PsdReader.ReadMs(); if (fair::Logger::Logging(fair::Severity::debug)) { - printf("\nMicroslice idx: %lu\n", mstime); + // Cast requires to silence a warning on macos, there a uint64_t is a long long unsigned + printf("\nMicroslice idx: %lu\n", static_cast<size_t>(mstime)); PsdReader.PrintOut(); /*PsdReader.PrintSaveBuff();*/ } if (ReadResult == 0) { diff --git a/reco/detectors/tof/unpack/CbmTofUnpackAlgo.cxx b/reco/detectors/tof/unpack/CbmTofUnpackAlgo.cxx index 26f9726a85..7014a1990f 100644 --- a/reco/detectors/tof/unpack/CbmTofUnpackAlgo.cxx +++ b/reco/detectors/tof/unpack/CbmTofUnpackAlgo.cxx @@ -299,11 +299,12 @@ void CbmTofUnpackAlgo::ProcessEpoch(const critof001::Message& mess, uint32_t uMe } if (ulEpochNr != ulMsStartInEpoch) { + // size_t required to silence a warning on macos (there a uint64_t is a llu) LOG(error) << fName << "::ProcessEpoch => Error first global epoch, " << Form( "from MS index 0x%06lx, current 0x%06llx, diff %lld, raw 0x%016lx, NoErr %d, current 0x%06lx %f", ulMsStartInEpoch, ulEpochNr, ulEpochNr - ulMsStartInEpoch, mess.getData(), fuProcEpochUntilError, - static_cast<uint64_t>(fulCurrentMsIdx / critof001::kuEpochInNs), + static_cast<size_t>(fulCurrentMsIdx / critof001::kuEpochInNs), fulCurrentMsIdx / critof001::kuEpochInNs); LOG(error) << fName << "::ProcessEpoch => Ignoring data until next valid epoch"; @@ -317,9 +318,10 @@ void CbmTofUnpackAlgo::ProcessEpoch(const critof001::Message& mess, uint32_t uMe } // else of if( ulEpochNr != ulMsStartInEpoch ) } // if( 0 < uMesgIdx ) else if (((fulCurrentEpoch + 1) % critof001::kulEpochCycleEp) != ulEpochNr) { + // Cast required to silence a warning on macos (there a uint64_t is a llu) LOG(error) << fName << "::ProcessEpoch => Error global epoch, " << Form("last 0x%06llx, current 0x%06llx, diff %lld, raw 0x%016lx, NoErr %d", fulCurrentEpoch, ulEpochNr, - ulEpochNr - fulCurrentEpoch, mess.getData(), fuProcEpochUntilError); + ulEpochNr - fulCurrentEpoch, static_cast<size_t>(mess.getData()), fuProcEpochUntilError); LOG(error) << fName << "::ProcessEpoch => Ignoring data until next valid epoch"; ulEpochNr = (fulCurrentEpoch + 1) % critof001::kulEpochCycleEp; @@ -337,10 +339,12 @@ void CbmTofUnpackAlgo::ProcessEpoch(const critof001::Message& mess, uint32_t uMe fulEpochIndexInTs = ulEpochNr + critof001::kulEpochCycleEp - fulTsStartInEpoch; } if (10e9 < critof001::kuEpochInNs * fulEpochIndexInTs) + // Cast required to silence a warning on macos (there a uint64_t is a llu) LOG(debug) << fName << "::ProcessEpoch => " << Form("Raw Epoch: 0x%06llx, Epoch offset 0x%06lx, Epoch in Ts: 0x%07lx, time %f ns (%f * %lu)", - ulEpochNr, fulTsStartInEpoch, fulEpochIndexInTs, critof001::kuEpochInNs * fulEpochIndexInTs, - critof001::kuEpochInNs, fulEpochIndexInTs); + ulEpochNr, fulTsStartInEpoch, static_cast<size_t>(fulEpochIndexInTs), + critof001::kuEpochInNs * fulEpochIndexInTs, critof001::kuEpochInNs, + static_cast<size_t>(fulEpochIndexInTs)); } void CbmTofUnpackAlgo::ProcessHit(const critof001::Message& mess) diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackAlgoFasp2D.cxx b/reco/detectors/trd/unpack/CbmTrdUnpackAlgoFasp2D.cxx index cf1772e291..b093b7ef64 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackAlgoFasp2D.cxx +++ b/reco/detectors/trd/unpack/CbmTrdUnpackAlgoFasp2D.cxx @@ -146,7 +146,8 @@ bool CbmTrdUnpackAlgoFasp2D::unpack(const fles::Timeslice* ts, std::uint16_t ico //Double_t fdMsSizeInNs = 1.28e6; auto msdesc = ts->descriptor(icomp, imslice); - if (VERBOSE) printf("time start %lu\n", msdesc.idx); + // Cast required to silence a warning on macos (there a uint64_t is a llu) + if (VERBOSE) printf("time start %lu\n", static_cast<size_t>(msdesc.idx)); // define time wrt start of time slice in TRD/FASP clks [80 MHz] fTime[0] = ULong64_t((msdesc.idx - fTsStartTime) / 12.5); -- GitLab