Skip to content

Commit

Permalink
Fix warnings when warnings are enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Aug 26, 2024
1 parent 8378698 commit e5bd022
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion k4FWCore/components/IOSvc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ std::tuple<std::vector<std::shared_ptr<podio::CollectionBase>>, std::vector<std:
{
std::scoped_lock<std::mutex> lock(m_changeBufferLock);
if (m_nextEntry < m_entries) {
frame = podio::Frame(std::move(m_reader->readEntry(podio::Category::Event, m_nextEntry)));
frame = podio::Frame(m_reader->readEntry(podio::Category::Event, m_nextEntry));
} else {
return std::make_tuple(std::vector<std::shared_ptr<podio::CollectionBase>>(), std::vector<std::string>(),
std::move(frame));
Expand Down
2 changes: 1 addition & 1 deletion k4FWCore/components/Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CollectionPusher : public Gaudi::Functional::details::BaseClass_t<Gaudi::F
m_inputCollections{this,
"InputCollections",
{"Event"},
[this](Gaudi::Details::PropertyBase& b) {
[this](Gaudi::Details::PropertyBase&) {
const std::string cmd = System::cmdLineArgs()[0];
if (cmd.find("genconf") != std::string::npos) {
return;
Expand Down
1 change: 0 additions & 1 deletion k4FWCore/components/Writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ class Writer final : public Gaudi::Functional::Consumer<void(const EventContext&
// continue;
// }
m_availableCollections.insert(pReg->name().substr(1, pReg->name().size() - 1));
const std::string& id = pReg->identifier();
}
}

Expand Down
4 changes: 2 additions & 2 deletions k4FWCore/include/k4FWCore/Consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace k4FWCore {
* @param i The index of the input
* @return A range of the input locations
*/
const auto inputLocations(int i) const {
auto inputLocations(unsigned i) const {
if (i >= sizeof...(In)) {
throw std::out_of_range("Called inputLocations with an index out of range, index: " + std::to_string(i) +
", number of inputs: " + std::to_string(sizeof...(In)));
Expand All @@ -110,7 +110,7 @@ namespace k4FWCore {
* @param name The name of the input
* @return A range of the input locations
*/
const auto inputLocations(std::string_view name) const {
auto inputLocations(std::string_view name) const {
auto it = std::ranges::find_if(m_inputLocations, [&name](const auto& prop) { return prop.name() == name; });
if (it == m_inputLocations.end()) {
throw std::runtime_error("Called inputLocations with an unknown name");
Expand Down
12 changes: 6 additions & 6 deletions k4FWCore/include/k4FWCore/Transformer.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ namespace k4FWCore {
* @param i The index of the input
* @return A range of the input locations
*/
auto inputLocations(int i) const {
auto inputLocations(unsigned i) const {
if (i >= sizeof...(In)) {
throw std::out_of_range("Called inputLocations with an index out of range, index: " + std::to_string(i) +
", number of inputs: " + std::to_string(sizeof...(In)));
Expand All @@ -143,7 +143,7 @@ namespace k4FWCore {
* @param name The name of the input
* @return A range of the input locations
*/
const auto inputLocations(std::string_view name) const {
auto inputLocations(std::string_view name) const {
auto it = std::ranges::find_if(m_inputLocations, [&name](const auto& prop) { return prop.name() == name; });
if (it == m_inputLocations.end()) {
throw std::runtime_error("Called inputLocations with an unknown name");
Expand All @@ -164,7 +164,7 @@ namespace k4FWCore {
* @param name The name of the output
* @return A range of the output locations
*/
const auto outputLocations(std::string_view name) const {
auto outputLocations(std::string_view name) const {
if (name != m_outputLocations.name()) {
throw std::runtime_error("Called outputLocations with an unknown name");
}
Expand Down Expand Up @@ -261,7 +261,7 @@ namespace k4FWCore {
* @param i The index of the input
* @return A range of the input locations
*/
const auto inputLocations(int i) const {
auto inputLocations(int i) const {
if (i >= sizeof...(In)) {
throw std::out_of_range("Called inputLocations with an index out of range, index: " + std::to_string(i) +
", number of inputs: " + std::to_string(sizeof...(In)));
Expand All @@ -273,7 +273,7 @@ namespace k4FWCore {
* @param name The name of the input
* @return A range of the input locations
*/
const auto inputLocations(std::string_view name) const {
auto inputLocations(std::string_view name) const {
auto it = std::ranges::find_if(m_inputLocations, [&name](const auto& prop) { return prop.name() == name; });
if (it == m_inputLocations.end()) {
throw std::runtime_error("Called inputLocations with an unknown name");
Expand All @@ -298,7 +298,7 @@ namespace k4FWCore {
* @param name The name of the output
* @return A range of the output locations
*/
const auto outputLocations(std::string_view name) const {
auto outputLocations(std::string_view name) const {
auto it = std::ranges::find_if(m_outputLocations.begin(), m_outputLocations.end(),
[&name](const auto& prop) { return prop.name() == name; });
if (it == m_outputLocations.end()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ struct ExampleEventHeaderConsumer final : k4FWCore::Consumer<void(const edm4hep:
}
}

Gaudi::Property<int> m_runNumber{this, "runNumber", 0, "The expected run number"};
Gaudi::Property<int> m_eventNumberOffset{this, "eventNumberOffset", 0,
Gaudi::Property<int> m_runNumber{this, "runNumber", 0, "The expected run number"};
Gaudi::Property<int> m_eventNumberOffset{this, "eventNumberOffset", 0,
"The event number offset where events will start counting from"};
mutable std::atomic<unsigned> m_evtCounter{0};
mutable std::atomic<std::int32_t> m_evtCounter{0};
};

DECLARE_COMPONENT(ExampleEventHeaderConsumer)
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ struct ExampleFunctionalConsumerRuntimeCollectionsMultiple final
void operator()(const std::vector<const edm4hep::MCParticleCollection*>& particleVec,
const std::vector<const edm4hep::TrackCollection*>& trackVec,
const edm4hep::SimTrackerHitCollection& simTrackerHits) const override {
// Silence warning about unused variable
(void)simTrackerHits;
info() << "Received " << particleVec.size() << " particle collections and " << trackVec.size()
<< " track collections" << endmsg;
if (particleVec.size() != 5) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct ExampleFunctionalFilter final : k4FWCore::FilterPredicate<bool(const edm4
// This is the function that will be called to check if the event passes
// Note that the function has to be const, as well as the collections
// we get from the input
bool operator()(const edm4hep::MCParticleCollection& input) const override {
bool operator()(const edm4hep::MCParticleCollection&) const override {
++m_counter;
// Only pass for half of the events
bool condition = m_counter.sum() % 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct ExampleFunctionalMetadataConsumer final : k4FWCore::Consumer<void(const e
void operator()(const edm4hep::MCParticleCollection& input) const override {
// Check that it's possible to get metadata parameters from the main loop
auto particleNum = k4FWCore::getParameter<int>("NumberOfParticles", this).value_or(-1);
if (input.size() != particleNum) {
if (input.size() != (size_t)particleNum) {
error() << "Input MCParticleCollection size is not " << particleNum << endmsg;
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct ExampleFunctionalTransformerRuntimeCollections final
std::vector<edm4hep::MCParticleCollection> operator()(
const std::vector<const edm4hep::MCParticleCollection*>& input) const override {
std::vector<edm4hep::MCParticleCollection> outputCollections;
for (int i = 0; i < input.size(); ++i) {
for (size_t i = 0; i < input.size(); ++i) {
std::string name = "NewMCParticles" + std::to_string(i);
auto& old_coll = input.at(i);
auto coll = edm4hep::MCParticleCollection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct ExampleFunctionalTransformerRuntimeEmpty final

// This is the function that will be called to produce the data
std::vector<edm4hep::MCParticleCollection> operator()(
const std::vector<const edm4hep::MCParticleCollection*>& input) const override {
const std::vector<const edm4hep::MCParticleCollection*>&) const override {
// Return an empty vector to make sure that also works
std::vector<edm4hep::MCParticleCollection> outputCollections;
return outputCollections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ StatusCode k4FWCoreTest_cellID_reader::initialize() {

StatusCode k4FWCoreTest_cellID_reader::execute(const EventContext&) const {
const auto simtrackerhits_coll = m_simTrackerHitReaderHandle.get();
// Silence warning because we don't use simtrackerhits_coll
(void)simtrackerhits_coll;

const auto cellIDstr = m_cellIDHandle.get();

Expand Down

0 comments on commit e5bd022

Please sign in to comment.