Refactoring; Reorder Settings members alphabetically.
This commit is contained in:
parent
b1b5b27b4e
commit
d3e7d09f5c
|
@ -24,34 +24,35 @@ bool Settings::mTerminated;
|
||||||
|
|
||||||
Settings::Settings()
|
Settings::Settings()
|
||||||
: mEnabled(0),
|
: mEnabled(0),
|
||||||
|
checkConfiguration(false),
|
||||||
|
checkLibrary(false),
|
||||||
|
checkHeaders(true),
|
||||||
|
checkUnusedTemplates(true),
|
||||||
debugSimplified(false),
|
debugSimplified(false),
|
||||||
debugnormal(false),
|
debugnormal(false),
|
||||||
debugwarnings(false),
|
debugwarnings(false),
|
||||||
debugtemplate(false),
|
debugtemplate(false),
|
||||||
maxCtuDepth(2),
|
|
||||||
dump(false),
|
dump(false),
|
||||||
exceptionHandling(false),
|
|
||||||
inconclusive(false),
|
|
||||||
jointSuppressionReport(false),
|
|
||||||
experimental(false),
|
|
||||||
quiet(false),
|
|
||||||
inlineSuppressions(false),
|
|
||||||
verbose(false),
|
|
||||||
force(false),
|
|
||||||
relativePaths(false),
|
|
||||||
xml(false), xml_version(2),
|
|
||||||
jobs(1),
|
|
||||||
loadAverage(0),
|
|
||||||
exitCode(0),
|
|
||||||
showtime(SHOWTIME_NONE),
|
|
||||||
preprocessOnly(false),
|
|
||||||
maxConfigs(12),
|
|
||||||
enforcedLang(None),
|
enforcedLang(None),
|
||||||
|
exceptionHandling(false),
|
||||||
|
exitCode(0),
|
||||||
|
experimental(false),
|
||||||
|
force(false),
|
||||||
|
inconclusive(false),
|
||||||
|
inlineSuppressions(false),
|
||||||
|
jobs(1),
|
||||||
|
jointSuppressionReport(false),
|
||||||
|
loadAverage(0),
|
||||||
|
maxConfigs(12),
|
||||||
|
maxCtuDepth(2),
|
||||||
|
preprocessOnly(false),
|
||||||
|
quiet(false),
|
||||||
|
relativePaths(false),
|
||||||
reportProgress(false),
|
reportProgress(false),
|
||||||
checkConfiguration(false),
|
showtime(SHOWTIME_NONE),
|
||||||
checkLibrary(false),
|
verbose(false),
|
||||||
checkHeaders(true),
|
xml(false),
|
||||||
checkUnusedTemplates(true)
|
xml_version(2)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
304
lib/settings.h
304
lib/settings.h
|
@ -70,9 +70,31 @@ private:
|
||||||
public:
|
public:
|
||||||
Settings();
|
Settings();
|
||||||
|
|
||||||
|
std::list<std::string> addons;
|
||||||
|
|
||||||
|
/** @brief Paths used as base for conversion to relative paths. */
|
||||||
|
std::vector<std::string> basePaths;
|
||||||
|
|
||||||
/** @brief --cppcheck-build-dir */
|
/** @brief --cppcheck-build-dir */
|
||||||
std::string buildDir;
|
std::string buildDir;
|
||||||
|
|
||||||
|
/** Is the 'configuration checking' wanted? */
|
||||||
|
bool checkConfiguration;
|
||||||
|
|
||||||
|
/** Check for incomplete info in library files? */
|
||||||
|
bool checkLibrary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check code in the headers, this is on by default but can
|
||||||
|
* be turned off to save CPU */
|
||||||
|
bool checkHeaders;
|
||||||
|
|
||||||
|
/** Check unused templates */
|
||||||
|
bool checkUnusedTemplates;
|
||||||
|
|
||||||
|
/** @brief include paths excluded from checking the configuration */
|
||||||
|
std::set<std::string> configExcludePaths;
|
||||||
|
|
||||||
/** @brief Is --debug-simplified given? */
|
/** @brief Is --debug-simplified given? */
|
||||||
bool debugSimplified;
|
bool debugSimplified;
|
||||||
|
|
||||||
|
@ -85,23 +107,23 @@ public:
|
||||||
/** @brief Is --debug-template given? */
|
/** @brief Is --debug-template given? */
|
||||||
bool debugtemplate;
|
bool debugtemplate;
|
||||||
|
|
||||||
/** @brief --max-ctu-depth */
|
|
||||||
int maxCtuDepth;
|
|
||||||
|
|
||||||
/** @brief Is --dump given? */
|
/** @brief Is --dump given? */
|
||||||
bool dump;
|
bool dump;
|
||||||
std::string dumpFile;
|
std::string dumpFile;
|
||||||
|
|
||||||
|
enum Language {
|
||||||
|
None, C, CPP
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @brief Name of the language that is enforced. Empty per default. */
|
||||||
|
Language enforcedLang;
|
||||||
|
|
||||||
/** @brief Is --exception-handling given */
|
/** @brief Is --exception-handling given */
|
||||||
bool exceptionHandling;
|
bool exceptionHandling;
|
||||||
|
|
||||||
/** @brief Inconclusive checks */
|
/** @brief If errors are found, this value is returned from main().
|
||||||
bool inconclusive;
|
Default value is 0. */
|
||||||
|
int exitCode;
|
||||||
/** @brief Collect unmatched suppressions in one run.
|
|
||||||
* This delays the reporting until all files are checked.
|
|
||||||
* It is needed by checks that analyse the whole code base. */
|
|
||||||
bool jointSuppressionReport;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When this flag is false (default) then experimental
|
* When this flag is false (default) then experimental
|
||||||
|
@ -111,33 +133,49 @@ public:
|
||||||
*/
|
*/
|
||||||
bool experimental;
|
bool experimental;
|
||||||
|
|
||||||
/** @brief Is --quiet given? */
|
/** @brief Force checking the files with "too many" configurations (--force). */
|
||||||
bool quiet;
|
bool force;
|
||||||
|
|
||||||
|
/** @brief List of include paths, e.g. "my/includes/" which should be used
|
||||||
|
for finding include files inside source files. (-I) */
|
||||||
|
std::list<std::string> includePaths;
|
||||||
|
|
||||||
|
/** @brief Inconclusive checks */
|
||||||
|
bool inconclusive;
|
||||||
|
|
||||||
/** @brief Is --inline-suppr given? */
|
/** @brief Is --inline-suppr given? */
|
||||||
bool inlineSuppressions;
|
bool inlineSuppressions;
|
||||||
|
|
||||||
/** @brief Is --verbose given? */
|
/** @brief How many processes/threads should do checking at the same
|
||||||
bool verbose;
|
time. Default is 1. (-j N) */
|
||||||
|
unsigned int jobs;
|
||||||
|
|
||||||
/** @brief Request termination of checking */
|
/** @brief Collect unmatched suppressions in one run.
|
||||||
static void terminate(bool t = true) {
|
* This delays the reporting until all files are checked.
|
||||||
Settings::mTerminated = t;
|
* It is needed by checks that analyse the whole code base. */
|
||||||
}
|
bool jointSuppressionReport;
|
||||||
|
|
||||||
/** @brief termination requested? */
|
/** @brief --library= */
|
||||||
static bool terminated() {
|
std::list<std::string> libraries;
|
||||||
return Settings::mTerminated;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @brief Force checking the files with "too many" configurations (--force). */
|
/** Library */
|
||||||
bool force;
|
Library library;
|
||||||
|
|
||||||
/** @brief Use relative paths in output. */
|
/** @brief Load average value */
|
||||||
bool relativePaths;
|
unsigned int loadAverage;
|
||||||
|
|
||||||
/** @brief Paths used as base for conversion to relative paths. */
|
/** @brief Maximum number of configurations to check before bailing.
|
||||||
std::vector<std::string> basePaths;
|
Default is 12. (--max-configs=N) */
|
||||||
|
unsigned int maxConfigs;
|
||||||
|
|
||||||
|
/** @brief --max-ctu-depth */
|
||||||
|
int maxCtuDepth;
|
||||||
|
|
||||||
|
/** @brief suppress exitcode */
|
||||||
|
Suppressions nofail;
|
||||||
|
|
||||||
|
/** @brief suppress message (--suppressions) */
|
||||||
|
Suppressions nomsg;
|
||||||
|
|
||||||
/** @brief write results (--output-file=<file>) */
|
/** @brief write results (--output-file=<file>) */
|
||||||
std::string outputFile;
|
std::string outputFile;
|
||||||
|
@ -145,22 +183,46 @@ public:
|
||||||
/** @brief plist output (--plist-output=<dir>) */
|
/** @brief plist output (--plist-output=<dir>) */
|
||||||
std::string plistOutput;
|
std::string plistOutput;
|
||||||
|
|
||||||
/** @brief write XML results (--xml) */
|
/** @brief Using -E for debugging purposes */
|
||||||
bool xml;
|
bool preprocessOnly;
|
||||||
|
|
||||||
/** @brief XML version (--xml-version=..) */
|
ImportProject project;
|
||||||
int xml_version;
|
|
||||||
|
|
||||||
/** @brief How many processes/threads should do checking at the same
|
/** @brief Is --quiet given? */
|
||||||
time. Default is 1. (-j N) */
|
bool quiet;
|
||||||
unsigned int jobs;
|
|
||||||
|
|
||||||
/** @brief Load average value */
|
/** @brief Use relative paths in output. */
|
||||||
unsigned int loadAverage;
|
bool relativePaths;
|
||||||
|
|
||||||
/** @brief If errors are found, this value is returned from main().
|
/** @brief --report-progress */
|
||||||
Default value is 0. */
|
bool reportProgress;
|
||||||
int exitCode;
|
|
||||||
|
/** Rule */
|
||||||
|
class CPPCHECKLIB Rule {
|
||||||
|
public:
|
||||||
|
Rule()
|
||||||
|
: tokenlist("simple") // use simple tokenlist
|
||||||
|
, id("rule") // default id
|
||||||
|
, severity(Severity::style) { // default severity
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string tokenlist;
|
||||||
|
std::string pattern;
|
||||||
|
std::string id;
|
||||||
|
std::string summary;
|
||||||
|
Severity::SeverityType severity;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Extra rules
|
||||||
|
*/
|
||||||
|
std::list<Rule> rules;
|
||||||
|
|
||||||
|
/** @brief show timing information (--showtime=file|summary|top5) */
|
||||||
|
SHOWTIME_MODES showtime;
|
||||||
|
|
||||||
|
/** Struct contains standards settings */
|
||||||
|
Standards standards;
|
||||||
|
|
||||||
/** @brief The output format in which the errors are printed in text mode,
|
/** @brief The output format in which the errors are printed in text mode,
|
||||||
e.g. "{severity} {file}:{line} {message} {id}" */
|
e.g. "{severity} {file}:{line} {message} {id}" */
|
||||||
|
@ -170,23 +232,51 @@ public:
|
||||||
* text mode, e.g. "{file}:{line} {info}" */
|
* text mode, e.g. "{file}:{line} {info}" */
|
||||||
std::string templateLocation;
|
std::string templateLocation;
|
||||||
|
|
||||||
/** @brief show timing information (--showtime=file|summary|top5) */
|
/** @brief defines given by the user */
|
||||||
SHOWTIME_MODES showtime;
|
std::string userDefines;
|
||||||
|
|
||||||
/** @brief Using -E for debugging purposes */
|
/** @brief undefines given by the user */
|
||||||
bool preprocessOnly;
|
std::set<std::string> userUndefs;
|
||||||
|
|
||||||
bool posix() const {
|
/** @brief forced includes given by the user */
|
||||||
return std::find(libraries.begin(), libraries.end(), "posix") != libraries.end();
|
std::list<std::string> userIncludes;
|
||||||
|
|
||||||
|
/** @brief Is --verbose given? */
|
||||||
|
bool verbose;
|
||||||
|
|
||||||
|
/** @brief write XML results (--xml) */
|
||||||
|
bool xml;
|
||||||
|
|
||||||
|
/** @brief XML version (--xml-version=..) */
|
||||||
|
int xml_version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief return true if a included file is to be excluded in Preprocessor::getConfigs
|
||||||
|
* @return true for the file to be excluded.
|
||||||
|
*/
|
||||||
|
bool configurationExcluded(const std::string &file) const {
|
||||||
|
for (std::set<std::string>::const_iterator i=configExcludePaths.begin(); i!=configExcludePaths.end(); ++i) {
|
||||||
|
if (file.length()>=i->length() && file.compare(0,i->length(),*i)==0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief List of include paths, e.g. "my/includes/" which should be used
|
/**
|
||||||
for finding include files inside source files. (-I) */
|
* @brief Enable extra checks by id. See isEnabled()
|
||||||
std::list<std::string> includePaths;
|
* @param str single id or list of id values to be enabled
|
||||||
|
* or empty string to enable all. e.g. "style,possibleError"
|
||||||
|
* @return error message. empty upon success
|
||||||
|
*/
|
||||||
|
std::string addEnabled(const std::string &str);
|
||||||
|
|
||||||
/** @brief Maximum number of configurations to check before bailing.
|
/**
|
||||||
Default is 12. (--max-configs=N) */
|
* @brief Disables all severities, except from error.
|
||||||
unsigned int maxConfigs;
|
*/
|
||||||
|
void clearEnabled() {
|
||||||
|
mEnabled = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns true if given id is in the list of
|
* @brief Returns true if given id is in the list of
|
||||||
|
@ -210,109 +300,19 @@ public:
|
||||||
*/
|
*/
|
||||||
bool isEnabled(const ValueFlow::Value *value, bool inconclusiveCheck=false) const;
|
bool isEnabled(const ValueFlow::Value *value, bool inconclusiveCheck=false) const;
|
||||||
|
|
||||||
/**
|
/** Is posix library specified? */
|
||||||
* @brief Enable extra checks by id. See isEnabled()
|
bool posix() const {
|
||||||
* @param str single id or list of id values to be enabled
|
return std::find(libraries.begin(), libraries.end(), "posix") != libraries.end();
|
||||||
* or empty string to enable all. e.g. "style,possibleError"
|
|
||||||
* @return error message. empty upon success
|
|
||||||
*/
|
|
||||||
std::string addEnabled(const std::string &str);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Disables all severities, except from error.
|
|
||||||
*/
|
|
||||||
void clearEnabled() {
|
|
||||||
mEnabled = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Language {
|
/** @brief Request termination of checking */
|
||||||
None, C, CPP
|
static void terminate(bool t = true) {
|
||||||
};
|
Settings::mTerminated = t;
|
||||||
|
}
|
||||||
|
|
||||||
/** @brief Name of the language that is enforced. Empty per default. */
|
/** @brief termination requested? */
|
||||||
Language enforcedLang;
|
static bool terminated() {
|
||||||
|
return Settings::mTerminated;
|
||||||
/** @brief suppress message (--suppressions) */
|
|
||||||
Suppressions nomsg;
|
|
||||||
|
|
||||||
/** @brief suppress exitcode */
|
|
||||||
Suppressions nofail;
|
|
||||||
|
|
||||||
/** @brief defines given by the user */
|
|
||||||
std::string userDefines;
|
|
||||||
|
|
||||||
/** @brief undefines given by the user */
|
|
||||||
std::set<std::string> userUndefs;
|
|
||||||
|
|
||||||
/** @brief forced includes given by the user */
|
|
||||||
std::list<std::string> userIncludes;
|
|
||||||
|
|
||||||
/** @brief include paths excluded from checking the configuration */
|
|
||||||
std::set<std::string> configExcludePaths;
|
|
||||||
|
|
||||||
|
|
||||||
/** @brief --report-progress */
|
|
||||||
bool reportProgress;
|
|
||||||
|
|
||||||
/** @brief --library= */
|
|
||||||
std::list<std::string> libraries;
|
|
||||||
|
|
||||||
/** Library */
|
|
||||||
Library library;
|
|
||||||
|
|
||||||
/** Rule */
|
|
||||||
class CPPCHECKLIB Rule {
|
|
||||||
public:
|
|
||||||
Rule()
|
|
||||||
: tokenlist("simple") // use simple tokenlist
|
|
||||||
, id("rule") // default id
|
|
||||||
, severity(Severity::style) { // default severity
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string tokenlist;
|
|
||||||
std::string pattern;
|
|
||||||
std::string id;
|
|
||||||
std::string summary;
|
|
||||||
Severity::SeverityType severity;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Extra rules
|
|
||||||
*/
|
|
||||||
std::list<Rule> rules;
|
|
||||||
|
|
||||||
std::list<std::string> addons;
|
|
||||||
|
|
||||||
/** Is the 'configuration checking' wanted? */
|
|
||||||
bool checkConfiguration;
|
|
||||||
|
|
||||||
/** Check for incomplete info in library files? */
|
|
||||||
bool checkLibrary;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check code in the headers, this is on by default but can
|
|
||||||
* be turned off to save CPU */
|
|
||||||
bool checkHeaders;
|
|
||||||
|
|
||||||
/** Check unused templates */
|
|
||||||
bool checkUnusedTemplates;
|
|
||||||
|
|
||||||
/** Struct contains standards settings */
|
|
||||||
Standards standards;
|
|
||||||
|
|
||||||
ImportProject project;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief return true if a included file is to be excluded in Preprocessor::getConfigs
|
|
||||||
* @return true for the file to be excluded.
|
|
||||||
*/
|
|
||||||
bool configurationExcluded(const std::string &file) const {
|
|
||||||
for (std::set<std::string>::const_iterator i=configExcludePaths.begin(); i!=configExcludePaths.end(); ++i) {
|
|
||||||
if (file.length()>=i->length() && file.compare(0,i->length(),*i)==0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue