astyle: Update to astyle 1.24

This commit is contained in:
Daniel Marjamäki 2010-04-15 20:08:51 +02:00
parent 3fa2137ee3
commit c718a7c595
39 changed files with 248 additions and 246 deletions

View File

@ -93,9 +93,9 @@ void CppCheckExecutor::reportStatus(unsigned int index, unsigned int max)
{
std::ostringstream oss;
oss << index << "/" << max
<< " files checked " <<
static_cast<int>(static_cast<double>(index) / max*100)
<< "% done";
<< " files checked " <<
static_cast<int>(static_cast<double>(index) / max*100)
<< "% done";
std::cout << oss.str() << std::endl;
}
}

View File

@ -30,7 +30,7 @@
#endif
ThreadExecutor::ThreadExecutor(const std::vector<std::string> &filenames, const Settings &settings, ErrorLogger &errorLogger)
: _filenames(filenames), _settings(settings), _errorLogger(errorLogger), _fileCount(0)
: _filenames(filenames), _settings(settings), _errorLogger(errorLogger), _fileCount(0)
{
}

View File

@ -23,7 +23,7 @@
#include "aboutdialog.h"
AboutDialog::AboutDialog(const QString &version, QWidget *parent)
: QDialog(parent)
: QDialog(parent)
{
mUI.setupUi(this);

View File

@ -30,7 +30,7 @@ ApplicationDialog::ApplicationDialog(const QString &name,
const QString &path,
const QString &title,
QWidget *parent) :
QDialog(parent)
QDialog(parent)
{
mUI.setupUi(this);

View File

@ -21,7 +21,7 @@
#include "common.h"
ApplicationList::ApplicationList(QObject *parent) :
QObject(parent)
QObject(parent)
{
//ctor
}

View File

@ -21,9 +21,9 @@
#include <QDebug>
CheckThread::CheckThread(ThreadResult &result) :
mState(Ready),
mResult(result),
mCppcheck(result)
mState(Ready),
mResult(result),
mCppcheck(result)
{
//ctor
}

View File

@ -21,7 +21,7 @@
#include "csvreport.h"
CsvReport::CsvReport(const QString &filename, QObject * parent) :
Report(filename, parent)
Report(filename, parent)
{
}

View File

@ -29,7 +29,7 @@
FileViewDialog::FileViewDialog(const QString &file,
const QString &title,
QWidget *parent)
: QDialog(parent)
: QDialog(parent)
{
mUI.setupUi(this);

View File

@ -41,10 +41,10 @@
#endif
MainWindow::MainWindow() :
mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)),
mApplications(new ApplicationList(this)),
mTranslation(new TranslationHandler(this)),
mLanguages(new QActionGroup(this))
mSettings(new QSettings("Cppcheck", "Cppcheck-GUI", this)),
mApplications(new ApplicationList(this)),
mTranslation(new TranslationHandler(this)),
mLanguages(new QActionGroup(this))
{
mUI.setupUi(this);
mUI.mResults->Initialize(mSettings, mApplications);

View File

@ -31,13 +31,13 @@ static const char DirElementName[] = "dir";
static const char DirNameAttrib[] = "name";
ProjectFile::ProjectFile(QObject *parent) :
QObject(parent)
QObject(parent)
{
}
ProjectFile::ProjectFile(const QString &filename, QObject *parent) :
QObject(parent),
mFilename(filename)
QObject(parent),
mFilename(filename)
{
}

View File

@ -20,8 +20,8 @@
#include "report.h"
Report::Report(const QString &filename, QObject * parent) :
QObject(parent),
mFilename(filename)
QObject(parent),
mFilename(filename)
{
}

View File

@ -29,10 +29,10 @@
#include "xmlreport.h"
ResultsTree::ResultsTree(QWidget * parent) :
QTreeView(parent),
mContextItem(0),
mCheckPath(""),
mVisibleErrors(false)
QTreeView(parent),
mContextItem(0),
mCheckPath(""),
mVisibleErrors(false)
{
for (int i = 0; i < SHOW_NONE; i++)
mShowTypes[i] = false;

View File

@ -27,9 +27,9 @@
#include "csvreport.h"
ResultsView::ResultsView(QWidget * parent) :
QWidget(parent),
mErrorsFound(false),
mShowNoErrorsMessage(true)
QWidget(parent),
mErrorsFound(false),
mShowNoErrorsMessage(true)
{
mUI.setupUi(this);
}
@ -72,7 +72,8 @@ void ResultsView::Progress(int value, int max)
mUI.mProgress->setVisible(false);
//Should we inform user of non visible/not found errors?
if (mShowNoErrorsMessage)
{ //Tell user that we found no errors
{
//Tell user that we found no errors
if (!mErrorsFound)
{
QMessageBox msg(QMessageBox::Information,

View File

@ -29,10 +29,10 @@
SettingsDialog::SettingsDialog(QSettings *programSettings,
ApplicationList *list,
QWidget *parent) :
QDialog(parent),
mSettings(programSettings),
mApplications(list),
mTempApplications(new ApplicationList(this))
QDialog(parent),
mSettings(programSettings),
mApplications(list),
mTempApplications(new ApplicationList(this))
{
mUI.setupUi(this);
mTempApplications->Copy(list);

View File

@ -21,8 +21,8 @@
#include <QDebug>
ThreadHandler::ThreadHandler(QObject *parent) :
QObject(parent),
mRunningThreadCount(0)
QObject(parent),
mRunningThreadCount(0)
{
SetThreadCount(1);
}

View File

@ -24,26 +24,26 @@
#include <QLocale>
TranslationHandler::TranslationHandler(QObject *parent) :
QObject(parent),
mCurrentLanguage(-1),
mTranslator(new QTranslator(this))
QObject(parent),
mCurrentLanguage(-1),
mTranslator(new QTranslator(this))
{
//Add our default languages
mNames << QT_TRANSLATE_NOOP("MainWindow", "English")
<< QT_TRANSLATE_NOOP("MainWindow", "Dutch")
<< QT_TRANSLATE_NOOP("MainWindow", "Finnish")
<< QT_TRANSLATE_NOOP("MainWindow", "Swedish")
<< QT_TRANSLATE_NOOP("MainWindow", "German")
<< QT_TRANSLATE_NOOP("MainWindow", "Russian")
<< QT_TRANSLATE_NOOP("MainWindow", "Polish");
<< QT_TRANSLATE_NOOP("MainWindow", "Dutch")
<< QT_TRANSLATE_NOOP("MainWindow", "Finnish")
<< QT_TRANSLATE_NOOP("MainWindow", "Swedish")
<< QT_TRANSLATE_NOOP("MainWindow", "German")
<< QT_TRANSLATE_NOOP("MainWindow", "Russian")
<< QT_TRANSLATE_NOOP("MainWindow", "Polish");
mFiles << "cppcheck_en"
<< "cppcheck_nl"
<< "cppcheck_fi"
<< "cppcheck_se"
<< "cppcheck_de"
<< "cppcheck_ru"
<< "cppcheck_pl";
<< "cppcheck_nl"
<< "cppcheck_fi"
<< "cppcheck_se"
<< "cppcheck_de"
<< "cppcheck_ru"
<< "cppcheck_pl";
//Load english as a fallback language
QTranslator *english = new QTranslator();

View File

@ -21,7 +21,7 @@
#include "txtreport.h"
TxtReport::TxtReport(const QString &filename, QObject * parent) :
Report(filename, parent)
Report(filename, parent)
{
}

View File

@ -21,7 +21,7 @@
#include "xmlreport.h"
XmlReport::XmlReport(const QString &filename, QObject * parent) :
Report(filename, parent)
Report(filename, parent)
{
}

View File

@ -39,7 +39,7 @@ class Check
public:
/** This constructor is used when registering the CheckClass */
Check()
: _tokenizer(0), _settings(0), _errorLogger(0)
: _tokenizer(0), _settings(0), _errorLogger(0)
{
instances().push_back(this);
instances().sort();
@ -47,7 +47,7 @@ public:
/** This constructor is used when running checks. */
Check(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: _tokenizer(tokenizer), _settings(settings), _errorLogger(errorLogger)
: _tokenizer(tokenizer), _settings(settings), _errorLogger(errorLogger)
{ }
virtual ~Check()

View File

@ -39,7 +39,7 @@ public:
/** This constructor is used when running checks. */
CheckAutoVariables(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(tokenizer, settings, errorLogger)
: Check(tokenizer, settings, errorLogger)
{ }
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)

View File

@ -160,7 +160,7 @@ public:
* @param str Token::str() is compared against this.
*/
TokenStrEquals(const std::string &str)
: value(str)
: value(str)
{
}
@ -1294,7 +1294,7 @@ class ExecutionPathBufferOverrun : public ExecutionPath
public:
/** Startup constructor */
ExecutionPathBufferOverrun(Check *c, const std::map<unsigned int, ArrayInfo> &arrayinfo)
: ExecutionPath(c, 0), arrayInfo(arrayinfo)
: ExecutionPath(c, 0), arrayInfo(arrayinfo)
{
}
@ -1313,8 +1313,8 @@ private:
/** internal constructor for creating extra checks */
ExecutionPathBufferOverrun(Check *c, const std::map<unsigned int, ArrayInfo> &arrayinfo, unsigned int varid_)
: ExecutionPath(c, varid_),
arrayInfo(arrayinfo)
: ExecutionPath(c, varid_),
arrayInfo(arrayinfo)
{
// Pretend that variables are initialized to 0
// This checking is not about uninitialized variables

View File

@ -54,7 +54,7 @@ public:
/** This constructor is used when running checks. */
CheckBufferOverrun(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(tokenizer, settings, errorLogger)
: Check(tokenizer, settings, errorLogger)
{ }
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)

View File

@ -40,7 +40,7 @@ public:
/** @brief This constructor is used when running checks. */
CheckClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(tokenizer, settings, errorLogger)
: Check(tokenizer, settings, errorLogger)
{ }
/** @brief Run checks on the normal token list */
@ -114,12 +114,12 @@ private:
{
public:
Var(const std::string &name_, bool init_ = false, bool priv_ = false, bool mutable_ = false, bool static_ = false, Var *next_ = 0)
: name(name_),
init(init_),
priv(priv_),
isMutable(mutable_),
isStatic(static_),
next(next_)
: name(name_),
init(init_),
priv(priv_),
isMutable(mutable_),
isStatic(static_),
next(next_)
{
}

View File

@ -40,7 +40,7 @@ public:
/** This constructor is used when running checks. */
CheckDangerousFunctions(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(tokenizer, settings, errorLogger)
: Check(tokenizer, settings, errorLogger)
{ }
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)

View File

@ -48,7 +48,7 @@ public:
/** This constructor is used when running checks. */
CheckExceptionSafety(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(tokenizer, settings, errorLogger)
: Check(tokenizer, settings, errorLogger)
{ }
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)

View File

@ -84,7 +84,7 @@ private:
public:
CheckMemoryLeak(const Tokenizer *t, ErrorLogger *e)
: tokenizer(t), errorLogger(e)
: tokenizer(t), errorLogger(e)
{
}
@ -172,7 +172,7 @@ public:
/** @brief This constructor is used when running checks */
CheckMemoryLeakInFunction(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)
: Check(tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog)
: Check(tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog)
{ }
/** @brief run all simplified checks */
@ -340,7 +340,7 @@ public:
{ }
CheckMemoryLeakInClass(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)
: Check(tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog)
: Check(tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog)
{ }
void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)
@ -380,7 +380,7 @@ public:
{ }
CheckMemoryLeakStructMember(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)
: Check(tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog)
: Check(tokenizr, settings, errLog), CheckMemoryLeak(tokenizr, errLog)
{ }
void runSimplifiedChecks(const Tokenizer *tokenizr, const Settings *settings, ErrorLogger *errLog)

View File

@ -1583,9 +1583,9 @@ public:
private:
/** Create checking of specific variable: */
CheckNullpointer(Check *c, const unsigned int id, const std::string &name)
: ExecutionPath(c, id),
varname(name),
null(false)
: ExecutionPath(c, id),
varname(name),
null(false)
{
}
@ -1751,7 +1751,7 @@ class CheckUninitVar : public ExecutionPath
public:
/** Startup constructor */
CheckUninitVar(Check *c)
: ExecutionPath(c, 0), pointer(false), array(false), alloc(false), strncpy_(false)
: ExecutionPath(c, 0), pointer(false), array(false), alloc(false), strncpy_(false)
{
}
@ -1767,7 +1767,7 @@ private:
/** internal constructor for creating extra checks */
CheckUninitVar(Check *c, unsigned int v, const std::string &name, bool p, bool a)
: ExecutionPath(c, v), varname(name), pointer(p), array(a), alloc(false), strncpy_(false)
: ExecutionPath(c, v), varname(name), pointer(p), array(a), alloc(false), strncpy_(false)
{
}

View File

@ -42,7 +42,7 @@ public:
/** @brief This constructor is used when running checks. */
CheckOther(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(tokenizer, settings, errorLogger)
: Check(tokenizer, settings, errorLogger)
{ }
/** @brief Run checks against the normal token list */

View File

@ -40,7 +40,7 @@ public:
/** This constructor is used when running checks. */
CheckStl(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
: Check(tokenizer, settings, errorLogger)
: Check(tokenizer, settings, errorLogger)
{ }
void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)

View File

@ -66,8 +66,8 @@ struct TimerResultsData
unsigned int _numberOfResults;
TimerResultsData()
: _clocks(0)
, _numberOfResults(0)
: _clocks(0)
, _numberOfResults(0)
{
}
};
@ -117,11 +117,11 @@ class Timer
{
public:
Timer(const std::string& str, unsigned int showtimeMode, TimerResultsIntf* timerResults = NULL)
: _str(str)
, _showtimeMode(showtimeMode)
, _start(0)
, _stopped(false)
, _timerResults(timerResults)
: _str(str)
, _showtimeMode(showtimeMode)
, _start(0)
, _stopped(false)
, _timerResults(timerResults)
{
if (showtimeMode != SHOWTIME_NONE)
_start = clock();
@ -167,7 +167,7 @@ private:
//---------------------------------------------------------------------------
CppCheck::CppCheck(ErrorLogger &errorLogger)
: _errorLogger(errorLogger)
: _errorLogger(errorLogger)
{
exitcode = 0;
}
@ -499,7 +499,7 @@ bool CppCheck::parseFromArgs(int argc, const char* const argv[])
for (std::list<Check *>::iterator it = Check::instances().begin(); it != Check::instances().end(); ++it)
{
doc << "===" << (*it)->name() << "===\n"
<< (*it)->classInfo() << "\n\n";
<< (*it)->classInfo() << "\n\n";
}
std::string doc2(doc.str());
@ -536,69 +536,69 @@ bool CppCheck::parseFromArgs(int argc, const char* const argv[])
{
std::ostringstream oss;
oss << "Cppcheck - A tool for static C/C++ code analysis\n"
"\n"
"Syntax:\n"
" cppcheck [--append=file] [--enable=<id>]\n"
" [--error-exitcode=[n]] [--exitcode-suppressions file] [--force]\n"
" [--help] [-Idir] [-j [jobs]] [--quiet] [--style]\n"
" [--suppressions file.txt] [--inline-suppr] [--file-list=file.txt]\n"
" [--verbose] [--version] [--xml] [file or path1] [file or path] ..\n"
"\n"
"If path is given instead of filename, *.cpp, *.cxx, *.cc, *.c++ and *.c files\n"
"are checked recursively from given directory.\n\n"
"Options:\n"
" --append=file This allows you to provide information about\n"
" functions by providing an implementation for these.\n"
" --enable=id Enable specific checks. The available ids are:\n"
" * all - enable all checks\n"
" * exceptNew - exception safety when using new\n"
" * exceptRealloc - exception safety when reallocating\n"
" * style - Check coding style\n"
" * unusedFunctions - check for unused functions\n"
" Several ids can be given if you separate them with commas\n"
" --error-exitcode=[n] If errors are found, integer [n] is returned instead\n"
" of default 0. EXIT_FAILURE is returned\n"
" if arguments are not valid or if no input files are\n"
" provided. Note that your operating system can\n"
" modify this value, e.g. 256 can become 0.\n"
" --exitcode-suppressions file\n"
" Used when certain messages should be displayed but\n"
" should not cause a non-zero exitcode.\n"
" -f, --force Force checking on files that have \"too many\"\n"
" configurations\n"
" -h, --help Print this help\n"
" -I [dir] Give include path. Give several -I parameters to give\n"
" several paths. First given path is checked first. If\n"
" paths are relative to source files, this is not needed\n"
" -j [jobs] Start [jobs] threads to do the checking simultaneously.\n"
" -q, --quiet Only print error messages\n"
" -s, --style deprecated, use --enable=style\n"
" --suppressions file Suppress warnings listed in the file. Filename and line\n"
" are optional. The format of the single line in file is:\n"
" [error id]:[filename]:[line]\n"
" --inline-suppr Enable inline suppressions. Use them by placing one or\n"
" more comments in the form: // cppcheck-suppress memleak\n"
" on the lines before the warning to suppress.\n"
" --file-list=file Specify the files to check in a text file. One Filename per line.\n"
" --template '[text]' Format the error messages. E.g.\n"
" '{file}:{line},{severity},{id},{message}' or\n"
" '{file}({line}):({severity}) {message}'\n"
" Pre-defined templates: gcc, vs\n"
" --unused-functions deprecated, use --enable=unusedFunctions\n"
" -v, --verbose More detailed error reports\n"
" --version Print out version number\n"
" --xml Write results in xml to error stream.\n"
"\n"
"Example usage:\n"
" # Recursively check the current folder. Print the progress on the screen and\n"
" write errors in a file:\n"
" cppcheck . 2> err.txt\n"
" # Recursively check ../myproject/ and don't print progress:\n"
" cppcheck --quiet ../myproject/\n"
" # Check only files one.cpp and two.cpp and give all information there is:\n"
" cppcheck -v -s one.cpp two.cpp\n"
" # Check f.cpp and search include files from inc1/ and inc2/:\n"
" cppcheck -I inc1/ -I inc2/ f.cpp\n";
"\n"
"Syntax:\n"
" cppcheck [--append=file] [--enable=<id>]\n"
" [--error-exitcode=[n]] [--exitcode-suppressions file] [--force]\n"
" [--help] [-Idir] [-j [jobs]] [--quiet] [--style]\n"
" [--suppressions file.txt] [--inline-suppr] [--file-list=file.txt]\n"
" [--verbose] [--version] [--xml] [file or path1] [file or path] ..\n"
"\n"
"If path is given instead of filename, *.cpp, *.cxx, *.cc, *.c++ and *.c files\n"
"are checked recursively from given directory.\n\n"
"Options:\n"
" --append=file This allows you to provide information about\n"
" functions by providing an implementation for these.\n"
" --enable=id Enable specific checks. The available ids are:\n"
" * all - enable all checks\n"
" * exceptNew - exception safety when using new\n"
" * exceptRealloc - exception safety when reallocating\n"
" * style - Check coding style\n"
" * unusedFunctions - check for unused functions\n"
" Several ids can be given if you separate them with commas\n"
" --error-exitcode=[n] If errors are found, integer [n] is returned instead\n"
" of default 0. EXIT_FAILURE is returned\n"
" if arguments are not valid or if no input files are\n"
" provided. Note that your operating system can\n"
" modify this value, e.g. 256 can become 0.\n"
" --exitcode-suppressions file\n"
" Used when certain messages should be displayed but\n"
" should not cause a non-zero exitcode.\n"
" -f, --force Force checking on files that have \"too many\"\n"
" configurations\n"
" -h, --help Print this help\n"
" -I [dir] Give include path. Give several -I parameters to give\n"
" several paths. First given path is checked first. If\n"
" paths are relative to source files, this is not needed\n"
" -j [jobs] Start [jobs] threads to do the checking simultaneously.\n"
" -q, --quiet Only print error messages\n"
" -s, --style deprecated, use --enable=style\n"
" --suppressions file Suppress warnings listed in the file. Filename and line\n"
" are optional. The format of the single line in file is:\n"
" [error id]:[filename]:[line]\n"
" --inline-suppr Enable inline suppressions. Use them by placing one or\n"
" more comments in the form: // cppcheck-suppress memleak\n"
" on the lines before the warning to suppress.\n"
" --file-list=file Specify the files to check in a text file. One Filename per line.\n"
" --template '[text]' Format the error messages. E.g.\n"
" '{file}:{line},{severity},{id},{message}' or\n"
" '{file}({line}):({severity}) {message}'\n"
" Pre-defined templates: gcc, vs\n"
" --unused-functions deprecated, use --enable=unusedFunctions\n"
" -v, --verbose More detailed error reports\n"
" --version Print out version number\n"
" --xml Write results in xml to error stream.\n"
"\n"
"Example usage:\n"
" # Recursively check the current folder. Print the progress on the screen and\n"
" write errors in a file:\n"
" cppcheck . 2> err.txt\n"
" # Recursively check ../myproject/ and don't print progress:\n"
" cppcheck --quiet ../myproject/\n"
" # Check only files one.cpp and two.cpp and give all information there is:\n"
" cppcheck -v -s one.cpp two.cpp\n"
" # Check f.cpp and search include files from inc1/ and inc2/:\n"
" cppcheck -I inc1/ -I inc2/ f.cpp\n";
reportOut(oss.str());
}
else if (_filenames.empty())

View File

@ -213,8 +213,8 @@ 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. "
<< "(line=" << lineno << ", character code=" << std::hex << (int(ch) & 0xff) << ")";
<< "Neither unicode nor extended ascii are supported. "
<< "(line=" << lineno << ", character code=" << std::hex << (int(ch) & 0xff) << ")";
throw std::runtime_error(errmsg.str());
}
@ -1477,7 +1477,7 @@ public:
* e.g. "A(x) foo(x);"
*/
PreprocessorMacro(const std::string &macro)
: _macro(macro), _prefix("__cppcheck__")
: _macro(macro), _prefix("__cppcheck__")
{
// Tokenize the macro to make it easier to handle
std::istringstream istr(macro.c_str());

View File

@ -24,7 +24,7 @@
#include <stdexcept>
Settings::Settings()
: inconclusive(false)
: inconclusive(false)
{
_debug = false;
_checkCodingStyle = false;
@ -41,14 +41,14 @@ Settings::Settings()
}
Settings::Settings(const Settings &s)
: inconclusive(s.inconclusive)
: inconclusive(s.inconclusive)
{
*this = s;
}
// Constructor used in unit testing..
Settings::Settings(bool all)
: inconclusive(all)
: inconclusive(all)
{
Settings s;
*this = s; // This assigns all members except "inconclusive"

View File

@ -27,20 +27,20 @@
#include <map>
Token::Token(Token **t) :
tokensBack(t),
_str(""),
_isName(false),
_isNumber(false),
_isBoolean(false),
_isUnsigned(false),
_isSigned(false),
_isLong(false),
_varId(0),
_next(0),
_previous(0),
_link(0),
_fileIndex(0),
_linenr(0)
tokensBack(t),
_str(""),
_isName(false),
_isNumber(false),
_isBoolean(false),
_isUnsigned(false),
_isSigned(false),
_isLong(false),
_varId(0),
_next(0),
_previous(0),
_link(0),
_fileIndex(0),
_linenr(0)
{
}

View File

@ -46,14 +46,14 @@
//---------------------------------------------------------------------------
Tokenizer::Tokenizer()
: _settings(0), _errorLogger(0)
: _settings(0), _errorLogger(0)
{
_tokens = 0;
_tokensBack = 0;
}
Tokenizer::Tokenizer(const Settings *settings, ErrorLogger *errorLogger)
: _settings(settings), _errorLogger(errorLogger)
: _settings(settings), _errorLogger(errorLogger)
{
_tokens = 0;
_tokensBack = 0;
@ -409,7 +409,7 @@ void Tokenizer::duplicateTypedefError(const Token *tok1, const Token *tok2, cons
const ErrorLogger::ErrorMessage errmsg(locationList,
"style",
std::string(type + " '" + tok2->str() +
"' hides typedef with same name"),
"' hides typedef with same name"),
"variableHidingTypedef");
if (_errorLogger)
@ -435,7 +435,7 @@ void Tokenizer::duplicateDeclarationError(const Token *tok1, const Token *tok2,
const ErrorLogger::ErrorMessage errmsg(locationList,
"style",
std::string(type + " '" + tok2->str() +
"' forward declaration unnecessary, already declared"),
"' forward declaration unnecessary, already declared"),
"unnecessaryForwardDeclaration");
if (_errorLogger)
@ -5626,7 +5626,7 @@ void Tokenizer::duplicateEnumError(const Token * tok1, const Token * tok2, const
const ErrorLogger::ErrorMessage errmsg(locationList,
"style",
std::string(type + " '" + tok2->str() +
"' hides enumerator with same name"),
"' hides enumerator with same name"),
"variableHidingEnum");
if (_errorLogger)

View File

@ -1,13 +1,13 @@
#!/bin/bash
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren cli/*.cpp
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren cli/*.h
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren gui/*.cpp
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren gui/*.h
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren lib/*.cpp
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren lib/*.h
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren test/*.cpp
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren test/*.h
astyle --style=ansi --min-conditional-indent=0 cli/*.cpp
astyle --style=ansi --min-conditional-indent=0 cli/*.h
astyle --style=ansi --min-conditional-indent=0 gui/*.cpp
astyle --style=ansi --min-conditional-indent=0 gui/*.h
astyle --style=ansi --min-conditional-indent=0 lib/*.cpp
astyle --style=ansi --min-conditional-indent=0 lib/*.h
astyle --style=ansi --min-conditional-indent=0 test/*.cpp
astyle --style=ansi --min-conditional-indent=0 test/*.h
astyle --style=ansi --min-conditional-indent=0 --pad=oper --unpad=paren tools/*.cpp
astyle --style=ansi --min-conditional-indent=0 tools/*.cpp

View File

@ -885,7 +885,7 @@ private:
"{g(sizeof(a),sizeof(b),sizeof(c));}";
std::ostringstream expected;
expected << "void f ( char * a , char * b , char * c ) { g ( " <<
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
ASSERT_EQUALS(expected.str(), sizeof_(code));
}
@ -894,7 +894,7 @@ private:
"{g(sizeof(a),sizeof(b),sizeof(c));}";
std::ostringstream expected;
expected << "void f ( char a , char b , char c ) { g ( " <<
sizeofFromTokenizer("char") << " , " << sizeofFromTokenizer("char") << " , " << sizeofFromTokenizer("char") << " ) ; }";
sizeofFromTokenizer("char") << " , " << sizeofFromTokenizer("char") << " , " << sizeofFromTokenizer("char") << " ) ; }";
ASSERT_EQUALS(expected.str(), sizeof_(code));
}
@ -903,7 +903,7 @@ private:
"{g(sizeof(a),sizeof(b),sizeof(c));}";
std::ostringstream expected;
expected << "void f ( const char * a , const char * b , const char * c ) { g ( " <<
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
ASSERT_EQUALS(expected.str(), sizeof_(code));
}
@ -912,7 +912,7 @@ private:
"{g(sizeof(a),sizeof(b),sizeof(c));}";
std::ostringstream expected;
expected << "void f ( char a [ 10 ] , char b [ 10 ] , char c [ 10 ] ) { g ( " <<
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
ASSERT_EQUALS(expected.str(), sizeof_(code));
}
@ -921,9 +921,9 @@ private:
"{g(sizeof(a),sizeof(b),sizeof(c));}";
std::ostringstream expected;
expected << "void f ( const char a [ 10 ] , "
"const char b [ 10 ] , "
"const char c [ 10 ] ) { g ( " <<
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
"const char b [ 10 ] , "
"const char c [ 10 ] ) { g ( " <<
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
ASSERT_EQUALS(expected.str(), sizeof_(code));
}
@ -932,9 +932,9 @@ private:
"{g(sizeof(a),sizeof(b),sizeof(c));}";
std::ostringstream expected;
expected << "void f ( const char * a [ 10 ] , "
"const char * b [ 10 ] , "
"const char * c [ 10 ] ) { g ( " <<
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
"const char * b [ 10 ] , "
"const char * c [ 10 ] ) { g ( " <<
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
ASSERT_EQUALS(expected.str(), sizeof_(code));
}
@ -943,7 +943,7 @@ private:
"{g(sizeof(a),sizeof(b),sizeof(c));}";
std::ostringstream expected;
expected << "void f ( char * a [ 10 ] , char * b [ 10 ] , char * c [ 10 ] ) { g ( " <<
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " , " << sizeofFromTokenizer("*") << " ) ; }";
ASSERT_EQUALS(expected.str(), sizeof_(code));
}

View File

@ -607,9 +607,10 @@ private:
{
const int STL_CONTAINER_LIST = 9;
const std::string stlCont[STL_CONTAINER_LIST] =
{"deque", "list", "set", "multiset", "map",
"multimap", "hash_map", "hash_multimap", "hash_set"
};
{
"deque", "list", "set", "multiset", "map",
"multimap", "hash_map", "hash_multimap", "hash_set"
};
for (int i = 0; i < STL_CONTAINER_LIST; ++i)
{

View File

@ -121,10 +121,10 @@ void TestFixture::assertEquals(const char *filename, int linenr, const std::stri
++fails_counter;
errmsg << "Assertion failed in " << filename << " at line " << linenr << std::endl
<< "Expected:" << std::endl
<< writestr(expected) << std::endl
<< "Actual:" << std::endl
<< writestr(actual) << std::endl;
<< "Expected:" << std::endl
<< writestr(expected) << std::endl
<< "Actual:" << std::endl
<< writestr(actual) << std::endl;
}
}
@ -159,7 +159,7 @@ void TestFixture::assertThrowFail(const char *filename, int linenr)
++fails_counter;
errmsg << "Assertion failed in " << filename << " at line " << linenr << std::endl
<< "The expected exception was not thrown" << std::endl;
<< "The expected exception was not thrown" << std::endl;
}
void TestFixture::printTests()

View File

@ -60,82 +60,82 @@ int main(const int argc, const char * const * const argv)
if (subcount < 6)
{
fout << "class Token\n"
<< "{\n"
<< "public:\n"
<< " const char *str() const;\n"
<< " const Token *next() const;\n"
<< " unsigned int size() const;\n"
<< " char read () const;\n"
<< " operator bool() const;\n"
<< "};\n"
<< "static Token *tokens;\n";
<< "{\n"
<< "public:\n"
<< " const char *str() const;\n"
<< " const Token *next() const;\n"
<< " unsigned int size() const;\n"
<< " char read () const;\n"
<< " operator bool() const;\n"
<< "};\n"
<< "static Token *tokens;\n";
}
else
{
fout << "struct A\n"
"{\n"
" char b();\n"
" A *next;\n"
"};\n";
"{\n"
" char b();\n"
" A *next;\n"
"};\n";
}
}
if (testname == "nullpointer2")
{
fout << "class Fred\n"
<< "{\n"
<< "public:\n"
<< " void hello() const;\n"
<< " operator bool() const;\n"
<< "};\n";
<< "{\n"
<< "public:\n"
<< " void hello() const;\n"
<< " operator bool() const;\n"
<< "};\n";
}
if (testname == "nullpointer3")
{
fout << "struct DEF { };\n"
<< "struct ABC : public DEF\n"
<< "{\n"
<< " int a,b,c;\n"
<< " struct ABC *next;\n"
<< "};\n"
<< "void bar(int); void f(struct ABC **);\n";
<< "struct ABC : public DEF\n"
<< "{\n"
<< " int a,b,c;\n"
<< " struct ABC *next;\n"
<< "};\n"
<< "void bar(int); void f(struct ABC **);\n";
}
if (testname == "nullpointer4")
{
fout << "void bar(int);\n"
<< "int** f(int **p = 0);\n"
<< "extern int x;\n"
<< "struct P {\n"
<< " bool check() const;\n"
<< " P* next() const;\n"
<< "};\n";
<< "int** f(int **p = 0);\n"
<< "extern int x;\n"
<< "struct P {\n"
<< " bool check() const;\n"
<< " P* next() const;\n"
<< "};\n";
}
if (testname == "nullpointer5")
{
fout << "struct A {\n"
<< " char c() const;\n"
<< " operator bool() const;\n"
<< "};\n";
<< " char c() const;\n"
<< " operator bool() const;\n"
<< "};\n";
}
if (testname == "nullpointer6")
{
fout << "struct Foo {\n"
<< " void abcd() const;\n"
<< "};\n"
<< "struct FooBar : public Foo { };\n"
<< "struct FooCar : public Foo { };\n"
<< "extern int a;\n";
<< " void abcd() const;\n"
<< "};\n"
<< "struct FooBar : public Foo { };\n"
<< "struct FooCar : public Foo { };\n"
<< "extern int a;\n";
}
if (testname == "nullpointer7")
{
fout << "struct wxLongLong {\n"
<< " wxLongLong(int) { }\n"
<< " long GetValue() const;\n"
<< "};\n";
<< " wxLongLong(int) { }\n"
<< " long GetValue() const;\n"
<< "};\n";
}
do