From ae3807591ebca88e737a049f5371b012cb651e3e Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 12 Dec 2017 09:36:49 -0600 Subject: [PATCH] Fix clang warnings about unneeded lambda captures Removed unused variables captured in a lambda expression. These were caught by a clang warning. --- FWCore/Concurrency/test/limitedtaskqueue_t.cppunit.cpp | 10 +++++----- FWCore/Concurrency/test/serialtaskqueue_t.cppunit.cpp | 8 ++++---- .../test/serialtaskqueuechain_t.cppunit.cpp | 4 ++-- FWCore/Framework/src/ProductResolvers.cc | 2 +- FWCore/Framework/src/StreamSchedule.cc | 2 +- FWCore/Framework/src/StreamSchedule.h | 2 +- FWCore/Framework/src/SubProcess.cc | 2 +- FWCore/Framework/test/global_module_t.cppunit.cc | 4 ++-- FWCore/Framework/test/global_outputmodule_t.cppunit.cc | 4 ++-- FWCore/Framework/test/limited_module_t.cppunit.cc | 4 ++-- .../Framework/test/limited_outputmodule_t.cppunit.cc | 4 ++-- FWCore/Framework/test/one_outputmodule_t.cppunit.cc | 4 ++-- FWCore/Framework/test/stream_module_t.cppunit.cc | 4 ++-- FWCore/ROOTTests/test/tclass_methods_threaded_t.cc | 2 +- FWCore/ROOTTests/test/tformula_threaded_t.cc | 2 +- FWCore/ROOTTests/test/tprofile_threaded_t.cc | 2 +- FWCore/Services/plugins/InitRootHandlers.cc | 2 +- 17 files changed, 31 insertions(+), 31 deletions(-) diff --git a/FWCore/Concurrency/test/limitedtaskqueue_t.cppunit.cpp b/FWCore/Concurrency/test/limitedtaskqueue_t.cppunit.cpp index 7c74abcbab0d7..84d4af4b86ab8 100644 --- a/FWCore/Concurrency/test/limitedtaskqueue_t.cppunit.cpp +++ b/FWCore/Concurrency/test/limitedtaskqueue_t.cppunit.cpp @@ -191,7 +191,7 @@ void LimitedTaskQueue_test::testPause() edm::LimitedTaskQueue::Resumer resumer; std::atomic resumerSet{false}; std::exception_ptr e1; - queue.pushAndPause([&resumer,&resumerSet,&count,&queue,pWaitTask,&e1](edm::LimitedTaskQueue::Resumer iResumer){ + queue.pushAndPause([&resumer,&resumerSet,&count,pWaitTask,&e1](edm::LimitedTaskQueue::Resumer iResumer){ resumer = std::move(iResumer); resumerSet = true; try { @@ -203,7 +203,7 @@ void LimitedTaskQueue_test::testPause() }); std::exception_ptr e2; - queue.push([&count,&queue,pWaitTask,&e2]{ + queue.push([&count,pWaitTask,&e2]{ try{ CPPUNIT_ASSERT(++count == 2); } catch(...) { @@ -213,7 +213,7 @@ void LimitedTaskQueue_test::testPause() }); std::exception_ptr e3; - queue.push([&count,&queue,pWaitTask,&e3]{ + queue.push([&count,pWaitTask,&e3]{ try { CPPUNIT_ASSERT(++count == 3); }catch(...){ @@ -260,7 +260,7 @@ void LimitedTaskQueue_test::stressTest() iTask->decrement_ref_count();}}; for(unsigned int i = 0; iincrement_ref_count(); - queue.push([i,&count,pWaitTask,&nRunningTasks] { + queue.push([&count,pWaitTask,&nRunningTasks] { std::shared_ptr guard{pWaitTask,[](tbb::task*iTask) { iTask->decrement_ref_count();}}; auto nrt = nRunningTasks++; @@ -278,7 +278,7 @@ void LimitedTaskQueue_test::stressTest() waitToStart=false; for(unsigned int i=0; iincrement_ref_count(); - queue.push([i,&count,pWaitTask,&nRunningTasks] { + queue.push([&count,pWaitTask,&nRunningTasks] { std::shared_ptr guard{pWaitTask,[](tbb::task*iTask) { iTask->decrement_ref_count();}}; auto nrt = nRunningTasks++; diff --git a/FWCore/Concurrency/test/serialtaskqueue_t.cppunit.cpp b/FWCore/Concurrency/test/serialtaskqueue_t.cppunit.cpp index 5d6302de77a8f..a73a6186c6119 100644 --- a/FWCore/Concurrency/test/serialtaskqueue_t.cppunit.cpp +++ b/FWCore/Concurrency/test/serialtaskqueue_t.cppunit.cpp @@ -129,11 +129,11 @@ void SerialTaskQueue_test::testPause() CPPUNIT_ASSERT(count++ == 1); pWaitTask->decrement_ref_count(); }); - queue.push([&count,&queue,pWaitTask]{ + queue.push([&count,pWaitTask]{ CPPUNIT_ASSERT(count++ == 2); pWaitTask->decrement_ref_count(); }); - queue.push([&count,&queue,pWaitTask]{ + queue.push([&count,pWaitTask]{ CPPUNIT_ASSERT(count++ == 3); pWaitTask->decrement_ref_count(); }); @@ -169,7 +169,7 @@ void SerialTaskQueue_test::stressTest() while(waitToStart.load()) {__sync_synchronize();}; for(unsigned int i = 0; iincrement_ref_count(); - queue.push([i,&count,pWaitTask] { + queue.push([&count,pWaitTask] { ++count; pWaitTask->decrement_ref_count(); }); @@ -182,7 +182,7 @@ void SerialTaskQueue_test::stressTest() waitToStart=false; for(unsigned int i=0; iincrement_ref_count(); - queue.push([i,&count,pWaitTask] { + queue.push([&count,pWaitTask] { ++count; pWaitTask->decrement_ref_count(); }); diff --git a/FWCore/Concurrency/test/serialtaskqueuechain_t.cppunit.cpp b/FWCore/Concurrency/test/serialtaskqueuechain_t.cppunit.cpp index eeb01f96944d1..4bf146b6be468 100644 --- a/FWCore/Concurrency/test/serialtaskqueuechain_t.cppunit.cpp +++ b/FWCore/Concurrency/test/serialtaskqueuechain_t.cppunit.cpp @@ -197,7 +197,7 @@ void SerialTaskQueueChain_test::stressTest() while(waitToStart.load()) {}; for(unsigned int i = 0; iincrement_ref_count(); - chain.push([i,&count,pWaitTask] { + chain.push([&count,pWaitTask] { ++count; pWaitTask->decrement_ref_count(); }); @@ -209,7 +209,7 @@ void SerialTaskQueueChain_test::stressTest() waitToStart=false; for(unsigned int i=0; iincrement_ref_count(); - chain.push([i,&count,pWaitTask] { + chain.push([&count,pWaitTask] { ++count; pWaitTask->decrement_ref_count(); }); diff --git a/FWCore/Framework/src/ProductResolvers.cc b/FWCore/Framework/src/ProductResolvers.cc index 604663dea9a19..d14367ce7492c 100644 --- a/FWCore/Framework/src/ProductResolvers.cc +++ b/FWCore/Framework/src/ProductResolvers.cc @@ -374,7 +374,7 @@ namespace edm { //Have to create a new task which will make sure the state for UnscheduledProductResolver // is properly set after the module has run auto t = make_waiting_task(tbb::task::allocate_root(), - [this,&principal, skipCurrentProcess,sra,mcc](std::exception_ptr const* iPtr) + [this](std::exception_ptr const* iPtr) { //The exception is being rethrown because resolveProductImpl sets the ProductResolver to a failed // state for the case where an exception occurs during the call to the function. diff --git a/FWCore/Framework/src/StreamSchedule.cc b/FWCore/Framework/src/StreamSchedule.cc index a8f8604c9badb..6fb2245fe8325 100644 --- a/FWCore/Framework/src/StreamSchedule.cc +++ b/FWCore/Framework/src/StreamSchedule.cc @@ -266,7 +266,7 @@ namespace edm { unsigned int nUniqueBranchesToDelete=branchToReadingWorker.size(); //talk with output modules first - modReg.forAllModuleHolders([this, &branchToReadingWorker,&nUniqueBranchesToDelete](maker::ModuleHolder* iHolder){ + modReg.forAllModuleHolders([&branchToReadingWorker,&nUniqueBranchesToDelete](maker::ModuleHolder* iHolder){ auto comm = iHolder->createOutputModuleCommunicator(); if (comm) { if(!branchToReadingWorker.empty()) { diff --git a/FWCore/Framework/src/StreamSchedule.h b/FWCore/Framework/src/StreamSchedule.h index 7f1bbdace20e1..4cf4810caf946 100644 --- a/FWCore/Framework/src/StreamSchedule.h +++ b/FWCore/Framework/src/StreamSchedule.h @@ -426,7 +426,7 @@ namespace edm { }); - auto task = make_functor_task(tbb::task::allocate_root(), [this,doneTask,&ep,&es,cleaningUpAfterException,token] () mutable { + auto task = make_functor_task(tbb::task::allocate_root(), [this,doneTask,&ep,&es,token] () mutable { ServiceRegistry::Operate op(token); T::preScheduleSignal(actReg_.get(), &streamContext_); WaitingTaskHolder h(doneTask); diff --git a/FWCore/Framework/src/SubProcess.cc b/FWCore/Framework/src/SubProcess.cc index 9f93b205cd617..83dbd5941f56b 100644 --- a/FWCore/Framework/src/SubProcess.cc +++ b/FWCore/Framework/src/SubProcess.cc @@ -374,7 +374,7 @@ namespace edm { propagateProducts(InEvent, principal, ep); WaitingTaskHolder finalizeEventTask( make_waiting_task(tbb::task::allocate_root(), - [this,&ep,iHolder](std::exception_ptr const* iPtr) mutable + [&ep,iHolder](std::exception_ptr const* iPtr) mutable { ep.clearEventPrincipal(); if(iPtr) { diff --git a/FWCore/Framework/test/global_module_t.cppunit.cc b/FWCore/Framework/test/global_module_t.cppunit.cc index 7951c63d590a3..4ba1a111707f7 100644 --- a/FWCore/Framework/test/global_module_t.cppunit.cc +++ b/FWCore/Framework/test/global_module_t.cppunit.cc @@ -373,7 +373,7 @@ m_ep() //For each transition, bind a lambda which will call the proper method of the Worker - m_transToFunc[Trans::kBeginStream] = [this](edm::Worker* iBase) { + m_transToFunc[Trans::kBeginStream] = [](edm::Worker* iBase) { edm::StreamContext streamContext(s_streamID0, nullptr); iBase->beginStream(s_streamID0, streamContext); }; @@ -421,7 +421,7 @@ m_ep() edm::ParentContext nullParentContext; iBase->doWork(*m_rp,*m_es, s_streamID0, nullParentContext, nullptr); }; - m_transToFunc[Trans::kEndStream] = [this](edm::Worker* iBase) { + m_transToFunc[Trans::kEndStream] = [](edm::Worker* iBase) { edm::StreamContext streamContext(s_streamID0, nullptr); iBase->endStream(s_streamID0, streamContext); }; diff --git a/FWCore/Framework/test/global_outputmodule_t.cppunit.cc b/FWCore/Framework/test/global_outputmodule_t.cppunit.cc index b908b9e7d483e..4c992238dc700 100644 --- a/FWCore/Framework/test/global_outputmodule_t.cppunit.cc +++ b/FWCore/Framework/test/global_outputmodule_t.cppunit.cc @@ -188,7 +188,7 @@ m_ep() m_actReg.reset(new edm::ActivityRegistry); //For each transition, bind a lambda which will call the proper method of the Worker - m_transToFunc[Trans::kGlobalOpenInputFile] = [this](edm::Worker* iBase, edm::OutputModuleCommunicator*) { + m_transToFunc[Trans::kGlobalOpenInputFile] = [](edm::Worker* iBase, edm::OutputModuleCommunicator*) { edm::FileBlock fb; iBase->respondToOpenInputFile(fb); }; @@ -225,7 +225,7 @@ m_ep() iComm->writeRun(*m_rp, nullptr); }; - m_transToFunc[Trans::kGlobalCloseInputFile] = [this](edm::Worker* iBase, edm::OutputModuleCommunicator*) { + m_transToFunc[Trans::kGlobalCloseInputFile] = [](edm::Worker* iBase, edm::OutputModuleCommunicator*) { edm::FileBlock fb; iBase->respondToCloseInputFile(fb); }; diff --git a/FWCore/Framework/test/limited_module_t.cppunit.cc b/FWCore/Framework/test/limited_module_t.cppunit.cc index 987fcaab49152..9c3e0fc0e3cdf 100644 --- a/FWCore/Framework/test/limited_module_t.cppunit.cc +++ b/FWCore/Framework/test/limited_module_t.cppunit.cc @@ -400,7 +400,7 @@ m_ep() //For each transition, bind a lambda which will call the proper method of the Worker - m_transToFunc[Trans::kBeginStream] = [this](edm::Worker* iBase) { + m_transToFunc[Trans::kBeginStream] = [](edm::Worker* iBase) { edm::StreamContext streamContext(s_streamID0, nullptr); iBase->beginStream(s_streamID0, streamContext); }; @@ -448,7 +448,7 @@ m_ep() edm::ParentContext nullParentContext; iBase->doWork(*m_rp,*m_es, s_streamID0, nullParentContext, nullptr); }; - m_transToFunc[Trans::kEndStream] = [this](edm::Worker* iBase) { + m_transToFunc[Trans::kEndStream] = [](edm::Worker* iBase) { edm::StreamContext streamContext(s_streamID0, nullptr); iBase->endStream(s_streamID0, streamContext); }; diff --git a/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc b/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc index c73e10f388c06..fbb8df7778e8e 100644 --- a/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc +++ b/FWCore/Framework/test/limited_outputmodule_t.cppunit.cc @@ -188,7 +188,7 @@ m_ep() m_actReg.reset(new edm::ActivityRegistry); //For each transition, bind a lambda which will call the proper method of the Worker - m_transToFunc[Trans::kGlobalOpenInputFile] = [this](edm::Worker* iBase, edm::OutputModuleCommunicator*) { + m_transToFunc[Trans::kGlobalOpenInputFile] = [](edm::Worker* iBase, edm::OutputModuleCommunicator*) { edm::FileBlock fb; iBase->respondToOpenInputFile(fb); }; @@ -225,7 +225,7 @@ m_ep() iComm->writeRun(*m_rp, nullptr); }; - m_transToFunc[Trans::kGlobalCloseInputFile] = [this](edm::Worker* iBase, edm::OutputModuleCommunicator*) { + m_transToFunc[Trans::kGlobalCloseInputFile] = [](edm::Worker* iBase, edm::OutputModuleCommunicator*) { edm::FileBlock fb; iBase->respondToCloseInputFile(fb); }; diff --git a/FWCore/Framework/test/one_outputmodule_t.cppunit.cc b/FWCore/Framework/test/one_outputmodule_t.cppunit.cc index 041f82346e0e8..901ccfadc8cb7 100644 --- a/FWCore/Framework/test/one_outputmodule_t.cppunit.cc +++ b/FWCore/Framework/test/one_outputmodule_t.cppunit.cc @@ -266,7 +266,7 @@ m_ep() m_actReg.reset(new edm::ActivityRegistry); //For each transition, bind a lambda which will call the proper method of the Worker - m_transToFunc[Trans::kGlobalOpenInputFile] = [this](edm::Worker* iBase, edm::OutputModuleCommunicator*) { + m_transToFunc[Trans::kGlobalOpenInputFile] = [](edm::Worker* iBase, edm::OutputModuleCommunicator*) { edm::FileBlock fb; iBase->respondToOpenInputFile(fb); }; @@ -303,7 +303,7 @@ m_ep() iComm->writeRun(*m_rp, nullptr); }; - m_transToFunc[Trans::kGlobalCloseInputFile] = [this](edm::Worker* iBase, edm::OutputModuleCommunicator*) { + m_transToFunc[Trans::kGlobalCloseInputFile] = [](edm::Worker* iBase, edm::OutputModuleCommunicator*) { edm::FileBlock fb; iBase->respondToCloseInputFile(fb); }; diff --git a/FWCore/Framework/test/stream_module_t.cppunit.cc b/FWCore/Framework/test/stream_module_t.cppunit.cc index 75c3e0dc876cd..47ecc7ed02617 100644 --- a/FWCore/Framework/test/stream_module_t.cppunit.cc +++ b/FWCore/Framework/test/stream_module_t.cppunit.cc @@ -402,7 +402,7 @@ m_ep() //For each transition, bind a lambda which will call the proper method of the Worker - m_transToFunc[Trans::kBeginStream] = [this](edm::Worker* iBase) { + m_transToFunc[Trans::kBeginStream] = [](edm::Worker* iBase) { edm::StreamContext streamContext(s_streamID0, nullptr); iBase->beginStream(s_streamID0, streamContext); }; @@ -449,7 +449,7 @@ m_ep() edm::ParentContext parentContext; iBase->doWork(*m_rp,*m_es, s_streamID0, parentContext, nullptr); }; - m_transToFunc[Trans::kEndStream] = [this](edm::Worker* iBase) { + m_transToFunc[Trans::kEndStream] = [](edm::Worker* iBase) { edm::StreamContext streamContext(s_streamID0, nullptr); iBase->endStream(s_streamID0, streamContext); }; diff --git a/FWCore/ROOTTests/test/tclass_methods_threaded_t.cc b/FWCore/ROOTTests/test/tclass_methods_threaded_t.cc index a8e81217f722f..db7ab6f717e5a 100644 --- a/FWCore/ROOTTests/test/tclass_methods_threaded_t.cc +++ b/FWCore/ROOTTests/test/tclass_methods_threaded_t.cc @@ -53,7 +53,7 @@ int main(int argc, char** argv) for(int i=0; i 0 ) {} diff --git a/FWCore/ROOTTests/test/tprofile_threaded_t.cc b/FWCore/ROOTTests/test/tprofile_threaded_t.cc index 8575e7ff554cb..3038ac2fd980f 100644 --- a/FWCore/ROOTTests/test/tprofile_threaded_t.cc +++ b/FWCore/ROOTTests/test/tprofile_threaded_t.cc @@ -58,7 +58,7 @@ int main(int argc, char** argv) profiles.push_back(std::make_unique(s.str().c_str(),s.str().c_str(), 100,10,11,0,10)); profiles.back()->SetCanExtend(TH1::kAllAxes); auto profile = profiles.back().get(); - threads.emplace_back([i,profile,&canStart]() { + threads.emplace_back([profile,&canStart]() { static thread_local TThread guard; while(not canStart) {} for(int x=10; x>0; --x) { diff --git a/FWCore/Services/plugins/InitRootHandlers.cc b/FWCore/Services/plugins/InitRootHandlers.cc index 596e5105db735..6e445c8c958bc 100644 --- a/FWCore/Services/plugins/InitRootHandlers.cc +++ b/FWCore/Services/plugins/InitRootHandlers.cc @@ -795,7 +795,7 @@ namespace edm { }); } - iReg.watchPreallocate([this](edm::service::SystemBounds const& iBounds){ + iReg.watchPreallocate([](edm::service::SystemBounds const& iBounds){ if (iBounds.maxNumberOfThreads() > moduleListBuffers_.size()) { moduleListBuffers_.resize(iBounds.maxNumberOfThreads()); }