Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .selfcheck_suppressions
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ noExplicitConstructor:externals/tinyxml2/tinyxml2.h
missingOverride:externals/tinyxml2/tinyxml2.h
invalidPrintfArgType_sint:externals/tinyxml2/tinyxml2.h
naming-privateMemberVariable:externals/tinyxml2/tinyxml2.h
functionStatic:externals/tinyxml2/tinyxml2.h
functionStatic:externals/tinyxml2/tinyxml2.cpp
invalidPrintfArgType_uint:externals/tinyxml2/tinyxml2.cpp
funcArgNamesDifferent:externals/tinyxml2/tinyxml2.cpp
nullPointerRedundantCheck:externals/tinyxml2/tinyxml2.cpp
Expand Down
2 changes: 1 addition & 1 deletion lib/checkclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2642,7 +2642,7 @@ void CheckClass::checkConstError2(const Token *tok1, const Token *tok2, const st
{
std::list<const Token *> toks{ tok1 };
if (tok2)
toks.push_back(tok2);
toks.push_front(tok2);
if (!suggestStatic) {
const std::string msg = foundAllBaseClasses ?
"Technically the member function '$symbol' can be const.\nThe member function '$symbol' can be made a const " :
Expand Down
1 change: 1 addition & 0 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,7 @@ void SymbolDatabase::createSymbolDatabaseExprIds()
}
}

// cppcheck-suppress functionConst - has side effects
void SymbolDatabase::setArrayDimensionsUsingValueFlow()
{
// set all unknown array dimensions
Expand Down
10 changes: 4 additions & 6 deletions lib/symboldatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,7 @@ class CPPCHECKLIB SymbolDatabase {
nonneg int sizeOfType(const Token *type) const;

/** Set array dimensions when valueflow analysis is completed */
void setArrayDimensionsUsingValueFlow(); // cppcheck-suppress functionConst // has side effects
void setArrayDimensionsUsingValueFlow();

void clangSetVariables(const std::vector<const Variable *> &variableList);
void createSymbolDatabaseExprIds();
Expand All @@ -1435,14 +1435,12 @@ class CPPCHECKLIB SymbolDatabase {
void createSymbolDatabaseNeedInitialization();
void createSymbolDatabaseVariableSymbolTable();
void createSymbolDatabaseSetScopePointers();
void createSymbolDatabaseSetFunctionPointers(bool firstPass); // cppcheck-suppress functionConst // has side effects
void createSymbolDatabaseSetFunctionPointers(bool firstPass);
void createSymbolDatabaseSetVariablePointers();
// cppcheck-suppress functionConst
void createSymbolDatabaseSetTypePointers();
void createSymbolDatabaseSetSmartPointerType();
void createSymbolDatabaseEnums(); // cppcheck-suppress functionConst // has side effects
void createSymbolDatabaseEscapeFunctions(); // cppcheck-suppress functionConst // has side effects
// cppcheck-suppress functionConst
void createSymbolDatabaseEnums();
void createSymbolDatabaseEscapeFunctions();
void createSymbolDatabaseIncompleteVars();

void debugSymbolDatabase() const;
Expand Down
2 changes: 2 additions & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3839,6 +3839,7 @@ void Tokenizer::arraySize()
}
}

// cppcheck-suppress functionConst
void Tokenizer::arraySizeAfterValueFlow()
{
// After ValueFlow, adjust array sizes.
Expand Down Expand Up @@ -7087,6 +7088,7 @@ void Tokenizer::simplifyVarDecl(const bool only_k_r_fpar)
simplifyVarDecl(list.front(), nullptr, only_k_r_fpar);
}

// cppcheck-suppress functionConst - has side effects
void Tokenizer::simplifyVarDecl(Token * tokBegin, const Token * const tokEnd, const bool only_k_r_fpar)
{
const bool cpp = isCPP();
Expand Down
4 changes: 2 additions & 2 deletions lib/tokenize.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class CPPCHECKLIB Tokenizer {

/** Insert array size where it isn't given */
void arraySize();
void arraySizeAfterValueFlow(); // cppcheck-suppress functionConst
void arraySizeAfterValueFlow();

/** Simplify labels and 'case|default' syntaxes.
*/
Expand Down Expand Up @@ -165,7 +165,7 @@ class CPPCHECKLIB Tokenizer {
* \param only_k_r_fpar Only simplify K&R function parameters
*/
void simplifyVarDecl( bool only_k_r_fpar);
void simplifyVarDecl(Token * tokBegin, const Token * tokEnd, bool only_k_r_fpar); // cppcheck-suppress functionConst // has side effects
void simplifyVarDecl(Token * tokBegin, const Token * tokEnd, bool only_k_r_fpar);

/**
* Simplify variable initialization
Expand Down
4 changes: 2 additions & 2 deletions test/cfg/qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,9 @@ namespace {
class Fred : public QObject {
Q_OBJECT
private slots:
// cppcheck-suppress functionStatic
void foo();
};
// cppcheck-suppress functionStatic
void Fred::foo() {}

// bitfields14
Expand Down Expand Up @@ -816,13 +816,13 @@ struct DQObject_missingOverride : BQObject_missingOverride {
namespace {
class TestUnusedFunction : public QObject { // #13236
TestUnusedFunction();
// cppcheck-suppress functionStatic
void doStuff();
};

TestUnusedFunction::TestUnusedFunction() {
QObject::connect(this, SIGNAL(doStuff()), SLOT(doStuff()));
}

// cppcheck-suppress functionStatic
void TestUnusedFunction::doStuff() {} // Should not warn here with unusedFunction
}
Loading
Loading