Updated to AStyle 2.03, require this version

This commit is contained in:
PKEuS 2013-08-07 16:27:37 +02:00
parent dd82817752
commit a9a5dc0354
76 changed files with 4005 additions and 4005 deletions

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,7 @@ static void unencode(const char *src, char *dest)
*dest = '\0';
}
int readdata(char * * const data, int sz)
int readdata(char ** const data, int sz)
{
FILE *f = fopen("data.txt", "rt");
if (!f)
@ -88,7 +88,7 @@ int getversion(const char *data)
return ret;
}
void sortdata(char * * const data, int sz)
void sortdata(char ** const data, int sz)
{
for (int i = 1; i < sz && data[i]; i++) {
if (strcmp(data[i-1], data[i]) > 0) {

View File

@ -43,8 +43,8 @@ public:
/** This constructor is used when running checks. */
Check(const std::string &aname, const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: _tokenizer(tokenizer), _settings(settings), _errorLogger(errorLogger), _name(aname)
{ }
: _tokenizer(tokenizer), _settings(settings), _errorLogger(errorLogger), _name(aname) {
}
virtual ~Check() {
#if !defined(DJGPP) && !defined(__sun)
@ -79,8 +79,8 @@ public:
}
/** run checks, the token list is not simplified */
virtual void runChecks(const Tokenizer *, const Settings *, ErrorLogger *)
{ }
virtual void runChecks(const Tokenizer *, const Settings *, ErrorLogger *) {
}
/** run checks, the token list is simplified */
virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) = 0;

View File

@ -34,12 +34,12 @@
class CPPCHECKLIB CheckAssert : public Check {
public:
CheckAssert() : Check(myName())
{}
CheckAssert() : Check(myName()) {
}
CheckAssert(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{}
: Check(myName(), tokenizer, settings, errorLogger) {
}
virtual void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
CheckAssert check(tokenizer, settings, errorLogger);

View File

@ -40,21 +40,21 @@ bool CheckAutoVariables::isPtrArg(const Token *tok)
{
const Variable *var = tok->variable();
return(var && var->isArgument() && var->isPointer());
return (var && var->isArgument() && var->isPointer());
}
bool CheckAutoVariables::isRefPtrArg(const Token *tok)
{
const Variable *var = tok->variable();
return(var && var->isArgument() && var->isReference() && var->isPointer());
return (var && var->isArgument() && var->isReference() && var->isPointer());
}
bool CheckAutoVariables::isNonReferenceArg(const Token *tok)
{
const Variable *var = tok->variable();
return(var && var->isArgument() && !var->isReference() && (var->isPointer() || var->typeStartToken()->isStandardType() || var->type()));
return (var && var->isArgument() && !var->isReference() && (var->isPointer() || var->typeStartToken()->isStandardType() || var->type()));
}
bool CheckAutoVariables::isAutoVar(const Token *tok)
@ -96,7 +96,7 @@ static bool checkRvalueExpression(const Token * const vartok)
return var2 && !var2->isPointer();
}
return((next->str() != "." || (!var->isPointer() && (!var->isClass() || var->type()))) && next->strAt(2) != ".");
return ((next->str() != "." || (!var->isPointer() && (!var->isClass() || var->type()))) && next->strAt(2) != ".");
}
static bool variableIsUsedInScope(const Token* start, unsigned int varId, const Scope *scope)

View File

@ -33,13 +33,13 @@
class CPPCHECKLIB CheckAutoVariables : public Check {
public:
/** This constructor is used when registering the CheckClass */
CheckAutoVariables() : Check(myName())
{ }
CheckAutoVariables() : Check(myName()) {
}
/** This constructor is used when running checks. */
CheckAutoVariables(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -111,11 +111,11 @@ void CheckBool::bitwiseOnBooleanError(const Token *tok, const std::string &varna
static bool isBool(const Variable* var)
{
return(var && var->typeEndToken()->str() == "bool");
return (var && var->typeEndToken()->str() == "bool");
}
static bool isNonBoolStdType(const Variable* var)
{
return(var && var->typeEndToken()->isStandardType() && var->typeEndToken()->str() != "bool");
return (var && var->typeEndToken()->isStandardType() && var->typeEndToken()->str() != "bool");
}
void CheckBool::checkComparisonOfBoolWithInt()
{

View File

@ -39,13 +39,13 @@ class Variable;
class CPPCHECKLIB CheckBool : public Check {
public:
/** @brief This constructor is used when registering the CheckClass */
CheckBool() : Check(myName())
{ }
CheckBool() : Check(myName()) {
}
/** @brief This constructor is used when running checks. */
CheckBool(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -35,13 +35,13 @@ class Token;
class CPPCHECKLIB CheckBoost : public Check {
public:
/** This constructor is used when registering the CheckClass */
CheckBoost() : Check(myName())
{ }
CheckBoost() : Check(myName()) {
}
/** This constructor is used when running checks. */
CheckBoost(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** Simplified checks. The token list is simplified. */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -51,13 +51,13 @@ class CPPCHECKLIB CheckBufferOverrun : public Check {
public:
/** This constructor is used when registering the CheckClass */
CheckBufferOverrun() : Check(myName())
{ }
CheckBufferOverrun() : Check(myName()) {
}
/** This constructor is used when running checks. */
CheckBufferOverrun(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
CheckBufferOverrun checkBufferOverrun(tokenizer, settings, errorLogger);

View File

@ -1694,7 +1694,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
continue;
if (tok1->str() == "this" && tok1->previous()->isAssignmentOp())
return(false);
return (false);
const Token* jumpBackToken = 0;
const Token *lastVarTok = tok1;
@ -1709,7 +1709,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
const Variable *var = end->variable();
if (var && Token::simpleMatch(var->typeStartToken(), "std :: map")) // operator[] changes a map
return(false);
return (false);
}
if (!jumpBackToken)
jumpBackToken = end->next(); // Check inside the [] brackets
@ -1723,27 +1723,27 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
if (end->strAt(1) == "(") {
const Variable *var = lastVarTok->variable();
if (!var)
return(false);
return (false);
if (Token::simpleMatch(var->typeStartToken(), "std ::") // assume all std::*::size() and std::*::empty() are const
&& (Token::Match(end, "size|empty|cend|crend|cbegin|crbegin|max_size|length|count|capacity|get_allocator|c_str|str ( )") || Token::Match(end, "rfind|copy")))
;
else if (!var->typeScope() || !isConstMemberFunc(var->typeScope(), end))
return(false);
return (false);
}
// Assignment
else if (end->next()->type() == Token::eAssignmentOp)
return(false);
return (false);
// Streaming
else if (end->strAt(1) == "<<" && tok1->strAt(-1) != "<<")
return(false);
return (false);
else if (tok1->strAt(-1) == ">>")
return(false);
return (false);
// ++/--
else if (end->next()->type() == Token::eIncDecOp || tok1->previous()->type() == Token::eIncDecOp)
return(false);
return (false);
const Token* start = tok1;
@ -1751,7 +1751,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
tok1 = tok1->linkAt(-1);
if (start->strAt(-1) == "delete")
return(false);
return (false);
tok1 = jumpBackToken?jumpBackToken:end; // Jump back to first [ to check inside, or jump to end of expression
}
@ -1761,7 +1761,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
isMemberVar(scope, tok1->tokAt(-2))) {
const Variable* var = tok1->tokAt(-2)->variable();
if (!var || !var->isMutable())
return(false);
return (false);
}
@ -1770,7 +1770,7 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
!Token::Match(tok1, "return|if|string|switch|while|catch|for")) {
if (isMemberFunc(scope, tok1) && tok1->strAt(-1) != ".") {
if (!isConstMemberFunc(scope, tok1))
return(false);
return (false);
memberAccessed = true;
}
// Member variable given as parameter
@ -1780,15 +1780,15 @@ bool CheckClass::checkConstFunc(const Scope *scope, const Function *func, bool&
else if (tok2->isName() && isMemberVar(scope, tok2)) {
const Variable* var = tok2->variable();
if (!var || !var->isMutable())
return(false); // TODO: Only bailout if function takes argument as non-const reference
return (false); // TODO: Only bailout if function takes argument as non-const reference
}
}
} else if (Token::simpleMatch(tok1, "> (") && (!tok1->link() || !Token::Match(tok1->link()->previous(), "static_cast|const_cast|dynamic_cast|reinterpret_cast"))) {
return(false);
return (false);
}
}
return(true);
return (true);
}
void CheckClass::checkConstError(const Token *tok, const std::string &classname, const std::string &funcname, bool suggestStatic)

View File

@ -36,8 +36,8 @@ class Function;
class CPPCHECKLIB CheckClass : public Check {
public:
/** @brief This constructor is used when registering the CheckClass */
CheckClass() : Check(myName()), symbolDatabase(NULL)
{ }
CheckClass() : Check(myName()), symbolDatabase(NULL) {
}
/** @brief This constructor is used when running checks. */
CheckClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger);

View File

@ -43,13 +43,13 @@ class Token;
class CPPCHECKLIB CheckExceptionSafety : public Check {
public:
/** This constructor is used when registering the CheckClass */
CheckExceptionSafety() : Check(myName())
{ }
CheckExceptionSafety() : Check(myName()) {
}
/** This constructor is used when running checks. */
CheckExceptionSafety(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** Checks that uses the simplified token list */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -35,13 +35,13 @@ class Token;
class CPPCHECKLIB CheckInternal : public Check {
public:
/** This constructor is used when registering the CheckClass */
CheckInternal() : Check(myName())
{ }
CheckInternal() : Check(myName()) {
}
/** This constructor is used when running checks. */
CheckInternal(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** Simplified checks. The token list is simplified. */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -406,7 +406,7 @@ void CheckIO::invalidScanfError(const Token *tok, bool portability)
static bool isComplexType(const Variable* var, const Token* varTypeTok)
{
if (var->type())
return(true);
return (true);
static std::set<std::string> knownTypes;
if (knownTypes.empty()) {
@ -417,12 +417,12 @@ static bool isComplexType(const Variable* var, const Token* varTypeTok)
if (varTypeTok->str() == "std")
varTypeTok = varTypeTok->tokAt(2);
return((knownTypes.find(varTypeTok->str()) != knownTypes.end() || (varTypeTok->strAt(1) == "<" && varTypeTok->linkAt(1) && varTypeTok->linkAt(1)->strAt(1) != "::")) && !var->isPointer() && !var->isArray());
return ((knownTypes.find(varTypeTok->str()) != knownTypes.end() || (varTypeTok->strAt(1) == "<" && varTypeTok->linkAt(1) && varTypeTok->linkAt(1)->strAt(1) != "::")) && !var->isPointer() && !var->isArray());
}
static bool isKnownType(const Variable* var, const Token* varTypeTok)
{
return(varTypeTok->isStandardType() || varTypeTok->next()->isStandardType() || isComplexType(var, varTypeTok));
return (varTypeTok->isStandardType() || varTypeTok->next()->isStandardType() || isComplexType(var, varTypeTok));
}
void CheckIO::checkWrongPrintfScanfArguments()

View File

@ -33,13 +33,13 @@ class Variable;
class CPPCHECKLIB CheckIO : public Check {
public:
/** @brief This constructor is used when registering CheckIO */
CheckIO() : Check(myName())
{ }
CheckIO() : Check(myName()) {
}
/** @brief This constructor is used when running checks. */
CheckIO(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** @brief Run checks on the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -184,8 +184,8 @@ public:
class CPPCHECKLIB CheckMemoryLeakInFunction : private Check, public CheckMemoryLeak {
public:
/** @brief This constructor is used when registering this class */
CheckMemoryLeakInFunction() : Check(myName()), CheckMemoryLeak(0, 0, 0), symbolDatabase(NULL)
{ }
CheckMemoryLeakInFunction() : Check(myName()), CheckMemoryLeak(0, 0, 0), symbolDatabase(NULL) {
}
/** @brief This constructor is used when running checks */
CheckMemoryLeakInFunction(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)
@ -350,12 +350,12 @@ private:
class CPPCHECKLIB CheckMemoryLeakInClass : private Check, private CheckMemoryLeak {
public:
CheckMemoryLeakInClass() : Check(myName()), CheckMemoryLeak(0, 0, 0)
{ }
CheckMemoryLeakInClass() : Check(myName()), CheckMemoryLeak(0, 0, 0) {
}
CheckMemoryLeakInClass(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)
: Check(myName(), tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog, settings)
{ }
: Check(myName(), tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog, settings) {
}
void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) {
if (!tokenizr->isCPP())
@ -397,12 +397,12 @@ private:
class CPPCHECKLIB CheckMemoryLeakStructMember : private Check, private CheckMemoryLeak {
public:
CheckMemoryLeakStructMember() : Check(myName()), CheckMemoryLeak(0, 0, 0)
{ }
CheckMemoryLeakStructMember() : Check(myName()), CheckMemoryLeak(0, 0, 0) {
}
CheckMemoryLeakStructMember(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)
: Check(myName(), tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog, settings)
{ }
: Check(myName(), tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog, settings) {
}
void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) {
CheckMemoryLeakStructMember checkMemoryLeak(tokenizr, settings, errLog);
@ -418,8 +418,8 @@ private:
void checkStructVariable(const Variable * const variable);
void getErrorMessages(ErrorLogger * /*errorLogger*/, const Settings * /*settings*/) const
{ }
void getErrorMessages(ErrorLogger * /*errorLogger*/, const Settings * /*settings*/) const {
}
static std::string myName() {
return "Memory leaks (struct members)";
@ -436,12 +436,12 @@ private:
class CPPCHECKLIB CheckMemoryLeakNoVar : private Check, private CheckMemoryLeak {
public:
CheckMemoryLeakNoVar() : Check(myName()), CheckMemoryLeak(0, 0, 0)
{ }
CheckMemoryLeakNoVar() : Check(myName()), CheckMemoryLeak(0, 0, 0) {
}
CheckMemoryLeakNoVar(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)
: Check(myName(), tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog, settings)
{ }
: Check(myName(), tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog, settings) {
}
void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog) {
CheckMemoryLeakNoVar checkMemoryLeak(tokenizr, settings, errLog);

View File

@ -38,13 +38,13 @@ class SymbolDatabase;
class CPPCHECKLIB CheckNullPointer : public Check {
public:
/** @brief This constructor is used when registering the CheckNullPointer */
CheckNullPointer() : Check(myName())
{ }
CheckNullPointer() : Check(myName()) {
}
/** @brief This constructor is used when running checks. */
CheckNullPointer(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -1634,11 +1634,11 @@ void CheckOther::unreachableCodeError(const Token *tok, bool inconclusive)
//---------------------------------------------------------------------------
bool CheckOther::isUnsigned(const Variable* var) const
{
return(var && var->typeStartToken()->isUnsigned() && !var->isPointer() && !var->isArray() && _tokenizer->sizeOfType(var->typeStartToken()) >= _settings->sizeof_int);
return (var && var->typeStartToken()->isUnsigned() && !var->isPointer() && !var->isArray() && _tokenizer->sizeOfType(var->typeStartToken()) >= _settings->sizeof_int);
}
bool CheckOther::isSigned(const Variable* var)
{
return(var && !var->typeStartToken()->isUnsigned() && Token::Match(var->typeEndToken(), "int|char|short|long") && !var->isPointer() && !var->isArray());
return (var && !var->typeStartToken()->isUnsigned() && Token::Match(var->typeEndToken(), "int|char|short|long") && !var->isPointer() && !var->isArray());
}
void CheckOther::checkUnsignedDivision()
@ -1960,12 +1960,12 @@ void CheckOther::passedByValueError(const Token *tok, const std::string &parname
//---------------------------------------------------------------------------
static bool isChar(const Variable* var)
{
return(var && !var->isPointer() && !var->isArray() && var->typeStartToken()->str() == "char");
return (var && !var->isPointer() && !var->isArray() && var->typeStartToken()->str() == "char");
}
static bool isSignedChar(const Variable* var)
{
return(isChar(var) && !var->typeStartToken()->isUnsigned());
return (isChar(var) && !var->typeStartToken()->isUnsigned());
}
void CheckOther::checkCharVariable()

View File

@ -39,13 +39,13 @@ class Variable;
class CPPCHECKLIB CheckOther : public Check {
public:
/** @brief This constructor is used when registering the CheckClass */
CheckOther() : Check(myName())
{ }
CheckOther() : Check(myName()) {
}
/** @brief This constructor is used when running checks. */
CheckOther(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -35,13 +35,13 @@
class CPPCHECKLIB CheckPostfixOperator : public Check {
public:
/** This constructor is used when registering the CheckPostfixOperator */
CheckPostfixOperator() : Check(myName())
{ }
CheckPostfixOperator() : Check(myName()) {
}
/** This constructor is used when running checks. */
CheckPostfixOperator(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {
if (tokenizer->isC())

View File

@ -39,13 +39,13 @@ class Variable;
class CPPCHECKLIB CheckSizeof : public Check {
public:
/** @brief This constructor is used when registering the CheckClass */
CheckSizeof() : Check(myName())
{ }
CheckSizeof() : Check(myName()) {
}
/** @brief This constructor is used when running checks. */
CheckSizeof(const Tokenizer* tokenizer, const Settings* settings, ErrorLogger* errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer* tokenizer, const Settings* settings, ErrorLogger* errorLogger) {

View File

@ -35,13 +35,13 @@ class Token;
class CPPCHECKLIB CheckStl : public Check {
public:
/** This constructor is used when registering the CheckClass */
CheckStl() : Check(myName())
{ }
CheckStl() : Check(myName()) {
}
/** This constructor is used when running checks. */
CheckStl(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** Simplified checks. The token list is simplified. */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -39,13 +39,13 @@ class Variable;
class CPPCHECKLIB CheckUninitVar : public Check {
public:
/** @brief This constructor is used when registering the CheckUninitVar */
CheckUninitVar() : Check(myName()), testrunner(false)
{ }
CheckUninitVar() : Check(myName()), testrunner(false) {
}
/** @brief This constructor is used when running checks. */
CheckUninitVar(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger), testrunner(false)
{ }
: Check(myName(), tokenizer, settings, errorLogger), testrunner(false) {
}
/** @brief Run checks against the simplified token list */
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -33,13 +33,13 @@
class CPPCHECKLIB CheckUnusedFunctions: public Check {
public:
/** @brief This constructor is used when registering the CheckUnusedFunctions */
CheckUnusedFunctions() : Check(myName())
{ }
CheckUnusedFunctions() : Check(myName()) {
}
/** @brief This constructor is used when running checks. */
CheckUnusedFunctions(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
// Parse current tokens and determine..
// * Check what functions are used
@ -79,8 +79,8 @@ private:
class CPPCHECKLIB FunctionUsage {
public:
FunctionUsage() : lineNumber(0), usedSameFile(false), usedOtherFile(false)
{ }
FunctionUsage() : lineNumber(0), usedSameFile(false), usedOtherFile(false) {
}
std::string filename;
unsigned int lineNumber;

View File

@ -625,9 +625,9 @@ static bool isPartOfClassStructUnion(const Token* tok)
if (tok->str() == "}" || tok->str() == ")")
tok = tok->link();
else if (tok->str() == "(")
return(false);
return (false);
else if (tok->str() == "{") {
return(tok->strAt(-1) == "struct" || tok->strAt(-2) == "struct" || tok->strAt(-1) == "class" || tok->strAt(-2) == "class" || tok->strAt(-1) == "union" || tok->strAt(-2) == "union");
return (tok->strAt(-1) == "struct" || tok->strAt(-2) == "struct" || tok->strAt(-1) == "class" || tok->strAt(-2) == "class" || tok->strAt(-1) == "union" || tok->strAt(-2) == "union");
}
}
return false;

View File

@ -42,13 +42,13 @@ class Variables;
class CPPCHECKLIB CheckUnusedVar : public Check {
public:
/** @brief This constructor is used when registering the CheckClass */
CheckUnusedVar() : Check(myName())
{ }
CheckUnusedVar() : Check(myName()) {
}
/** @brief This constructor is used when running checks. */
CheckUnusedVar(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(myName(), tokenizer, settings, errorLogger)
{ }
: Check(myName(), tokenizer, settings, errorLogger) {
}
/** @brief Run checks against the normal token list */
void runChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) {

View File

@ -42,11 +42,11 @@ protected:
virtual bool is_equal(const ExecutionPath *) const = 0;
public:
ExecutionPath(Check *c, unsigned int id) : owner(c), numberOfIf(0), varId(id)
{ }
ExecutionPath(Check *c, unsigned int id) : owner(c), numberOfIf(0), varId(id) {
}
virtual ~ExecutionPath()
{ }
virtual ~ExecutionPath() {
}
/** Implement this in each derived class. This function must create a copy of the current instance */
virtual ExecutionPath *copy() = 0;
@ -117,8 +117,8 @@ public:
}
/** going out of scope - all execution paths end */
virtual void end(const std::list<ExecutionPath *> & /*checks*/, const Token * /*tok*/) const
{ }
virtual void end(const std::list<ExecutionPath *> & /*checks*/, const Token * /*tok*/) const {
}
bool operator==(const ExecutionPath &e) const {
return bool(varId == e.varId && is_equal(&e));

View File

@ -114,8 +114,8 @@ bool MathLib::isFloat(const std::string &s)
if (s.find("." , 0) != std::string::npos)
return true;
// scientific notation
return(s.find("E-", 0) != std::string::npos
|| s.find("e-", 0) != std::string::npos);
return (s.find("E-", 0) != std::string::npos
|| s.find("e-", 0) != std::string::npos);
}
bool MathLib::isNegative(const std::string &s)
@ -125,25 +125,25 @@ bool MathLib::isNegative(const std::string &s)
// eat up whitespace
while (std::isspace(s[n])) ++n;
// every negative number has a negative sign
return(s[n] == '-');
return (s[n] == '-');
}
bool MathLib::isOct(const std::string& str)
{
bool sign = str[0]=='-' || str[0]=='+';
return(str[sign?1:0] == '0' && (str.size() == 1 || isOctalDigit(str[sign?2:1])) && !isFloat(str));
return (str[sign?1:0] == '0' && (str.size() == 1 || isOctalDigit(str[sign?2:1])) && !isFloat(str));
}
bool MathLib::isHex(const std::string& str)
{
bool sign = str[0]=='-' || str[0]=='+';
return(str.compare(sign?1:0, 2, "0x") == 0 || str.compare(sign?1:0, 2, "0X") == 0);
return (str.compare(sign?1:0, 2, "0x") == 0 || str.compare(sign?1:0, 2, "0X") == 0);
}
bool MathLib::isBin(const std::string& str)
{
bool sign = str[0]=='-' || str[0]=='+';
return((str.compare(sign?1:0, 2, "0b") == 0 || str.compare(sign?1:0, 2, "0B") == 0) && str.find_first_not_of("10bB", 1) == std::string::npos);
return ((str.compare(sign?1:0, 2, "0b") == 0 || str.compare(sign?1:0, 2, "0B") == 0) && str.find_first_not_of("10bB", 1) == std::string::npos);
}
bool MathLib::isInt(const std::string & s)
@ -236,7 +236,7 @@ bool MathLib::isInt(const std::string & s)
// if everything goes good, we are at the end of the string and no digits/character
// is here --> return true, but if something was found eg. 12E+12AA return false
return(n >= s.length());
return (n >= s.length());
}
std::string MathLib::add(const std::string & first, const std::string & second)
@ -411,5 +411,5 @@ bool MathLib::isNullValue(const std::string &str)
bool MathLib::isOctalDigit(char c)
{
return(c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || c == '5' || c == '6' || c == '7');
return (c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || c == '5' || c == '6' || c == '7');
}

View File

@ -186,7 +186,7 @@ bool Path::isC(const std::string &path)
{
// In unix, ".C" is considered C++ file
const std::string extension = getFilenameExtension(path);
return(extension == ".c");
return (extension == ".c");
}
bool Path::isCPP(const std::string &path)
@ -203,7 +203,7 @@ bool Path::isCPP(const std::string &path)
}
// In unix, ".C" is considered C++ file
return(getFilenameExtension(path) == ".C");
return (getFilenameExtension(path) == ".C");
}
bool Path::acceptFile(const std::string &path)

View File

@ -120,8 +120,8 @@ public:
struct SuppressionEntry {
SuppressionEntry(const std::string &aid, const std::string &afile, unsigned int aline)
: id(aid), file(afile), line(aline)
{ }
: id(aid), file(afile), line(aline) {
}
std::string id;
std::string file;

View File

@ -2007,7 +2007,7 @@ const Variable* Function::getArgumentVar(unsigned int num) const
{
for (std::list<Variable>::const_iterator i = argumentList.begin(); i != argumentList.end(); ++i) {
if (i->index() == num)
return(&*i);
return (&*i);
else if (i->index() > num)
return 0;
}

View File

@ -302,7 +302,7 @@ const std::string &Token::strAt(int index) const
return tok ? tok->_str : empty_str;
}
static int multiComparePercent(const Token *tok, const char * * haystack_p,
static int multiComparePercent(const Token *tok, const char ** haystack_p,
const char * needle,
bool emptyStringFound)
{

View File

@ -3095,7 +3095,7 @@ static bool linkBrackets(Tokenizer* tokenizer, std::stack<const Token*>& type, s
Token::createMutualLinks(links.top(), token);
links.pop();
}
return(true);
return (true);
}
bool Tokenizer::createLinks()

View File

@ -6,7 +6,7 @@
# If project management wishes to take a newer astyle version into use
# just change this string to match the start of astyle version string.
ASTYLE_VERSION="Artistic Style Version 2."
ASTYLE_VERSION="Artistic Style Version 2.03"
if [[ "`astyle --version 2>&1`" != ${ASTYLE_VERSION}* ]]; then
echo "You should use: ${ASTYLE_VERSION}";

View File

@ -26,8 +26,8 @@ extern std::ostringstream errout;
class Test64BitPortability : public TestFixture {
public:
Test64BitPortability() : TestFixture("Test64BitPortability")
{ }
Test64BitPortability() : TestFixture("Test64BitPortability") {
}
private:

View File

@ -26,8 +26,8 @@ extern std::ostringstream errout;
class TestAssignIf : public TestFixture {
public:
TestAssignIf() : TestFixture("TestAssignIf")
{ }
TestAssignIf() : TestFixture("TestAssignIf") {
}
private:

View File

@ -27,8 +27,8 @@ extern std::ostringstream errout;
class TestAutoVariables : public TestFixture {
public:
TestAutoVariables() : TestFixture("TestAutoVariables")
{ }
TestAutoVariables() : TestFixture("TestAutoVariables") {
}
private:

View File

@ -26,8 +26,8 @@ extern std::ostringstream errout;
class TestBool : public TestFixture {
public:
TestBool() : TestFixture("TestBool")
{ }
TestBool() : TestFixture("TestBool") {
}
private:

View File

@ -27,8 +27,8 @@ extern std::ostringstream errout;
class TestBoost : public TestFixture {
public:
TestBoost() : TestFixture("TestBoost")
{ }
TestBoost() : TestFixture("TestBoost") {
}
private:
void run() {

View File

@ -28,8 +28,8 @@ extern std::ostringstream errout;
class TestBufferOverrun : public TestFixture {
public:
TestBufferOverrun() : TestFixture("TestBufferOverrun")
{ }
TestBufferOverrun() : TestFixture("TestBufferOverrun") {
}
private:

View File

@ -26,8 +26,8 @@ extern std::ostringstream errout;
class TestCharVar : public TestFixture {
public:
TestCharVar() : TestFixture("TestCharVar")
{ }
TestCharVar() : TestFixture("TestCharVar") {
}
private:

View File

@ -27,8 +27,8 @@ extern std::ostringstream errout;
class TestClass : public TestFixture {
public:
TestClass() : TestFixture("TestClass")
{ }
TestClass() : TestFixture("TestClass") {
}
private:

View File

@ -23,8 +23,8 @@
class TestCmdlineParser : public TestFixture {
public:
TestCmdlineParser() : TestFixture("TestCmdlineParser")
{ }
TestCmdlineParser() : TestFixture("TestCmdlineParser") {
}
private:
Settings settings;

View File

@ -27,8 +27,8 @@ extern std::ostringstream errout;
class TestConstructors : public TestFixture {
public:
TestConstructors() : TestFixture("TestConstructors")
{ }
TestConstructors() : TestFixture("TestConstructors") {
}
private:

View File

@ -35,8 +35,8 @@ extern std::ostringstream output;
class TestCppcheck : public TestFixture {
public:
TestCppcheck() : TestFixture("TestCppcheck")
{ }
TestCppcheck() : TestFixture("TestCppcheck") {
}
private:

View File

@ -31,8 +31,8 @@ extern std::ostringstream errout;
class TestDivision : public TestFixture {
public:
TestDivision() : TestFixture("TestDivision")
{ }
TestDivision() : TestFixture("TestDivision") {
}
private:
void check(const char code[], bool inconclusive = false) {

View File

@ -23,8 +23,8 @@
class TestErrorLogger : public TestFixture {
public:
TestErrorLogger() : TestFixture("TestErrorLogger")
{ }
TestErrorLogger() : TestFixture("TestErrorLogger") {
}
private:

View File

@ -26,8 +26,8 @@ extern std::ostringstream errout;
class TestExceptionSafety : public TestFixture {
public:
TestExceptionSafety() : TestFixture("TestExceptionSafety")
{ }
TestExceptionSafety() : TestFixture("TestExceptionSafety") {
}
private:

View File

@ -31,8 +31,8 @@
class TestFileLister: public TestFixture {
public:
TestFileLister()
:TestFixture("TestFileLister")
{}
:TestFixture("TestFileLister") {
}
private:
void run() {

View File

@ -31,8 +31,8 @@ extern std::ostringstream errout;
class TestIncompleteStatement : public TestFixture {
public:
TestIncompleteStatement() : TestFixture("TestIncompleteStatement")
{ }
TestIncompleteStatement() : TestFixture("TestIncompleteStatement") {
}
private:
void check(const char code[]) {

View File

@ -27,8 +27,8 @@ extern std::ostringstream errout;
class TestInternal : public TestFixture {
public:
TestInternal() : TestFixture("TestInternal")
{ }
TestInternal() : TestFixture("TestInternal") {
}
private:
void run() {

View File

@ -25,8 +25,8 @@ extern std::ostringstream errout;
class TestIO : public TestFixture {
public:
TestIO() : TestFixture("TestIO")
{ }
TestIO() : TestFixture("TestIO") {
}
private:

View File

@ -26,8 +26,8 @@ extern std::ostringstream errout;
class TestLeakAutoVar : public TestFixture {
public:
TestLeakAutoVar() : TestFixture("TestLeakAutoVar")
{ }
TestLeakAutoVar() : TestFixture("TestLeakAutoVar") {
}
private:

View File

@ -23,8 +23,8 @@
class TestMathLib : public TestFixture {
public:
TestMathLib() : TestFixture("TestMathLib")
{ }
TestMathLib() : TestFixture("TestMathLib") {
}
private:

View File

@ -30,8 +30,8 @@ extern std::ostringstream errout;
class TestMemleak : private TestFixture {
public:
TestMemleak() : TestFixture("TestMemleak")
{ }
TestMemleak() : TestFixture("TestMemleak") {
}
private:
void run() {
@ -120,8 +120,8 @@ static TestMemleak testMemleak;
class TestMemleakInFunction : public TestFixture {
public:
TestMemleakInFunction() : TestFixture("TestMemleakInFunction")
{ }
TestMemleakInFunction() : TestFixture("TestMemleakInFunction") {
}
private:
void check(const char code[], const Settings *settings = NULL) {
@ -3953,8 +3953,8 @@ static TestMemleakInFunction testMemleakInFunction;
class TestMemleakInClass : public TestFixture {
public:
TestMemleakInClass() : TestFixture("TestMemleakInClass")
{ }
TestMemleakInClass() : TestFixture("TestMemleakInClass") {
}
private:
/**
@ -5079,8 +5079,8 @@ static TestMemleakInClass testMemleakInClass;
class TestMemleakStructMember : public TestFixture {
public:
TestMemleakStructMember() : TestFixture("TestMemleakStructMember")
{ }
TestMemleakStructMember() : TestFixture("TestMemleakStructMember") {
}
private:
void check(const char code[], const char fname[] = 0) {
@ -5434,8 +5434,8 @@ static TestMemleakStructMember testMemleakStructMember;
class TestMemleakNoVar : public TestFixture {
public:
TestMemleakNoVar() : TestFixture("TestMemleakNoVar")
{ }
TestMemleakNoVar() : TestFixture("TestMemleakNoVar") {
}
private:
void check(const char code[]) {

View File

@ -27,8 +27,8 @@ extern std::ostringstream errout;
class TestNonReentrantFunctions : public TestFixture {
public:
TestNonReentrantFunctions() : TestFixture("TestNonReentrantFunctions")
{ }
TestNonReentrantFunctions() : TestFixture("TestNonReentrantFunctions") {
}
private:

View File

@ -25,8 +25,8 @@ extern std::ostringstream errout;
class TestNullPointer : public TestFixture {
public:
TestNullPointer() : TestFixture("TestNullPointer")
{ }
TestNullPointer() : TestFixture("TestNullPointer") {
}
private:

View File

@ -27,8 +27,8 @@ extern std::ostringstream errout;
class TestObsoleteFunctions : public TestFixture {
public:
TestObsoleteFunctions() : TestFixture("TestObsoleteFunctions")
{ }
TestObsoleteFunctions() : TestFixture("TestObsoleteFunctions") {
}
private:

View File

@ -26,8 +26,8 @@ extern std::ostringstream errout;
class TestOther : public TestFixture {
public:
TestOther() : TestFixture("TestOther")
{ }
TestOther() : TestFixture("TestOther") {
}
private:
@ -216,8 +216,8 @@ private:
class SimpleSuppressor: public ErrorLogger {
public:
SimpleSuppressor(Settings &settings, ErrorLogger *next)
: _settings(settings), _next(next)
{ }
: _settings(settings), _next(next) {
}
virtual void reportOut(const std::string &outmsg) {
_next->reportOut(outmsg);
}

View File

@ -22,8 +22,8 @@
class TestPath : public TestFixture {
public:
TestPath() : TestFixture("TestPath")
{ }
TestPath() : TestFixture("TestPath") {
}
private:

View File

@ -23,8 +23,8 @@
class TestPathMatch : public TestFixture {
public:
TestPathMatch() : TestFixture("TestPathMatch")
{ }
TestPathMatch() : TestFixture("TestPathMatch") {
}
private:

View File

@ -27,8 +27,8 @@ extern std::ostringstream errout;
class TestPostfixOperator : public TestFixture {
public:
TestPostfixOperator() : TestFixture("TestPostfixOperator")
{ }
TestPostfixOperator() : TestFixture("TestPostfixOperator") {
}
private:

View File

@ -33,8 +33,8 @@ extern std::ostringstream errout;
class TestSimplifyTokens : public TestFixture {
public:
TestSimplifyTokens() : TestFixture("TestSimplifyTokens")
{ }
TestSimplifyTokens() : TestFixture("TestSimplifyTokens") {
}
private:

View File

@ -26,8 +26,8 @@ extern std::ostringstream errout;
class TestSizeof : public TestFixture {
public:
TestSizeof() : TestFixture("TestSizeof")
{ }
TestSizeof() : TestFixture("TestSizeof") {
}
private:

View File

@ -27,8 +27,8 @@ extern std::ostringstream errout;
class TestStl : public TestFixture {
public:
TestStl() : TestFixture("TestStl")
{ }
TestStl() : TestFixture("TestStl") {
}
private:
void run() {

View File

@ -28,8 +28,8 @@ extern std::ostringstream errout;
class TestSuppressions : public TestFixture {
public:
TestSuppressions() : TestFixture("TestSuppressions")
{ }
TestSuppressions() : TestFixture("TestSuppressions") {
}
private:

View File

@ -45,8 +45,8 @@ public:
,vartok(NULL)
,typetok(NULL)
,t(NULL)
,found(false)
{}
,found(false) {
}
private:
const Scope si;

View File

@ -34,8 +34,8 @@ extern std::ostringstream output;
class TestThreadExecutor : public TestFixture {
public:
TestThreadExecutor() : TestFixture("TestThreadExecutor")
{ }
TestThreadExecutor() : TestFixture("TestThreadExecutor") {
}
private:

View File

@ -24,8 +24,8 @@
class TestTimer : public TestFixture {
public:
TestTimer() : TestFixture("TestTimer")
{ }
TestTimer() : TestFixture("TestTimer") {
}
private:

View File

@ -27,8 +27,8 @@
extern std::ostringstream errout;
class TestToken : public TestFixture {
public:
TestToken() : TestFixture("TestToken")
{ }
TestToken() : TestFixture("TestToken") {
}
private:
std::vector<std::string> arithmeticalOps;

View File

@ -27,8 +27,8 @@
extern std::ostringstream errout;
class TestTokenizer : public TestFixture {
public:
TestTokenizer() : TestFixture("TestTokenizer")
{ }
TestTokenizer() : TestFixture("TestTokenizer") {
}
private:

View File

@ -25,8 +25,8 @@ extern std::ostringstream errout;
class TestUninitVar : public TestFixture {
public:
TestUninitVar() : TestFixture("TestUninitVar")
{ }
TestUninitVar() : TestFixture("TestUninitVar") {
}
private:

View File

@ -26,8 +26,8 @@ extern std::ostringstream errout;
class TestUnusedFunctions : public TestFixture {
public:
TestUnusedFunctions() : TestFixture("TestUnusedFunctions")
{ }
TestUnusedFunctions() : TestFixture("TestUnusedFunctions") {
}
private:

View File

@ -27,8 +27,8 @@ extern std::ostringstream errout;
class TestUnusedPrivateFunction : public TestFixture {
public:
TestUnusedPrivateFunction() : TestFixture("TestUnusedPrivateFunction")
{ }
TestUnusedPrivateFunction() : TestFixture("TestUnusedPrivateFunction") {
}
private:
void run() {

View File

@ -29,8 +29,8 @@ extern std::ostringstream errout;
class TestUnusedVar : public TestFixture {
public:
TestUnusedVar() : TestFixture("TestUnusedVar")
{ }
TestUnusedVar() : TestFixture("TestUnusedVar") {
}
private:
void run() {