Fix various warnings

-Wunused-parameter
-Wreorder
-Wsign-compare
-Wunused-private-field
This commit is contained in:
Dennis Klein 2018-05-24 11:07:39 +02:00 committed by Mohammad Al-Turany
parent 811e716731
commit 72f5cdef58
13 changed files with 22 additions and 24 deletions

View File

@ -23,8 +23,6 @@ Sink::Sink()
: fMaxIterations(0)
, fNumIterations1(0)
, fNumIterations2(0)
, fReceived1(false)
, fReceived2(false)
{
// register a handler for data arriving on "data" channel
OnData("data1", &Sink::HandleData1);

View File

@ -36,8 +36,6 @@ class Sink : public FairMQDevice
uint64_t fMaxIterations;
uint64_t fNumIterations1;
uint64_t fNumIterations2;
bool fReceived1;
bool fReceived2;
};
} // namespace example_multiple_transports

View File

@ -38,7 +38,7 @@ void Sampler::InitTask()
fRegion = FairMQUnmanagedRegionPtr(NewUnmanagedRegionFor("data",
0,
10000000,
[this](void* data, size_t size, void* hint) { // callback to be called when message buffers no longer needed by transport
[this](void* /*data*/, size_t /*size*/, void* /*hint*/) { // callback to be called when message buffers no longer needed by transport
--fNumUnackedMsgs;
if (fMaxIterations > 0)
{

View File

@ -28,6 +28,7 @@ FairMQChannel::FairMQChannel()
, fType("unspecified")
, fMethod("unspecified")
, fAddress("unspecified")
, fTransportType(fair::mq::Transport::DEFAULT)
, fSndBufSize(1000)
, fRcvBufSize(1000)
, fSndKernelSize(0)
@ -35,7 +36,6 @@ FairMQChannel::FairMQChannel()
, fRateLogging(1)
, fName("")
, fIsValid(false)
, fTransportType(fair::mq::Transport::DEFAULT)
, fTransportFactory(nullptr)
, fMultipart(false)
, fModified(true)
@ -48,6 +48,7 @@ FairMQChannel::FairMQChannel(const string& type, const string& method, const str
, fType(type)
, fMethod(method)
, fAddress(address)
, fTransportType(fair::mq::Transport::DEFAULT)
, fSndBufSize(1000)
, fRcvBufSize(1000)
, fSndKernelSize(0)
@ -55,7 +56,6 @@ FairMQChannel::FairMQChannel(const string& type, const string& method, const str
, fRateLogging(1)
, fName("")
, fIsValid(false)
, fTransportType(fair::mq::Transport::DEFAULT)
, fTransportFactory(nullptr)
, fMultipart(false)
, fModified(true)
@ -68,6 +68,7 @@ FairMQChannel::FairMQChannel(const string& name, const string& type, std::shared
, fType(type)
, fMethod("unspecified")
, fAddress("unspecified")
, fTransportType(factory->GetType())
, fSndBufSize(1000)
, fRcvBufSize(1000)
, fSndKernelSize(0)
@ -75,7 +76,6 @@ FairMQChannel::FairMQChannel(const string& name, const string& type, std::shared
, fRateLogging(1)
, fName(name)
, fIsValid(false)
, fTransportType(factory->GetType())
, fTransportFactory(factory)
, fMultipart(false)
, fModified(true)
@ -88,6 +88,7 @@ FairMQChannel::FairMQChannel(const FairMQChannel& chan)
, fType(chan.fType)
, fMethod(chan.fMethod)
, fAddress(chan.fAddress)
, fTransportType(chan.fTransportType)
, fSndBufSize(chan.fSndBufSize)
, fRcvBufSize(chan.fRcvBufSize)
, fSndKernelSize(chan.fSndKernelSize)
@ -95,7 +96,6 @@ FairMQChannel::FairMQChannel(const FairMQChannel& chan)
, fRateLogging(chan.fRateLogging)
, fName(chan.fName)
, fIsValid(false)
, fTransportType(chan.fTransportType)
, fTransportFactory(nullptr)
, fMultipart(chan.fMultipart)
, fModified(chan.fModified)

View File

@ -501,7 +501,7 @@ void FairMQDevice::RunWrapper()
while (CheckCurrentState(RUNNING) && ConditionalRun())
{
if (fRate > 0.001) {
auto timespan = chrono::duration_cast<TimeScale>(Clock::now() - reftime).count() - fLastTime;
auto timespan = static_cast<TimeScale::rep>(chrono::duration_cast<TimeScale>(Clock::now() - reftime).count() - fLastTime);
if (timespan < period) {
TimeScale sleepfor(period - timespan);
this_thread::sleep_for(sleepfor);

View File

@ -72,8 +72,7 @@ struct Machine_ : public msmf::state_machine_def<Machine_>
{
public:
Machine_()
: fState()
, fWork()
: fWork()
, fWorkAvailableCondition()
, fWorkDoneCondition()
, fWorkMutex()
@ -83,6 +82,7 @@ struct Machine_ : public msmf::state_machine_def<Machine_>
, fStateChangeSignal()
, fStateChangeSignalsMap()
, fTerminationRequested(false)
, fState()
, fWorkerThread()
{}
@ -521,8 +521,8 @@ _Pragma("GCC diagnostic pop")
using namespace fair::mq::fsm;
FairMQStateMachine::FairMQStateMachine()
: fFsm(new FairMQFSM)
, fChangeStateMutex()
: fChangeStateMutex()
, fFsm(new FairMQFSM)
{
static_pointer_cast<FairMQFSM>(fFsm)->fInitWrapperHandler = bind(&FairMQStateMachine::InitWrapper, this);
static_pointer_cast<FairMQFSM>(fFsm)->fInitTaskWrapperHandler = bind(&FairMQStateMachine::InitTaskWrapper, this);

View File

@ -52,8 +52,8 @@ struct IofN
, fEntries()
{}
int fI;
int fN;
unsigned int fI;
unsigned int fN;
std::vector<std::string> fEntries;
};

View File

@ -238,7 +238,7 @@ int FairMQSocketSHM::ReceiveImpl(FairMQMessagePtr& msg, const int flags, const i
}
}
int64_t FairMQSocketSHM::SendImpl(vector<FairMQMessagePtr>& msgVec, const int flags, const int timeout)
int64_t FairMQSocketSHM::SendImpl(vector<FairMQMessagePtr>& msgVec, const int flags, const int /*timeout*/)
{
const unsigned int vecSize = msgVec.size();
int64_t totalSize = 0;
@ -318,7 +318,7 @@ int64_t FairMQSocketSHM::SendImpl(vector<FairMQMessagePtr>& msgVec, const int fl
}
int64_t FairMQSocketSHM::ReceiveImpl(vector<FairMQMessagePtr>& msgVec, const int flags, const int timeout)
int64_t FairMQSocketSHM::ReceiveImpl(vector<FairMQMessagePtr>& msgVec, const int flags, const int /*timeout*/)
{
int64_t totalSize = 0;

View File

@ -8,6 +8,7 @@
#include <FairMQDevice.h>
#include <cstddef>
#include <thread>
namespace fair
@ -53,7 +54,7 @@ class PairLeft : public FairMQDevice
if (ret > 0) {
auto content = std::string{static_cast<char*>(msg6->GetData()), msg6->GetSize()};
LOG(info) << ret << ", " << msg6->GetSize() << ", '" << content << "'";
if (msg6->GetSize() == ret && content == "testdata1234") counter++;
if (msg6->GetSize() == static_cast<std::size_t>(ret) && content == "testdata1234") counter++;
}
if (counter == 6) LOG(info) << "Simple message with short text data successfull";

View File

@ -7,6 +7,7 @@
********************************************************************************/
#include <FairMQDevice.h>
#include <cstddef>
#include <string>
#include <thread>
@ -51,7 +52,7 @@ class PairRight : public FairMQDevice
if (ret > 0) {
auto content = std::string{static_cast<char*>(msg5->GetData()), msg5->GetSize()};
LOG(info) << ret << ", " << msg5->GetSize() << ", '" << content << "'";
if (msg5->GetSize() == ret && content == "testdata1234") counter++;
if (msg5->GetSize() == static_cast<std::size_t>(ret) && content == "testdata1234") counter++;
}
auto msg6(NewSimpleMessageFor("data", 0, "testdata1234"));
if (Send(msg6, "data") >= 0) counter++;

View File

@ -63,7 +63,7 @@ TEST_F(PluginServices, ConfigCallbacks)
if (key == "chans.data.0.address") { ASSERT_EQ(value, "tcp://localhost:4321"); }
});
mServices.SubscribeToPropertyChange<int>("test", [](const string& key, int value) {
mServices.SubscribeToPropertyChange<int>("test", [](const string& key, int /*value*/) {
if(key == "chans.data.0.rcvBufSize") {
FAIL(); // should not be called because we unsubscribed
}

View File

@ -88,7 +88,7 @@ TEST(PluginManager, LoadPluginStatic)
// program options
auto count = 0;
mgr.ForEachPluginProgOptions([&count](const options_description& d){ ++count; });
mgr.ForEachPluginProgOptions([&count](const options_description&){ ++count; });
ASSERT_EQ(count, 1);
mgr.WaitForPluginsToReleaseDeviceControl();

View File

@ -38,7 +38,7 @@ TEST(StateMachine, RegularFSM)
ASSERT_NO_THROW(fsm.ChangeState(T::Automatic));
int cnt{0};
fsm.SubscribeToStateQueued("test", [&](S newState, S lastState){
fsm.SubscribeToStateQueued("test", [&](S /*newState*/, S /*lastState*/){
++cnt;
});