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
cebc6541c1
commit
c837925087
@@ -164,7 +164,7 @@ ComponentSequence *enterSequence(ComponentSequence *parent,
|
||||
|
||||
ComponentSequence *seq = child.get();
|
||||
parent->addComponent(std::move(child));
|
||||
return seq;
|
||||
return seq; // cppcheck-suppress returnDanglingLifetime
|
||||
}
|
||||
|
||||
static
|
||||
|
||||
@@ -99,7 +99,8 @@ public:
|
||||
const NFABuilder &getBuilder() const override { return builder; }
|
||||
|
||||
/** \brief Wire up the lasts of one component to the firsts of another. */
|
||||
void connectRegions(const vector<PositionInfo> &lasts,
|
||||
// cppcheck-suppress virtualCallInConstructor
|
||||
virtual void connectRegions(const vector<PositionInfo> &lasts,
|
||||
const vector<PositionInfo> &firsts) override;
|
||||
|
||||
/** \brief Wire the lasts of the main sequence to accepts. */
|
||||
|
||||
@@ -108,6 +108,8 @@ const char *read_control_verbs(const char *ptr, const char *end, size_t start,
|
||||
try {
|
||||
%% write exec;
|
||||
} catch (LocatedParseError &error) {
|
||||
// cppcheck-suppress pointerLessThanZero
|
||||
// cppcheck-suppress pointerPositive
|
||||
if (ts >= ptr && ts <= pe) {
|
||||
error.locate(ts - ptr + start);
|
||||
} else {
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace ue2 {
|
||||
/** Class representing a component state. */
|
||||
class PositionInfo {
|
||||
public:
|
||||
// cppcheck-suppress noExplicitConstructor
|
||||
PositionInfo(unsigned int p) : pos(p), flags(0) {}
|
||||
|
||||
bool operator<(const PositionInfo &other) const {
|
||||
|
||||
@@ -347,6 +347,7 @@ void prefilterTree(unique_ptr<Component> &root, const ParseMode &mode) {
|
||||
assert(root);
|
||||
PrefilterVisitor vis(root.get(), mode);
|
||||
|
||||
// cppcheck-suppress constVariablePointer
|
||||
Component *c = root->accept(vis);
|
||||
if (c != root.get()) {
|
||||
root.reset(c);
|
||||
|
||||
Reference in New Issue
Block a user