cppcheck warning suppressions

This commit is contained in:
Pavel Kirienko
2014-08-03 14:27:33 +04:00
parent 63843285a0
commit 6c972e6ba5
7 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -168,7 +168,7 @@ struct UAVCAN_EXPORT IsDynamicallyAllocatable
{
static void check()
{
char dummy[(sizeof(T) <= MemPoolBlockSize) ? 1 : -1];
char dummy[(sizeof(T) <= MemPoolBlockSize) ? 1 : -1] = { '0' };
(void)dummy;
}
};
@@ -210,7 +210,7 @@ class UAVCAN_EXPORT YamlStreamer<FloatSpec<BitLen, CastMode> >
typedef typename FloatSpec<BitLen, CastMode>::StorageType StorageType;
public:
template <typename Stream>
template <typename Stream> // cppcheck-suppress passedByValue
static void stream(Stream& s, const StorageType value, int)
{
s << value;
@@ -153,7 +153,7 @@ class UAVCAN_EXPORT YamlStreamer<IntegerSpec<BitLen, Signedness, CastMode> >
typedef typename RawType::StorageType StorageType;
public:
template <typename Stream>
template <typename Stream> // cppcheck-suppress passedByValue
static void stream(Stream& s, const StorageType value, int)
{
// Get rid of character types - we want its integer representation, not ASCII code
@@ -76,7 +76,7 @@ private:
uint32_t response_failure_count_;
ResponseType response_;
void handleReceivedDataStruct(ReceivedDataStructure<RequestType>& request)
virtual void handleReceivedDataStruct(ReceivedDataStructure<RequestType>& request)
{
UAVCAN_ASSERT(request.getTransferType() == TransferTypeServiceRequest);
if (try_implicit_cast<bool>(callback_, true))
+1 -1
View File
@@ -69,7 +69,7 @@ private:
Callback callback_;
void handleReceivedDataStruct(ReceivedDataStructure<DataType_>& msg)
virtual void handleReceivedDataStruct(ReceivedDataStructure<DataType_>& msg)
{
if (try_implicit_cast<bool>(callback_, true))
{
+1
View File
@@ -41,6 +41,7 @@ static inline bool isnan(T arg)
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
return std::isnan(arg);
#else
// cppcheck-suppress duplicateExpression
return arg != arg;
#endif
}
+2 -3
View File
@@ -73,7 +73,7 @@ struct PairableCanDriver : public uavcan::ICanDriver, public uavcan::ICanIface
assert(other);
if (inout_masks.read == 1)
{
inout_masks.read = (read_queue.size() || loopback_queue.size()) ? 1 : 0;
inout_masks.read = (!read_queue.empty() || !loopback_queue.empty()) ? 1 : 0;
}
if (inout_masks.read || inout_masks.write)
{
@@ -160,8 +160,7 @@ struct InterlinkedTestNodes
nspins2 = nspins2 ? nspins2 : 1;
while (nspins2 --> 0)
{
int ret = -1;
ret = a.spin(uavcan::MonotonicDuration::fromMSec(1));
int ret = a.spin(uavcan::MonotonicDuration::fromMSec(1));
if (ret < 0)
{
return ret;