mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-19 10:34:25 +03:00
Fix/Suppress remaining Cppcheck warnings (#291)
Fix/suppress the following cppcheck warnings: * arithOperationsOnVoidPointer * uninitMember * const* * shadowVariable * assignmentIntegerToAddress * containerOutOfBounds * pointer-related warnings in Ragel source * missingOverride * memleak * knownConditionTrueFalse * noExplicitConstructor * invalidPrintfArgType_sint * useStlAlgorithm * cstyleCast * clarifyCondition * VSX-related cstyleCast * unsignedLessThanZero Furthermore, we added a suppression list to be used, which also includes the following: * missingIncludeSystem * missingInclude * unmatchedSuppression
This commit is contained in:
committed by
GitHub
parent
a8e43a4c0b
commit
02fc8e3b1c
@@ -270,22 +270,26 @@ static really_inline m128 andnot128(m128 a, m128 b) {
|
||||
// aligned load
|
||||
static really_inline m128 load128(const void *ptr) {
|
||||
assert(ISALIGNED_N(ptr, alignof(m128)));
|
||||
// cppcheck-suppress cstyleCast
|
||||
return (m128) vld1q_s32((const int32_t *)ptr);
|
||||
}
|
||||
|
||||
// aligned store
|
||||
static really_inline void store128(void *ptr, m128 a) {
|
||||
assert(ISALIGNED_N(ptr, alignof(m128)));
|
||||
// cppcheck-suppress cstyleCast
|
||||
vst1q_s32((int32_t *)ptr, a);
|
||||
}
|
||||
|
||||
// unaligned load
|
||||
static really_inline m128 loadu128(const void *ptr) {
|
||||
// cppcheck-suppress cstyleCast
|
||||
return (m128) vld1q_s32((const int32_t *)ptr);
|
||||
}
|
||||
|
||||
// unaligned store
|
||||
static really_inline void storeu128(void *ptr, m128 a) {
|
||||
// cppcheck-suppress cstyleCast
|
||||
vst1q_s32((int32_t *)ptr, a);
|
||||
}
|
||||
|
||||
@@ -430,12 +434,14 @@ m128 sub_u8_m128(m128 a, m128 b) {
|
||||
static really_inline
|
||||
m128 set4x32(u32 x3, u32 x2, u32 x1, u32 x0) {
|
||||
uint32_t ALIGN_ATTR(16) data[4] = { x0, x1, x2, x3 };
|
||||
// cppcheck-suppress cstyleCast
|
||||
return (m128) vld1q_u32((uint32_t *) data);
|
||||
}
|
||||
|
||||
static really_inline
|
||||
m128 set2x64(u64a hi, u64a lo) {
|
||||
uint64_t ALIGN_ATTR(16) data[2] = { lo, hi };
|
||||
// cppcheck-suppress cstyleCast
|
||||
return (m128) vld1q_u64((uint64_t *) data);
|
||||
}
|
||||
|
||||
|
||||
@@ -255,22 +255,26 @@ static really_inline m128 andnot128(m128 a, m128 b) {
|
||||
// aligned load
|
||||
static really_inline m128 load128(const void *ptr) {
|
||||
assert(ISALIGNED_N(ptr, alignof(m128)));
|
||||
// cppcheck-suppress cstyleCast
|
||||
return (m128) vec_xl(0, (const int32_t*)ptr);
|
||||
}
|
||||
|
||||
// aligned store
|
||||
static really_inline void store128(void *ptr, m128 a) {
|
||||
assert(ISALIGNED_N(ptr, alignof(m128)));
|
||||
// cppcheck-suppress cstyleCast
|
||||
vec_st(a, 0, (int32_t*)ptr);
|
||||
}
|
||||
|
||||
// unaligned load
|
||||
static really_inline m128 loadu128(const void *ptr) {
|
||||
// cppcheck-suppress cstyleCast
|
||||
return (m128) vec_xl(0, (const int32_t*)ptr);
|
||||
}
|
||||
|
||||
// unaligned store
|
||||
static really_inline void storeu128(void *ptr, m128 a) {
|
||||
// cppcheck-suppress cstyleCast
|
||||
vec_xst(a, 0, (int32_t*)ptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ public:
|
||||
|
||||
static depth unreachable() {
|
||||
depth d;
|
||||
d.val = val_unreachable;
|
||||
return d;
|
||||
}
|
||||
|
||||
@@ -179,7 +178,7 @@ public:
|
||||
}
|
||||
|
||||
s64a rv = val + d;
|
||||
if (rv < 0 || (u64a)rv >= val_infinity) {
|
||||
if ((u64a)rv >= val_infinity) {
|
||||
DEBUG_PRINTF("depth %lld too large to represent!\n", rv);
|
||||
throw DepthOverflowError();
|
||||
}
|
||||
@@ -202,7 +201,7 @@ public:
|
||||
}
|
||||
|
||||
s64a rv = val - d;
|
||||
if (rv < 0 || (u64a)rv >= val_infinity) {
|
||||
if ((u64a)rv >= val_infinity) {
|
||||
DEBUG_PRINTF("depth %lld too large to represent!\n", rv);
|
||||
throw DepthOverflowError();
|
||||
}
|
||||
|
||||
@@ -227,8 +227,6 @@ void describeClass(ostream &os, const CharReach &incr, size_t maxLength,
|
||||
int out_count = describeClassInt(out, incr, maxLength, out_type);
|
||||
|
||||
std::ostringstream neg;
|
||||
UNUSED int neg_count = describeClassInt(neg, ~incr, maxLength, out_type);
|
||||
|
||||
if (out.tellp() <= neg.tellp()) {
|
||||
if (out_count > 1) {
|
||||
os << '[' << out.str() << ']';
|
||||
|
||||
@@ -62,6 +62,7 @@ private:
|
||||
|
||||
public:
|
||||
template <class OtherIter, class OtherValue>
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
iter_wrapper(iter_wrapper<OtherIter, OtherValue> other,
|
||||
typename std::enable_if<std::is_convertible<
|
||||
OtherIter, WrappedIter>::value>::type * = nullptr)
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
adj_edge_iterator<Reverse>, edge_descriptor,
|
||||
boost::forward_traversal_tag, edge_descriptor> {
|
||||
vertex_descriptor u;
|
||||
const base_type *g;
|
||||
const base_type *g = nullptr;
|
||||
typename Traits::in_edge_iterator in_it;
|
||||
typename Traits::out_edge_iterator out_it;
|
||||
bool done_in = false;
|
||||
@@ -238,7 +238,7 @@ public:
|
||||
: public boost::iterator_facade<edge_iterator, edge_descriptor,
|
||||
boost::forward_traversal_tag,
|
||||
edge_descriptor> {
|
||||
const base_type *g;
|
||||
const base_type *g = nullptr;
|
||||
typename Traits::edge_iterator it;
|
||||
public:
|
||||
edge_iterator() = default;
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
template<class, class> friend class iter_wrapper;
|
||||
|
||||
template<class OtherIter, class OtherValue>
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
iter_wrapper(iter_wrapper<OtherIter, OtherValue> other,
|
||||
typename std::enable_if<std::is_convertible<
|
||||
OtherIter, WrappedIter>::value>::type * = nullptr)
|
||||
|
||||
@@ -228,6 +228,7 @@ public:
|
||||
assert(sub != INVALID_SUBSET);
|
||||
ENSURE_AT_LEAST(&subset_count, sub + 1);
|
||||
}
|
||||
// cppcheck-suppress unsignedPositive
|
||||
assert(subset_count <= state_to_subset.size());
|
||||
|
||||
subsets.resize(subset_count);
|
||||
|
||||
@@ -537,14 +537,14 @@ really_inline SuperVector<16> SuperVector<16>::Ones_vshl(uint8_t const N)
|
||||
template <>
|
||||
really_inline SuperVector<16> SuperVector<16>::loadu(void const *ptr)
|
||||
{
|
||||
return SuperVector<16>(vec_xl(0, (const long64_t*)ptr));
|
||||
return SuperVector<16>(vec_xl(0, reinterpret_cast<const long64_t*>(ptr)));
|
||||
}
|
||||
|
||||
template <>
|
||||
really_inline SuperVector<16> SuperVector<16>::load(void const *ptr)
|
||||
{
|
||||
assert(ISALIGNED_N(ptr, alignof(SuperVector::size)));
|
||||
return SuperVector<16>(vec_xl(0, (const long64_t*)ptr));
|
||||
return SuperVector<16>(vec_xl(0, reinterpret_cast<const long64_t*>(ptr)));
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -41,16 +41,16 @@
|
||||
#include "unaligned.h"
|
||||
|
||||
// Aligned loads
|
||||
#ifndef __cplusplus__
|
||||
#ifndef __cplusplus
|
||||
#define load_u8(a) (*(const u8 *)(a))
|
||||
#define load_u16(a) (*(const u16 *)(a))
|
||||
#define load_u32(a) (*(const u32 *)(a))
|
||||
#define load_u64a(a) (*(const u64a *)(a))
|
||||
#else
|
||||
#define load_u8(a) (*(reinterpret_cast<const u8 *>(a))
|
||||
#define load_u16(a) (*(reinterpret_cast<const u16 *>(a))
|
||||
#define load_u32(a) (*(reinterpret_cast<const u32 *>(a))
|
||||
#define load_u64a(a) (*(reinterpret_cast<const u64a *>(a))
|
||||
#define load_u8(a) (*(reinterpret_cast<const u8 *>(a)))
|
||||
#define load_u16(a) (*(reinterpret_cast<const u16 *>(a)))
|
||||
#define load_u32(a) (*(reinterpret_cast<const u32 *>(a)))
|
||||
#define load_u64a(a) (*(reinterpret_cast<const u64a *>(a)))
|
||||
#endif // __cplusplus__
|
||||
#define load_m128(a) load128(a)
|
||||
#define load_m256(a) load256(a)
|
||||
@@ -58,7 +58,7 @@
|
||||
#define load_m512(a) load512(a)
|
||||
|
||||
// Unaligned loads
|
||||
#ifndef __cplusplus__
|
||||
#ifndef __cplusplus
|
||||
#define loadu_u8(a) (*(const u8 *)(a))
|
||||
#define loadu_u16(a) unaligned_load_u16((const u8 *)(a))
|
||||
#define loadu_u32(a) unaligned_load_u32((const u8 *)(a))
|
||||
@@ -68,31 +68,35 @@
|
||||
#define loadu_u16(a) unaligned_load_u16(reinterpret_cast<const u8 *>(a))
|
||||
#define loadu_u32(a) unaligned_load_u32(reinterpret_cast<const u8 *>(a))
|
||||
#define loadu_u64a(a) unaligned_load_u64a(reinterpret_cast<const u8 *>(a))
|
||||
#endif // __cplusplus__
|
||||
#endif // __cplusplus
|
||||
#define loadu_m128(a) loadu128(a)
|
||||
#define loadu_m256(a) loadu256(a)
|
||||
#define loadu_m384(a) loadu384(a)
|
||||
#define loadu_m512(a) loadu512(a)
|
||||
|
||||
// Aligned stores
|
||||
#ifndef __cplusplus__
|
||||
#ifndef __cplusplus
|
||||
#define store_u8(ptr, a) do { *((u8 *)(ptr)) = (a); } while(0)
|
||||
#define store_u16(ptr, a) do { *((u16 *)(ptr)) = (a); } while(0)
|
||||
#define store_u32(ptr, a) do { *((u32 *)(ptr)) = (a); } while(0)
|
||||
#define store_u64a(ptr, a) do { *((u64a *)(ptr)) = (a); } while(0)
|
||||
#else
|
||||
#define store_u8(ptr, a) do { *(reinterpret_cast<u8 *>(ptr)) = (a); } while(0)
|
||||
#define store_u16(ptr, a) do { *(reinterpret_cast<u16 *>(ptr)) = (a); } while(0)
|
||||
#define store_u32(ptr, a) do { *(reinterpret_cast<u32 *>(ptr)) = (a); } while(0)
|
||||
#define store_u64a(ptr, a) do { *(reinterpret_cast<u64a *>(ptr)) = (a); } while(0)
|
||||
#else
|
||||
#endif // __cplusplus__
|
||||
#endif // __cplusplus
|
||||
#define store_m128(ptr, a) store128(ptr, a)
|
||||
#define store_m256(ptr, a) store256(ptr, a)
|
||||
#define store_m384(ptr, a) store384(ptr, a)
|
||||
#define store_m512(ptr, a) store512(ptr, a)
|
||||
|
||||
// Unaligned stores
|
||||
#ifndef __cplusplus__
|
||||
#ifndef __cplusplus
|
||||
#define storeu_u8(ptr, a) do { *(u8 *)(ptr) = (a); } while(0)
|
||||
#else
|
||||
#define storeu_u8(ptr, a) do { *(reinterpret_cast<u8 *>(ptr)) = (a); } while(0)
|
||||
#endif // __cplusplus__
|
||||
#endif // __cplusplus
|
||||
#define storeu_u16(ptr, a) unaligned_store_u16(ptr, a)
|
||||
#define storeu_u32(ptr, a) unaligned_store_u32(ptr, a)
|
||||
#define storeu_u64a(ptr, a) unaligned_store_u64a(ptr, a)
|
||||
|
||||
Reference in New Issue
Block a user