Fixed some spelling mistakes
This commit is contained in:
parent
f15539d6bb
commit
46a11183a5
1
AUTHORS
1
AUTHORS
|
@ -12,6 +12,7 @@ Nicolas Le Cam
|
|||
Reijo Tomperi
|
||||
Robert Reif
|
||||
Slava Semushin
|
||||
vBm
|
||||
Vesa Pikki
|
||||
Zachary Blair
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class CmdLineParser
|
|||
public:
|
||||
/**
|
||||
* The constructor.
|
||||
* @param settings Settings instance that will be modified accoding to
|
||||
* @param settings Settings instance that will be modified according to
|
||||
* options user has given.
|
||||
*/
|
||||
CmdLineParser(Settings *settings);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
* (message) - Error message
|
||||
* (severity) - Error severity
|
||||
*
|
||||
* Example opening a file with Kate and make Kate scroll to the corret line:
|
||||
* Example opening a file with Kate and make Kate scroll to the correct line:
|
||||
* kate -l(line) (file)
|
||||
*
|
||||
*/
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
int GetApplicationCount() const;
|
||||
|
||||
/**
|
||||
* @brief Get spesific application's name
|
||||
* @brief Get specific application's name
|
||||
*
|
||||
* @param index Index of the application whose name to get
|
||||
* @return Name of the application
|
||||
|
|
|
@ -83,7 +83,7 @@ unsigned CheckStatistics::GetCount(ShowTypes type) const
|
|||
break;
|
||||
case SHOW_NONE:
|
||||
default:
|
||||
qDebug() << "Unknown error type - returning zero statistices.";
|
||||
qDebug() << "Unknown error type - returning zero statistics.";
|
||||
break;
|
||||
}
|
||||
return count;
|
||||
|
|
|
@ -71,7 +71,7 @@ protected:
|
|||
* Whole purpose of these states is to allow stopping of the checking. When
|
||||
* stopping we say for the thread (Stopping) that stop when current check
|
||||
* has been completed. Thread must be stopped cleanly, just terminating thread
|
||||
* likely causes unpredictable side-effedts.
|
||||
* likely causes unpredictable side-effects.
|
||||
*/
|
||||
enum State
|
||||
{
|
||||
|
|
|
@ -70,7 +70,7 @@ protected:
|
|||
|
||||
/**
|
||||
* @brief Test if filename matches the filename extensions filtering.
|
||||
* @param true if filename matches filterin.
|
||||
* @param true if filename matches filtering.
|
||||
*/
|
||||
bool FilterMatches(const QFileInfo &inf);
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ void MainWindow::CheckDirectory()
|
|||
|
||||
bool MainWindow::GetCheckProject()
|
||||
{
|
||||
// We have succesfully loaded project earlier and use that project
|
||||
// We have successfully loaded project earlier and use that project
|
||||
if (mProject)
|
||||
return true;
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ protected:
|
|||
bool mErrorsFound;
|
||||
|
||||
/**
|
||||
* @brief Should we show a "No errors found dialog" everytime no errors were found?
|
||||
* @brief Should we show a "No errors found dialog" every time no errors were found?
|
||||
*/
|
||||
bool mShowNoErrorsMessage;
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
* @brief Start the threads to check the files
|
||||
*
|
||||
* @param settings Settings for checking
|
||||
* @param recheck Should we reuse the files we checked earleir
|
||||
* @param recheck Should we reuse the files we checked earlier
|
||||
*/
|
||||
void Check(const Settings &settings, bool recheck);
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@ public:
|
|||
public slots:
|
||||
|
||||
/**
|
||||
* @brief Slot threads use to signal this class that a spesific file is checked
|
||||
* @param file File taht is checked
|
||||
* @brief Slot threads use to signal this class that a specific file is checked
|
||||
* @param file File that is checked
|
||||
*/
|
||||
void FileChecked(const QString &file);
|
||||
signals:
|
||||
|
|
|
@ -49,7 +49,7 @@ TranslationHandler::TranslationHandler(QObject *parent) :
|
|||
<< "cppcheck_ja"
|
||||
<< "cppcheck_sr";
|
||||
|
||||
//Load english as a fallback language
|
||||
//Load English as a fallback language
|
||||
QTranslator *english = new QTranslator();
|
||||
if (english->load("cppcheck_en"))
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ const QStringList TranslationHandler::GetFiles() const
|
|||
|
||||
bool TranslationHandler::SetLanguage(const int index, QString &error)
|
||||
{
|
||||
//If english is the language
|
||||
//If English is the language
|
||||
if (index == 0)
|
||||
{
|
||||
//Just remove all extra translators
|
||||
|
@ -147,7 +147,7 @@ int TranslationHandler::SuggestLanguage() const
|
|||
//And see if we can find it from our list of language files
|
||||
int index = mFiles.indexOf(file);
|
||||
|
||||
//If nothing found, return english
|
||||
//If nothing found, return English
|
||||
if (index < 0)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -89,7 +89,7 @@ void XmlReport::WriteError(const ErrorItem &error)
|
|||
/*
|
||||
Error example from the core program in xml
|
||||
<error file="gui/test.cpp" line="14" id="mismatchAllocDealloc" severity="error" msg="Mismatching allocation and deallocation: k"/>
|
||||
The callstack seems to be ignored here aswell, instead last item of the stack is used
|
||||
The callstack seems to be ignored here as well, instead last item of the stack is used
|
||||
*/
|
||||
|
||||
mXmlWriter->writeStartElement(ErrorElementName);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
cppcheck-htmlreport
|
||||
|
||||
This is a little utility to generate a html report of a xml file produced by
|
||||
This is a little utility to generate a html report of a XML file produced by
|
||||
cppcheck.
|
||||
|
||||
The utility is implemented in python and require the pygments module to be
|
||||
The utility is implemented in Python and require the pygments module to be
|
||||
able to generate syntax highlighted source code.
|
||||
|
|
|
@ -753,7 +753,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector<std::str
|
|||
if (Token::Match(tok2->tokAt(4), "%var% =|+=|-=") && MathLib::toLongNumber(max_counter_value) <= size)
|
||||
condition_out_of_bounds = false;
|
||||
|
||||
// Goto the end paranthesis of the for-statement: "for (x; y; z)" ..
|
||||
// Goto the end parenthesis of the for-statement: "for (x; y; z)" ..
|
||||
tok2 = tok->next()->link();
|
||||
if (!tok2 || !tok2->tokAt(5))
|
||||
break;
|
||||
|
@ -922,7 +922,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const ArrayInfo &arrayInfo
|
|||
if (Token::Match(tok2->tokAt(4), "%var% =|+=|-=") && MathLib::toLongNumber(max_counter_value) <= (int)arrayInfo.num[0])
|
||||
condition_out_of_bounds = false;
|
||||
|
||||
// Goto the end paranthesis of the for-statement: "for (x; y; z)" ..
|
||||
// Goto the end parenthesis of the for-statement: "for (x; y; z)" ..
|
||||
tok2 = tok->next()->link();
|
||||
if (!tok2 || !tok2->tokAt(5))
|
||||
break;
|
||||
|
|
|
@ -211,7 +211,7 @@ void CheckClass::privateFunctions()
|
|||
if (!info->isClassOrStruct())
|
||||
continue;
|
||||
|
||||
// dont check derived classes
|
||||
// don’t check derived classes
|
||||
if (!info->derivedFrom.empty())
|
||||
continue;
|
||||
|
||||
|
|
|
@ -1403,7 +1403,7 @@ Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list<const Toke
|
|||
|
||||
// Inside class function.. if the var is passed as a parameter then
|
||||
// just add a "::use"
|
||||
// The "::use" means that a member function was probably called but it wasn't analyzed further
|
||||
// The "::use" means that a member function was probably called but it wasn't analysed further
|
||||
else if (classmember)
|
||||
{
|
||||
if (noreturn.find(tok->str()) != noreturn.end())
|
||||
|
@ -2225,7 +2225,7 @@ const Token *CheckMemoryLeakInFunction::findleak(const Token *tokens)
|
|||
while (last->next())
|
||||
last = last->next();
|
||||
|
||||
// not a leak if exit is called before the end of the funcion
|
||||
// not a leak if exit is called before the end of the function
|
||||
if (!Token::Match(last->tokAt(-2), "exit|callfunc ; }"))
|
||||
return last;
|
||||
}
|
||||
|
|
|
@ -216,11 +216,11 @@ void CheckNullPointer::nullPointerLinkedList()
|
|||
if (!Token::simpleMatch(tok1->next()->link(), ") {"))
|
||||
continue;
|
||||
|
||||
// is there any dereferencing occuring in the for statement..
|
||||
// is there any dereferencing occurring in the for statement..
|
||||
unsigned int parlevel2 = 1;
|
||||
for (const Token *tok2 = tok1->tokAt(2); tok2; tok2 = tok2->next())
|
||||
{
|
||||
// Parantheses..
|
||||
// Parentheses..
|
||||
if (tok2->str() == "(")
|
||||
++parlevel2;
|
||||
else if (tok2->str() == ")")
|
||||
|
@ -230,7 +230,7 @@ void CheckNullPointer::nullPointerLinkedList()
|
|||
--parlevel2;
|
||||
}
|
||||
|
||||
// Dereferencing a variable inside the "for" parantheses..
|
||||
// Dereferencing a variable inside the "for" parentheses..
|
||||
else if (Token::Match(tok2, "%var% . %var%"))
|
||||
{
|
||||
const unsigned int varid(tok2->varId());
|
||||
|
@ -532,7 +532,7 @@ void CheckNullPointer::nullPointer()
|
|||
nullPointerByCheckAndDeRef();
|
||||
}
|
||||
|
||||
/** Derefencing null constant (simplified token list) */
|
||||
/** Dereferencing null constant (simplified token list) */
|
||||
void CheckNullPointer::nullConstantDereference()
|
||||
{
|
||||
// this is kept at 0 for all scopes that are not executing
|
||||
|
|
|
@ -1041,7 +1041,7 @@ static int doAssignment(Variables &variables, const Token *tok, bool dereference
|
|||
if (scope == var1->_scope)
|
||||
replace = true;
|
||||
|
||||
// not in same scope as decelaration
|
||||
// not in same scope as declaration
|
||||
else
|
||||
{
|
||||
std::set<Scope *>::iterator assignment;
|
||||
|
@ -1070,7 +1070,7 @@ static int doAssignment(Variables &variables, const Token *tok, bool dereference
|
|||
// assignment in this scope
|
||||
else
|
||||
{
|
||||
// replace when only one other assingnment
|
||||
// replace when only one other assignment
|
||||
if (var1->_assignments.size() == 1)
|
||||
replace = true;
|
||||
|
||||
|
@ -1107,7 +1107,7 @@ static int doAssignment(Variables &variables, const Token *tok, bool dereference
|
|||
{
|
||||
if (var1->_type == Variables::pointer && !dereference)
|
||||
{
|
||||
// check if variable decelaration is in this scope
|
||||
// check if variable declaration is in this scope
|
||||
if (var1->_scope == scope)
|
||||
variables.clearAliases(varid1);
|
||||
else
|
||||
|
|
|
@ -115,7 +115,7 @@ void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer)
|
|||
else
|
||||
continue;
|
||||
|
||||
// funcname ( => Assert that the end paranthesis isn't followed by {
|
||||
// funcname ( => Assert that the end parenthesis isn't followed by {
|
||||
if (Token::Match(funcname, "%var% ("))
|
||||
{
|
||||
int parlevel = 0;
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
|
||||
/**
|
||||
* @brief Call all "getErrorMessages" in all registered Check classes.
|
||||
* Also print out xml header and footer.
|
||||
* Also print out XML header and footer.
|
||||
*/
|
||||
void getErrorMessages();
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ public:
|
|||
/**
|
||||
* Format the error message in XML format
|
||||
* @param verbose use verbose message
|
||||
* @param ver xml version
|
||||
* @param ver XML version
|
||||
*/
|
||||
std::string toXML(bool verbose, int ver) const;
|
||||
|
||||
|
@ -170,7 +170,7 @@ public:
|
|||
|
||||
private:
|
||||
/**
|
||||
* Replace all occurances of searchFor with replaceWith in the
|
||||
* Replace all occurrences of searchFor with replaceWith in the
|
||||
* given source.
|
||||
* @param source The string to modify
|
||||
* @param searchFor What should be searched for
|
||||
|
|
|
@ -225,7 +225,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
|
|||
{
|
||||
std::ostringstream errmsg;
|
||||
errmsg << "The code contains characters that are unhandled. "
|
||||
<< "Neither unicode nor extended ascii are supported. "
|
||||
<< "Neither unicode nor extended ASCII are supported. "
|
||||
<< "(line=" << lineno << ", character code=" << std::hex << (int(ch) & 0xff) << ")";
|
||||
writeError(filename, lineno, _errorLogger, "syntaxError", errmsg.str());
|
||||
}
|
||||
|
@ -1546,7 +1546,7 @@ void Preprocessor::handleIncludes(std::string &code,
|
|||
(headerType == SystemHeader && systemIncludes.find(tempFile) != systemIncludes.end()))
|
||||
{
|
||||
// We have processed this file already once, skip
|
||||
// it this time to avoid ethernal loop.
|
||||
// it this time to avoid eternal loop.
|
||||
fin.close();
|
||||
continue;
|
||||
}
|
||||
|
@ -1645,7 +1645,7 @@ static void skipstring(const std::string &line, std::string::size_type &pos)
|
|||
* @param pos in: Position to the '('. out: Position to the ')'
|
||||
* @param params out: The extracted parameters
|
||||
* @param numberOfNewlines out: number of newlines in the macro call
|
||||
* @param endFound out: was the end paranthesis found?
|
||||
* @param endFound out: was the end parenthesis found?
|
||||
*/
|
||||
static void getparams(const std::string &line,
|
||||
std::string::size_type &pos,
|
||||
|
@ -1663,7 +1663,7 @@ static void getparams(const std::string &line,
|
|||
if (line[pos] != '(')
|
||||
return;
|
||||
|
||||
// parantheses level
|
||||
// parentheses level
|
||||
int parlevel = 0;
|
||||
|
||||
// current parameter data
|
||||
|
@ -1672,7 +1672,7 @@ static void getparams(const std::string &line,
|
|||
// scan for parameters..
|
||||
for (; pos < line.length(); ++pos)
|
||||
{
|
||||
// increase paranthesis level
|
||||
// increase parenthesis level
|
||||
if (line[pos] == '(')
|
||||
{
|
||||
++parlevel;
|
||||
|
@ -1680,7 +1680,7 @@ static void getparams(const std::string &line,
|
|||
continue;
|
||||
}
|
||||
|
||||
// decrease paranthesis level
|
||||
// decrease parenthesis level
|
||||
else if (line[pos] == ')')
|
||||
{
|
||||
--parlevel;
|
||||
|
@ -1759,7 +1759,7 @@ private:
|
|||
/** prefix that is used by cppcheck to separate macro parameters. Always "__cppcheck__" */
|
||||
const std::string _prefix;
|
||||
|
||||
/** The macro has parantheses but no parameters.. "AAA()" */
|
||||
/** The macro has parentheses but no parameters.. "AAA()" */
|
||||
bool _nopar;
|
||||
|
||||
/** disabled assignment operator */
|
||||
|
@ -1892,7 +1892,7 @@ public:
|
|||
return _variadic;
|
||||
}
|
||||
|
||||
/** Check if this macro has parantheses but no parameters */
|
||||
/** Check if this macro has parentheses but no parameters */
|
||||
bool nopar() const
|
||||
{
|
||||
return _nopar;
|
||||
|
@ -2301,10 +2301,10 @@ std::string Preprocessor::expandMacros(const std::string &code, std::string file
|
|||
// number of newlines within macro use
|
||||
unsigned int numberOfNewlines = 0;
|
||||
|
||||
// if the macro has parantheses, get parameters
|
||||
// if the macro has parentheses, get parameters
|
||||
if (macro->variadic() || macro->nopar() || macro->params().size())
|
||||
{
|
||||
// is the end paranthesis found?
|
||||
// is the end parenthesis found?
|
||||
bool endFound = false;
|
||||
|
||||
getparams(line,pos2,params,numberOfNewlines,endFound);
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
* @param srcCodeStream The (file/string) stream to read from.
|
||||
* @param processedFile Give reference to empty string as a parameter,
|
||||
* function will fill processed file here. Use this also as a filedata parameter
|
||||
* to getcode() if you recieved more than once configurations.
|
||||
* to getcode() if you received more than once configurations.
|
||||
* @param resultConfigurations List of configurations. Pass these one by one
|
||||
* to getcode() with processedFile.
|
||||
* @param filename The name of the file to check e.g. "src/main.cpp"
|
||||
|
@ -147,9 +147,9 @@ protected:
|
|||
std::string removeComments(const std::string &str, const std::string &filename, Settings *settings);
|
||||
|
||||
/**
|
||||
* Remove redundant parantheses from preprocessor commands. This should only be called from read().
|
||||
* Remove redundant parentheses from preprocessor commands. This should only be called from read().
|
||||
* @param str Code processed by read().
|
||||
* @return code with reduced parantheses
|
||||
* @return code with reduced parentheses
|
||||
*/
|
||||
static std::string removeParantheses(const std::string &str);
|
||||
|
||||
|
|
|
@ -84,10 +84,10 @@ public:
|
|||
/** @brief Force checking the files with "too many" configurations (--force). */
|
||||
bool _force;
|
||||
|
||||
/** @brief write xml results (--xml) */
|
||||
/** @brief write XML results (--xml) */
|
||||
bool _xml;
|
||||
|
||||
/** @brief xml version (--xmlver=..) */
|
||||
/** @brief XML version (--xmlver=..) */
|
||||
int _xml_version;
|
||||
|
||||
/** @brief How many processes/threads should do checking at the same
|
||||
|
@ -174,7 +174,7 @@ public:
|
|||
/** @brief defines given by the user */
|
||||
std::string userDefines;
|
||||
|
||||
/** @brief Experimentat 2 pass checking of files */
|
||||
/** @brief Experimental 2 pass checking of files */
|
||||
bool test_2_pass;
|
||||
|
||||
/** @brief --report-progress */
|
||||
|
|
|
@ -388,7 +388,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
|||
if (func->type == SymbolDatabase::Func::Constructor)
|
||||
{
|
||||
// check for no arguments: func ( )
|
||||
/** @todo check for arguents with default values someday */
|
||||
/** @todo check for arguments with default values someday */
|
||||
if (func->argDef->next() == func->argDef->link())
|
||||
{
|
||||
hasDefaultConstructor = true;
|
||||
|
@ -397,7 +397,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
|||
}
|
||||
}
|
||||
|
||||
// User defined types with user defined defaut constructor doesn't need initialization.
|
||||
// User defined types with user defined default constructor doesn't need initialization.
|
||||
// We assume the default constructor initializes everything.
|
||||
// Another check will figure out if the constructor actually initializes everything.
|
||||
if (hasDefaultConstructor)
|
||||
|
@ -960,7 +960,7 @@ void SymbolDatabase::SpaceInfo::getVarList()
|
|||
}
|
||||
|
||||
// Borland C++: Skip all variables in the __published section.
|
||||
// These are automaticly initialized.
|
||||
// These are automatically initialized.
|
||||
else if (tok->str() == "__published:")
|
||||
{
|
||||
for (; tok; tok = tok->next())
|
||||
|
|
|
@ -250,12 +250,12 @@ void Tokenizer::createTokens(std::istream &code)
|
|||
std::string CurrentToken;
|
||||
|
||||
// lineNumbers holds line numbers for files in fileIndexes
|
||||
// every time an include file is complitely parsed, last item in the vector
|
||||
// every time an include file is completely parsed, last item in the vector
|
||||
// is removed and lineno is set to point to that value.
|
||||
std::vector<unsigned int> lineNumbers;
|
||||
|
||||
// fileIndexes holds index for _files vector about currently parsed files
|
||||
// every time an include file is complitely parsed, last item in the vector
|
||||
// every time an include file is completely parsed, last item in the vector
|
||||
// is removed and FileIndex is set to point to that value.
|
||||
std::vector<unsigned int> fileIndexes;
|
||||
|
||||
|
@ -1190,13 +1190,13 @@ void Tokenizer::simplifyTypedef()
|
|||
|
||||
if (simplifyType)
|
||||
{
|
||||
// There are 2 catagories of typedef substitutions:
|
||||
// There are 2 categories of typedef substitutions:
|
||||
// 1. variable declarations that preserve the variable name like
|
||||
// global, local, and function parameters
|
||||
// 2. not variable declarations that have no name like derived
|
||||
// classes, casts, operators, and template parameters
|
||||
|
||||
// try to determine which catagory this substitution is
|
||||
// try to determine which category this substitution is
|
||||
bool isDerived = false;
|
||||
bool inCast = false;
|
||||
bool inTemplate = false;
|
||||
|
@ -2172,7 +2172,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
|||
// Remove __builtin_expect, likely and unlikely
|
||||
simplifyBuiltinExpect();
|
||||
|
||||
// colapse compound standard types into a single token
|
||||
// collapse compound standard types into a single token
|
||||
// unsigned long long int => long _isUnsigned=true,_isLong=true
|
||||
simplifyStdType();
|
||||
|
||||
|
@ -2204,7 +2204,7 @@ bool Tokenizer::tokenize(std::istream &code,
|
|||
|
||||
simplifyVariableMultipleAssign();
|
||||
|
||||
// Remove redundant parantheses
|
||||
// Remove redundant parentheses
|
||||
simplifyRedundantParanthesis();
|
||||
|
||||
// Handle templates..
|
||||
|
@ -3329,7 +3329,7 @@ void Tokenizer::setVarId()
|
|||
// Found a class function..
|
||||
if (Token::Match(tok2, funcpattern.c_str()))
|
||||
{
|
||||
// Goto the end paranthesis..
|
||||
// Goto the end parenthesis..
|
||||
tok2 = tok2->tokAt(3)->link();
|
||||
if (!tok2)
|
||||
break;
|
||||
|
@ -4049,7 +4049,7 @@ bool Tokenizer::simplifyTokenList()
|
|||
modified |= simplifyCalculations();
|
||||
}
|
||||
|
||||
// Remove redundant parantheses in return..
|
||||
// Remove redundant parentheses in return..
|
||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||
{
|
||||
while (Token::simpleMatch(tok, "return ("))
|
||||
|
@ -5470,7 +5470,7 @@ void Tokenizer::simplifyIfAssign()
|
|||
if (isNot)
|
||||
tok->next()->deleteNext();
|
||||
|
||||
// Delete paranthesis.. and remember how many there are with
|
||||
// Delete parenthesis.. and remember how many there are with
|
||||
// their links.
|
||||
std::stack<Token *> braces;
|
||||
while (tok->next()->str() == "(")
|
||||
|
@ -6423,7 +6423,7 @@ bool Tokenizer::simplifyRedundantParanthesis()
|
|||
tok->link()->previous() == tok->next()->link())
|
||||
{
|
||||
// We have "(( *something* ))", remove the inner
|
||||
// paranthesis
|
||||
// parenthesis
|
||||
tok->deleteNext();
|
||||
tok->link()->tokAt(-2)->deleteNext();
|
||||
ret = true;
|
||||
|
@ -6433,7 +6433,7 @@ bool Tokenizer::simplifyRedundantParanthesis()
|
|||
tok->link()->previous() == tok->tokAt(2)->link())
|
||||
{
|
||||
// We have "( func ( *something* ))", remove the outer
|
||||
// paranthesis
|
||||
// parenthesis
|
||||
tok->link()->deleteThis();
|
||||
tok->deleteThis();
|
||||
ret = true;
|
||||
|
@ -6442,7 +6442,7 @@ bool Tokenizer::simplifyRedundantParanthesis()
|
|||
while (Token::Match(tok->previous(), "[;{] ( delete %var% ) ;"))
|
||||
{
|
||||
// We have "( delete var )", remove the outer
|
||||
// paranthesis
|
||||
// parenthesis
|
||||
tok->tokAt(3)->deleteThis();
|
||||
tok->deleteThis();
|
||||
ret = true;
|
||||
|
@ -6451,7 +6451,7 @@ bool Tokenizer::simplifyRedundantParanthesis()
|
|||
while (Token::Match(tok->previous(), "[;{] ( delete [ ] %var% ) ;"))
|
||||
{
|
||||
// We have "( delete [] var )", remove the outer
|
||||
// paranthesis
|
||||
// parenthesis
|
||||
tok->tokAt(5)->deleteThis();
|
||||
tok->deleteThis();
|
||||
ret = true;
|
||||
|
@ -6469,7 +6469,7 @@ bool Tokenizer::simplifyRedundantParanthesis()
|
|||
|
||||
if (Token::Match(tok->previous(), "[(!*;{}] ( %var% )") && tok->next()->varId() != 0)
|
||||
{
|
||||
// We have "( var )", remove the paranthesis
|
||||
// We have "( var )", remove the parenthesis
|
||||
tok->deleteThis();
|
||||
tok->deleteNext();
|
||||
ret = true;
|
||||
|
@ -6478,7 +6478,7 @@ bool Tokenizer::simplifyRedundantParanthesis()
|
|||
|
||||
if (Token::Match(tok->previous(), "[(!] ( %var% . %var% )"))
|
||||
{
|
||||
// We have "( var . var )", remove the paranthesis
|
||||
// We have "( var . var )", remove the parenthesis
|
||||
tok->deleteThis();
|
||||
tok = tok->tokAt(2);
|
||||
tok->deleteNext();
|
||||
|
@ -6539,11 +6539,11 @@ bool Tokenizer::simplifyCalculations()
|
|||
bool ret = false;
|
||||
for (Token *tok = _tokens; tok; tok = tok->next())
|
||||
{
|
||||
// Remove parantheses around variable..
|
||||
// keep parantheses here: dynamic_cast<Fred *>(p);
|
||||
// keep parantheses here: A operator * (int);
|
||||
// keep parantheses here: operator new [] (size_t);
|
||||
// keep parantheses here: Functor()(a ... )
|
||||
// Remove parentheses around variable..
|
||||
// keep parentheses here: dynamic_cast<Fred *>(p);
|
||||
// keep parentheses here: A operator * (int);
|
||||
// keep parentheses here: operator new [] (size_t);
|
||||
// keep parentheses here: Functor()(a ... )
|
||||
if (Token::Match(tok->next(), "( %var% ) [;),+-*/><]]") &&
|
||||
!tok->isName() &&
|
||||
tok->str() != ">" &&
|
||||
|
@ -6601,7 +6601,7 @@ bool Tokenizer::simplifyCalculations()
|
|||
ret = true;
|
||||
}
|
||||
|
||||
// Remove parantheses around number..
|
||||
// Remove parentheses around number..
|
||||
if (Token::Match(tok->tokAt(-2), "%any% ( %num% )") && !tok->tokAt(-2)->isName())
|
||||
{
|
||||
tok = tok->previous();
|
||||
|
|
|
@ -175,7 +175,7 @@ public:
|
|||
Token * initVar(Token * tok);
|
||||
|
||||
/**
|
||||
* Colapse compound standard types into a single token.
|
||||
* Collapse compound standard types into a single token.
|
||||
* unsigned long long int => long _isUnsigned=true,_isLong=true
|
||||
*/
|
||||
void simplifyStdType();
|
||||
|
@ -201,7 +201,7 @@ public:
|
|||
void simplifyIfAssign();
|
||||
|
||||
/**
|
||||
* Simplify multiple assignmetns.
|
||||
* Simplify multiple assignments.
|
||||
* Example: "a = b = c = 0;" => "a = 0; b = 0; c = 0;"
|
||||
*/
|
||||
void simplifyVariableMultipleAssign();
|
||||
|
@ -294,7 +294,7 @@ public:
|
|||
*/
|
||||
bool simplifyConditions();
|
||||
|
||||
/** Remove reduntant code, e.g. if( false ) { int a; } should be
|
||||
/** Remove redundant code, e.g. if( false ) { int a; } should be
|
||||
* removed, because it is never executed.
|
||||
* @return true if something is modified
|
||||
* false if nothing is done.
|
||||
|
@ -322,7 +322,7 @@ public:
|
|||
void simplifyStructDecl();
|
||||
|
||||
/**
|
||||
* Remove redundant paranthesis:
|
||||
* Remove redundant parenthesis:
|
||||
* - "((x))" => "(x)"
|
||||
* - "(function())" => "function()"
|
||||
* - "(delete x)" => "delete x"
|
||||
|
|
|
@ -294,7 +294,7 @@ files, this is not needed.</para>
|
|||
<varlistentry>
|
||||
<term><option>--xml</option></term>
|
||||
<listitem>
|
||||
<para>Write results in xml to error stream</para>
|
||||
<para>Write results in XML to error stream</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
|
|
@ -396,7 +396,7 @@ uninitvar</programlisting>
|
|||
some tweaking you can improve the checking.</para>
|
||||
|
||||
<section>
|
||||
<title>User defined allocation/deallocation functions</title>
|
||||
<title>User-defined allocation/deallocation functions</title>
|
||||
|
||||
<para><literal>Cppcheck</literal> understands many common allocation and
|
||||
deallocation functions. But not all.</para>
|
||||
|
|
|
@ -26,7 +26,7 @@ Compiling
|
|||
|
||||
qmake
|
||||
=====
|
||||
You can use the gui/gui.pro file to build the gui.
|
||||
You can use the gui/gui.pro file to build the GUI.
|
||||
cd gui
|
||||
qmake
|
||||
make
|
||||
|
|
|
@ -18,7 +18,7 @@ tools, libraries or headers so you cannot compile 64-bit binaries without
|
|||
Windows SDK.
|
||||
|
||||
To compile 64-bit binaries you need to start VS Express to 64-bit environment.
|
||||
(by default VS Express starts to 32-bit enviroment). To do this, open Windows
|
||||
(by default VS Express starts to 32-bit environment). To do this, open Windows
|
||||
SDK Command Prompt and switch to 64-bit environment with command:
|
||||
> setenv /x64 /debug
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// this test needs an assignment test but doesnt have it
|
||||
// this test needs an assignment test but doesn’t have it
|
||||
checkOpertorEqToSelf(
|
||||
"class A\n"
|
||||
"{\n"
|
||||
|
@ -1816,7 +1816,7 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:11]: (warning) Member variable not initialized in the constructor 'Foo::mMember'\n", errout.str());
|
||||
|
||||
// constructor in seperate namespace
|
||||
// constructor in separate namespace
|
||||
checkUninitVar("namespace Output\n"
|
||||
"{\n"
|
||||
" class Foo\n"
|
||||
|
@ -1835,7 +1835,7 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:13]: (warning) Member variable not initialized in the constructor 'Foo::mMember'\n", errout.str());
|
||||
|
||||
// constructor in different seperate namespace
|
||||
// constructor in different separate namespace
|
||||
checkUninitVar("namespace Output\n"
|
||||
"{\n"
|
||||
" class Foo\n"
|
||||
|
@ -1854,7 +1854,7 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// constructor in different seperate namespace (won't compile)
|
||||
// constructor in different separate namespace (won't compile)
|
||||
checkUninitVar("namespace Output\n"
|
||||
"{\n"
|
||||
" class Foo\n"
|
||||
|
@ -1873,7 +1873,7 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// constructor in nested seperate namespace
|
||||
// constructor in nested separate namespace
|
||||
checkUninitVar("namespace A\n"
|
||||
"{\n"
|
||||
" namespace Output\n"
|
||||
|
@ -1895,7 +1895,7 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:15]: (warning) Member variable not initialized in the constructor 'Foo::mMember'\n", errout.str());
|
||||
|
||||
// constructor in nested different seperate namespace
|
||||
// constructor in nested different separate namespace
|
||||
checkUninitVar("namespace A\n"
|
||||
"{\n"
|
||||
" namespace Output\n"
|
||||
|
@ -1917,7 +1917,7 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// constructor in nested different seperate namespace
|
||||
// constructor in nested different separate namespace
|
||||
checkUninitVar("namespace A\n"
|
||||
"{\n"
|
||||
" namespace Output\n"
|
||||
|
@ -2467,7 +2467,7 @@ private:
|
|||
ASSERT_EQUALS("[fred.h:6]: (warning) Member variable not initialized in the constructor 'Fred::i'\n", errout.str());
|
||||
}
|
||||
|
||||
// Borland C++: No FP for published pointers - they are automaticly initialized
|
||||
// Borland C++: No FP for published pointers - they are automatically initialized
|
||||
void uninitVarPublished()
|
||||
{
|
||||
checkUninitVar("class Fred\n"
|
||||
|
@ -3264,7 +3264,7 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:3]: (style) The function 'Fred::foo' can be const\n"
|
||||
"[test.cpp:7] -> [test.cpp:4]: (style) The function 'Fred::foo' can be const\n", errout.str());
|
||||
|
||||
// check functions with different or missing paramater names
|
||||
// check functions with different or missing parameter names
|
||||
checkConst("class Fred {\n"
|
||||
" std::string s;\n"
|
||||
" void foo1(int, int);\n"
|
||||
|
|
|
@ -189,7 +189,7 @@ private:
|
|||
{
|
||||
TiXmlDocument doc;
|
||||
doc.Parse(xmlData);
|
||||
// parsing must be successfull
|
||||
// parsing must be successful
|
||||
ASSERT_EQUALS(false, doc.Error());
|
||||
// root element must be "results"
|
||||
TiXmlElement* root = doc.FirstChildElement();
|
||||
|
|
|
@ -197,19 +197,19 @@ private:
|
|||
ASSERT_EQUALS(false, MathLib::isInt("-1.E+1"));
|
||||
ASSERT_EQUALS(false, MathLib::isInt("+1.E-1"));
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" 1.0E+1"));
|
||||
// with whitspaces in front
|
||||
// with whitespace in front
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" 1.0E-1"));
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" -1.0E+1"));
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" +1.0E-1"));
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" -1.E+1"));
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" +1.E-1"));
|
||||
// with whitspaces in front and end
|
||||
// with whitespace in front and end
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" 1.0E-1 "));
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" -1.0E+1 "));
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" +1.0E-1 "));
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" -1.E+1 "));
|
||||
ASSERT_EQUALS(false, MathLib::isInt(" +1.E-1 "));
|
||||
// with whitspaces in front and end
|
||||
// with whitespace in front and end
|
||||
ASSERT_EQUALS(false, MathLib::isInt("1.0E-1 "));
|
||||
ASSERT_EQUALS(false, MathLib::isInt("-1.0E+1 "));
|
||||
ASSERT_EQUALS(false, MathLib::isInt("+1.0E-1 "));
|
||||
|
|
|
@ -2022,7 +2022,7 @@ private:
|
|||
Settings settings;
|
||||
Preprocessor preprocessor(&settings, this);
|
||||
preprocessor.read(istr, "test.cpp", 0);
|
||||
ASSERT_EQUALS("[test.cpp:1]: (error) The code contains characters that are unhandled. Neither unicode nor extended ascii are supported. (line=1, character code=c8)\n", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:1]: (error) The code contains characters that are unhandled. Neither Unicode nor extended ASCII are supported. (line=1, character code=c8)\n", errout.str());
|
||||
}
|
||||
|
||||
void unicodeInComment()
|
||||
|
|
|
@ -51,7 +51,7 @@ private:
|
|||
TEST_CASE(double_plus);
|
||||
TEST_CASE(redundant_plus);
|
||||
TEST_CASE(parantheses1);
|
||||
TEST_CASE(paranthesesVar); // Remove redundant parantheses around variable .. "( %var% )"
|
||||
TEST_CASE(paranthesesVar); // Remove redundant parentheses around variable .. "( %var% )"
|
||||
TEST_CASE(declareVar);
|
||||
|
||||
TEST_CASE(declareArray);
|
||||
|
@ -607,7 +607,7 @@ private:
|
|||
|
||||
void paranthesesVar()
|
||||
{
|
||||
// remove parantheses..
|
||||
// remove parentheses..
|
||||
ASSERT_EQUALS("= p ;", tok("= (p);"));
|
||||
ASSERT_EQUALS("if ( a < p ) { }", tok("if(a<(p)){}"));
|
||||
ASSERT_EQUALS("void f ( ) { int p ; if ( p == -1 ) { } }", tok("void f(){int p; if((p)==-1){}}"));
|
||||
|
@ -622,7 +622,7 @@ private:
|
|||
ASSERT_EQUALS("void f ( ) { int * p ; * p = 1 ; }", tok("void f(){int *p; *(p) = 1;}"));
|
||||
ASSERT_EQUALS("void f ( ) { int p ; if ( p ) { } p = 1 ; }", tok("void f(){int p; if ( p ) { } (p) = 1;}"));
|
||||
|
||||
// keep parantheses..
|
||||
// keep parentheses..
|
||||
ASSERT_EQUALS("= a ;", tok("= (char)a;"));
|
||||
ASSERT_EQUALS("cast < char * > ( p )", tok("cast<char *>(p)"));
|
||||
ASSERT_EQUALS("return ( a + b ) * c ;", tok("return (a+b)*c;"));
|
||||
|
@ -2842,7 +2842,7 @@ private:
|
|||
ASSERT_EQUALS("\"\\\\x61\"", tok("\"\\\\x61\""));
|
||||
|
||||
// These tests can fail, if other characters are handled
|
||||
// more correctly. But fow now all non null characters should
|
||||
// more correctly. But for now all non null characters should
|
||||
// become 'a'
|
||||
ASSERT_EQUALS("\"a\"", tok("\"\\x62\""));
|
||||
ASSERT_EQUALS("\"a\"", tok("\"\\177\""));
|
||||
|
|
|
@ -51,7 +51,7 @@ protected:
|
|||
void assertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual, const std::string &msg = "");
|
||||
|
||||
// the vars expected and actual need to be of type double, in order to avoid overflow of unsigned int
|
||||
// e.g: ASSERT_EQUALS(-100.0, MathLib::toDoubleNumber("-1.0E+2")); whould not work without this.
|
||||
// e.g: ASSERT_EQUALS(-100.0, MathLib::toDoubleNumber("-1.0E+2")); would not work without this.
|
||||
void assertEquals(const char *filename, int linenr, double expected, double actual, const std::string &msg="");
|
||||
|
||||
void todoAssertEquals(const char *filename, int linenr, const std::string &expected, const std::string &actual);
|
||||
|
|
|
@ -145,7 +145,7 @@ private:
|
|||
TEST_CASE(varid14);
|
||||
TEST_CASE(varid15);
|
||||
TEST_CASE(varid16);
|
||||
TEST_CASE(varid17); // ticket #1810
|
||||
TEST_CASE(varid17); // ticket #1810
|
||||
TEST_CASE(varid18);
|
||||
TEST_CASE(varid19);
|
||||
TEST_CASE(varid20);
|
||||
|
@ -154,8 +154,8 @@ private:
|
|||
TEST_CASE(varid23);
|
||||
TEST_CASE(varid24);
|
||||
TEST_CASE(varid25);
|
||||
TEST_CASE(varid26); // ticket #1967 (list of function pointers)
|
||||
TEST_CASE(varid27); // Ticket #2280 (same name for namespace and variable)
|
||||
TEST_CASE(varid26); // ticket #1967 (list of function pointers)
|
||||
TEST_CASE(varid27); // Ticket #2280 (same name for namespace and variable)
|
||||
TEST_CASE(varidFunctionCall1);
|
||||
TEST_CASE(varidFunctionCall2);
|
||||
TEST_CASE(varidStl);
|
||||
|
@ -509,7 +509,7 @@ private:
|
|||
|
||||
|
||||
|
||||
// Dont remove "(int *)"..
|
||||
// Don’t remove "(int *)"..
|
||||
void removeCast1()
|
||||
{
|
||||
const char code[] = "int *f(int *);";
|
||||
|
|
Loading…
Reference in New Issue