Cppcheck
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Settings Class Reference

This is just a container for general settings so that we don't need to pass individual values to functions or constructors now or in the future when we might have even more detailed settings. More...

#include <settings.h>

Classes

struct  SafeChecks
 Do not only check how interface is used. More...
 

Public Types

enum class  ExecutorType
 
enum class  CheckLevel { normal , exhaustive }
 
using ExecuteCmdFn = std::function< int(std::string, std::vector< std::string >, std::string, std::string &)>
 

Public Member Functions

 Settings ()
 
bool isPremiumEnabled (const char id[]) const
 Is checker id enabled by premiumArgs. More...
 
bool configurationExcluded (const std::string &file) const
 return true if a included file is to be excluded in Preprocessor::getConfigs More...
 
std::string addEnabled (const std::string &str)
 Enable extra checks by id. More...
 
std::string removeEnabled (const std::string &str)
 Disable extra checks by id. More...
 
bool isEnabled (const ValueFlow::Value *value, bool inconclusiveCheck=false) const
 Returns true if given value can be shown. More...
 
bool hasLib (const std::string &lib) const
 Is library specified? More...
 
void loadSummaries ()
 
bool useSingleJob () const
 
void setCheckLevel (CheckLevel level)
 
void setMisraRuleTexts (const ExecuteCmdFn &executeCommand)
 
void setMisraRuleTexts (const std::string &data)
 
std::string getMisraRuleText (const std::string &id, const std::string &text) const
 

Static Public Member Functions

static std::string loadCppcheckCfg (Settings &settings, Suppressions &suppressions)
 
static std::pair< std::string, std::string > getNameAndVersion (const std::string &productName)
 
static void terminate (bool t=true)
 Request termination of checking. More...
 
static bool terminated ()
 termination requested? More...
 
static ExecutorType defaultExecutor ()
 

Public Attributes

std::unordered_set< std::string > addons
 addons, either filename of python/json file or json data More...
 
std::vector< AddonInfoaddonInfos
 the loaded addons infos More...
 
std::string addonPython
 Path to the python interpreter to be used to run addons. More...
 
std::vector< std::string > basePaths
 Paths used as base for conversion to relative paths. More...
 
std::string buildDir
 –cppcheck-build-dir. More...
 
bool checkAllConfigurations = true
 check all configurations (false if -D or –max-configs is used More...
 
bool checkConfiguration {}
 Is the 'configuration checking' wanted? More...
 
bool checkHeaders = true
 Check code in the headers, this is on by default but can be turned off to save CPU. More...
 
bool checkLibrary {}
 Check for incomplete info in library files? More...
 
int checksMaxTime {}
 The maximum time in seconds for the checks of a single file. More...
 
std::string checkersReportFilename
 –checkers-report=<filename> : Generate report of executed checkers More...
 
std::set< std::string > checkUnknownFunctionReturn
 check unknown function return values More...
 
bool checkUnusedTemplates = true
 Check unused/uninstantiated templates. More...
 
bool clang {}
 Use Clang. More...
 
std::string clangExecutable = "clang"
 Custom Clang executable. More...
 
bool clangTidy {}
 Use clang-tidy. More...
 
bool clearIncludeCache {}
 Internal: Clear the simplecpp non-existing include cache. More...
 
std::set< std::string > configExcludePaths
 include paths excluded from checking the configuration More...
 
std::string cppcheckCfgProductName
 cppcheck.cfg: Custom product name More...
 
std::string cppcheckCfgAbout
 cppcheck.cfg: About text More...
 
bool daca {}
 Are we running from DACA script? More...
 
bool debugnormal {}
 Is –debug-normal given? More...
 
bool debugSimplified {}
 Is –debug-simplified given? More...
 
bool debugtemplate {}
 Is –debug-template given? More...
 
bool debugwarnings {}
 Is –debug-warnings given? More...
 
bool dump {}
 Is –dump given? More...
 
std::string dumpFile
 
Standards::Language enforcedLang {}
 Name of the language that is enforced. More...
 
ExecutorType executor
 
std::string exename
 
int exitCode {}
 If errors are found, this value is returned from main(). More...
 
std::vector< std::string > fileFilters
 List of –file-filter for analyzing special files. More...
 
bool force {}
 Force checking the files with "too many" configurations (–force). More...
 
std::list< std::string > includePaths
 List of include paths, e.g. More...
 
bool inlineSuppressions {}
 Is –inline-suppr given? More...
 
unsigned int jobs = 1
 How many processes/threads should do checking at the same time. More...
 
std::list< std::string > libraries
 –library= More...
 
Library library
 Library. More...
 
int loadAverage {}
 Load average value. More...
 
int maxConfigs = 12
 Maximum number of configurations to check before bailing. More...
 
int maxCtuDepth = 2
 –max-ctu-depth More...
 
int maxTemplateRecursion = 100
 max template recursion More...
 
std::string outputFile
 write results (–output-file=<file>) More...
 
Platform platform
 
int performanceValueFlowMaxTime = -1
 Experimental: –performance-valueflow-max-time=T. More...
 
int performanceValueFlowMaxIfCount = -1
 –performance-valueflow-max-if-count=C More...
 
int performanceValueFlowMaxSubFunctionArgs = 256
 max number of sets of arguments to pass to subfuncions in valueflow More...
 
int pid
 pid of cppcheck. More...
 
std::string plistOutput
 plist output (–plist-output=<dir>) More...
 
std::string premiumArgs
 Extra arguments for Cppcheck Premium addon. More...
 
bool preprocessOnly {}
 Using -E for debugging purposes. More...
 
bool quiet {}
 Is –quiet given? More...
 
bool relativePaths {}
 Use relative paths in output. More...
 
int reportProgress {-1}
 –report-progress More...
 
bool safety = false
 Safety certified behavior Show checkers report when Cppcheck finishes Make cppcheck checking more strict about critical errors. More...
 
SafeChecks safeChecks
 
SimpleEnableGroup< Severityseverity
 
SimpleEnableGroup< Certaintycertainty
 
SimpleEnableGroup< Checkschecks
 
SHOWTIME_MODES showtime {}
 show timing information (–showtime=file|summary|top5) More...
 
Standards standards
 Struct contains standards settings. More...
 
Suppressions supprs
 suppressions More...
 
std::string templateFormat
 The output format in which the errors are printed in text mode, e.g. More...
 
std::string templateLocation
 The output format in which the error locations are printed in text mode, e.g. More...
 
std::size_t templateMaxTime {}
 The maximum time in seconds for the template instantiation. More...
 
std::size_t typedefMaxTime {}
 The maximum time in seconds for the typedef simplification. More...
 
std::string userDefines
 defines given by the user More...
 
std::set< std::string > userUndefs
 undefines given by the user More...
 
std::list< std::string > userIncludes
 forced includes given by the user More...
 
std::size_t valueFlowMaxIterations = 4
 the maximum iterations of valueflow (–valueflow-max-iterations=T) More...
 
bool verbose {}
 Is –verbose given? More...
 
bool xml {}
 write XML results (–xml) More...
 
int xml_version = 2
 XML version (–xml-version=..) More...
 
std::set< std::string > summaryReturn
 
CheckLevel checkLevel = CheckLevel::exhaustive
 

Private Member Functions

std::string applyEnabled (const std::string &str, bool enable)
 

Static Private Member Functions

static std::string parseEnabled (const std::string &str, std::tuple< SimpleEnableGroup< Severity >, SimpleEnableGroup< Checks >> &groups)
 

Private Attributes

std::map< std::string, std::string > mMisraRuleTexts
 

Static Private Attributes

static std::atomic< bool > mTerminated
 terminate checking More...
 

Detailed Description

This is just a container for general settings so that we don't need to pass individual values to functions or constructors now or in the future when we might have even more detailed settings.

Definition at line 95 of file settings.h.

Member Typedef Documentation

◆ ExecuteCmdFn

using Settings::ExecuteCmdFn = std::function<int (std::string,std::vector<std::string>,std::string,std::string&)>

Definition at line 469 of file settings.h.

Member Enumeration Documentation

◆ CheckLevel

enum Settings::CheckLevel
strong
Enumerator
normal 
exhaustive 

Definition at line 461 of file settings.h.

◆ ExecutorType

Definition at line 197 of file settings.h.

Constructor & Destructor Documentation

◆ Settings()

Settings::Settings ( )

Member Function Documentation

◆ addEnabled()

std::string Settings::addEnabled ( const std::string &  str)

Enable extra checks by id.

See isEnabled()

Parameters
strsingle id or list of id values to be enabled or empty string to enable all. e.g. "style,possibleError"
Returns
error message. empty upon success

Definition at line 242 of file settings.cpp.

References applyEnabled().

Referenced by CmdLineParser::parseFromArgs().

◆ applyEnabled()

std::string Settings::applyEnabled ( const std::string &  str,
bool  enable 
)
private

◆ configurationExcluded()

bool Settings::configurationExcluded ( const std::string &  file) const
inline

return true if a included file is to be excluded in Preprocessor::getConfigs

Returns
true for the file to be excluded.

Definition at line 410 of file settings.h.

Referenced by Preprocessor::getConfigs().

◆ defaultExecutor()

Settings::ExecutorType Settings::defaultExecutor ( )
static

Definition at line 668 of file settings.cpp.

Referenced by CmdLineParser::parseFromArgs(), and Settings().

◆ getMisraRuleText()

std::string Settings::getMisraRuleText ( const std::string &  id,
const std::string &  text 
) const

Definition at line 661 of file settings.cpp.

References mMisraRuleTexts.

Referenced by CppCheck::executeAddons().

◆ getNameAndVersion()

std::pair< std::string, std::string > Settings::getNameAndVersion ( const std::string &  productName)
static

Definition at line 159 of file settings.cpp.

Referenced by ErrorMessage::getXMLHeader(), and XmlReportV2::writeHeader().

◆ hasLib()

bool Settings::hasLib ( const std::string &  lib) const
inline

◆ isEnabled()

bool Settings::isEnabled ( const ValueFlow::Value value,
bool  inconclusiveCheck = false 
) const

◆ isPremiumEnabled()

bool Settings::isPremiumEnabled ( const char  id[]) const

Is checker id enabled by premiumArgs.

Definition at line 608 of file settings.cpp.

References autosarCheckers, certCCheckers, certCppCheckers, misrac2012Checkers, misrac2023Checkers, misracpp2008Checkers, misracpp2023Checkers, and premiumArgs.

Referenced by CheckUnusedVar::allocatedButUnusedVariableError(), CheckCondition::alwaysTrueFalse(), CheckBufferOverrun::argumentSize(), CheckAutoVariables::assignFunctionArg(), CheckCondition::assignIf(), CheckOther::checkAccessOfMovedVariable(), CheckCondition::checkAssignmentInCondition(), CheckCondition::checkBadBitmaskCheck(), CheckExceptionSafety::checkCatchExceptionByValue(), CheckCondition::checkCompareValueOutOfTypeRange(), CheckBool::checkComparisonOfBoolExpressionWithInt(), CheckClass::checkConst(), CheckOther::checkConstPointer(), CheckOther::checkConstVariable(), CheckCondition::checkDuplicateConditionalAssign(), CheckOther::checkDuplicateExpression(), CheckClass::checkDuplInheritedMembers(), CheckClass::checkExplicitConstructors(), CheckMemoryLeakNoVar::checkForUnsafeArgAlloc(), CheckOther::checkFuncArgNamesDifferent(), CheckUnusedVar::checkFunctionVariableUsage(), CheckFunctions::checkIgnoredReturnValue(), CheckCondition::checkIncorrectLogicOperator(), CheckBool::checkIncrementBoolean(), CheckOther::checkKnownArgument(), CheckOther::checkKnownPointerToBool(), CheckType::checkLongCast(), CheckFunctions::checkMathFunctions(), CheckOther::checkMisusedScopedObject(), CheckOther::checkModuloOfOne(), CheckOther::checkNanInArithmeticExpression(), CheckClass::checkOverride(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantPointerOp(), CheckExceptionSafety::checkRethrowCopy(), CheckClass::checkReturnByReference(), CheckOther::checkShadowVariables(), CheckOther::checkSignOfUnsignedVariable(), CheckUnusedVar::checkStructMemberUsage(), CheckOther::checkUnreachableCode(), CheckOther::checkUnusedLabel(), CheckClass::checkUselessOverride(), CheckOther::checkVariableScope(), CheckOther::clarifyCalculation(), CheckCondition::clarifyCondition(), CheckCondition::comparison(), CheckClass::constructors(), CheckCondition::duplicateCondition(), CheckClass::initializerListOrder(), CheckIO::invalidLengthModifierError(), CheckIO::invalidScanf(), CheckStl::knownEmptyContainer(), CheckCondition::multiCondition(), CheckCondition::multiCondition2(), CheckNullPointer::nullPointerError(), CheckClass::operatorEqRetRefThis(), CheckClass::operatorEqToSelf(), CheckBufferOverrun::pointerArithmetic(), CheckClass::privateFunctions(), CheckStl::redundantCondition(), CheckSizeof::sizeofFunction(), CheckUnusedVar::unassignedVariableError(), CheckExceptionSafety::unhandledExceptionSpecification(), CheckUnusedVar::unreadVariableError(), CheckMemoryLeakInClass::unsafeClassError(), CheckUnusedVar::unusedVariableError(), CheckStl::useStlAlgorithm(), CheckClass::virtualFunctionCallInConstructorError(), CheckOther::warningOldStylePointerCast(), CheckIO::wrongPrintfScanfArgumentsError(), and CheckIO::wrongPrintfScanfPosixParameterPositionError().

◆ loadCppcheckCfg()

std::string Settings::loadCppcheckCfg ( Settings settings,
Suppressions suppressions 
)
static

◆ loadSummaries()

void Settings::loadSummaries ( )

◆ parseEnabled()

std::string Settings::parseEnabled ( const std::string &  str,
std::tuple< SimpleEnableGroup< Severity >, SimpleEnableGroup< Checks >> &  groups 
)
staticprivate

◆ removeEnabled()

std::string Settings::removeEnabled ( const std::string &  str)

Disable extra checks by id.

Parameters
strsingle id or list of id values to be enabled or empty string to enable all. e.g. "style,possibleError"
Returns
error message. empty upon success

Definition at line 247 of file settings.cpp.

References applyEnabled().

Referenced by CmdLineParser::parseFromArgs().

◆ setCheckLevel()

void Settings::setCheckLevel ( CheckLevel  level)

◆ setMisraRuleTexts() [1/2]

void Settings::setMisraRuleTexts ( const ExecuteCmdFn executeCommand)

Definition at line 625 of file settings.cpp.

References addonInfos, and premiumArgs.

Referenced by CppCheckExecutor::check(), and MainWindow::getCppcheckSettings().

◆ setMisraRuleTexts() [2/2]

void Settings::setMisraRuleTexts ( const std::string &  data)

Definition at line 644 of file settings.cpp.

References mMisraRuleTexts.

◆ terminate()

static void Settings::terminate ( bool  t = true)
inlinestatic

◆ terminated()

static bool Settings::terminated ( )
inlinestatic

◆ useSingleJob()

bool Settings::useSingleJob ( ) const
inline

Member Data Documentation

◆ addonInfos

std::vector<AddonInfo> Settings::addonInfos

the loaded addons infos

Definition at line 112 of file settings.h.

Referenced by CppCheck::executeAddons(), MainWindow::loadAddon(), CmdLineParser::loadAddons(), and setMisraRuleTexts().

◆ addonPython

std::string Settings::addonPython

Path to the python interpreter to be used to run addons.

Definition at line 115 of file settings.h.

Referenced by CppCheck::executeAddons(), and CmdLineParser::parseFromArgs().

◆ addons

std::unordered_set<std::string> Settings::addons

◆ basePaths

std::vector<std::string> Settings::basePaths

◆ buildDir

std::string Settings::buildDir

◆ certainty

SimpleEnableGroup<Certainty> Settings::certainty

Definition at line 359 of file settings.h.

Referenced by CheckNullPointer::arithmetic(), CheckAutoVariables::autoVariables(), LifetimeStore::byDerefCopy(), LifetimeStore::byRef(), LifetimeStore::byVal(), CheckOther::checkAccessOfMovedVariable(), CheckBool::checkBitwiseOnBoolean(), CheckClass::checkConst(), CheckStl::checkDereferenceInvalidIterator2(), CheckOther::checkDuplicateBranch(), CheckOther::checkDuplicateExpression(), CheckMemoryLeakNoVar::checkForUnsafeArgAlloc(), CheckOther::checkFuncArgNamesDifferent(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkIncompleteStatement(), CheckCondition::checkIncorrectLogicOperator(), CheckOther::checkInvalidFree(), CheckOther::checkPassByReference(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantCopy(), CheckOther::checkSuspiciousCaseInSwitch(), CheckOther::checkSuspiciousSemicolon(), CheckOther::checkUnreachableCode(), CheckAutoVariables::checkVarLifetimeScope(), CheckClass::constructors(), CheckExceptionSafety::deallocThrow(), MainWindow::getCppcheckSettings(), Token::getInvalidValue(), CheckClass::initializerListOrder(), CheckOther::invalidPointerCast(), CheckIO::invalidScanfFormatWidthError(), isEnabled(), CheckStl::iterators(), CheckNullPointer::nullPointerByDeRefAndChec(), CheckStl::outOfBounds(), CmdLineParser::parseFromArgs(), Settings(), CheckSizeof::sizeofCalculation(), CheckStl::string_c_str(), CheckBufferOverrun::stringNotZeroTerminated(), CheckSizeof::suspiciousSizeofCalculation(), CheckExceptionSafety::unhandledExceptionSpecification(), valueFlowLifetime(), and CheckClass::virtualDestructor().

◆ checkAllConfigurations

bool Settings::checkAllConfigurations = true

check all configurations (false if -D or –max-configs is used

Definition at line 124 of file settings.h.

Referenced by CppCheck::checkFile(), MainWindow::getCppcheckSettings(), and CmdLineParser::parseFromArgs().

◆ checkConfiguration

bool Settings::checkConfiguration {}

◆ checkersReportFilename

std::string Settings::checkersReportFilename

–checkers-report=<filename> : Generate report of executed checkers

Definition at line 141 of file settings.h.

Referenced by CppCheckExecutor::check_internal(), and CmdLineParser::parseFromArgs().

◆ checkHeaders

bool Settings::checkHeaders = true

Check code in the headers, this is on by default but can be turned off to save CPU.

Definition at line 132 of file settings.h.

Referenced by MainWindow::getCppcheckSettings(), ImportProject::importCppcheckGuiProject(), and Tokenizer::simplifyHeadersAndUnusedTemplates().

◆ checkLevel

CheckLevel Settings::checkLevel = CheckLevel::exhaustive

Definition at line 465 of file settings.h.

Referenced by setCheckLevel(), and valueFlowConditionExpressions().

◆ checkLibrary

bool Settings::checkLibrary {}

◆ checks

SimpleEnableGroup<Checks> Settings::checks

◆ checksMaxTime

int Settings::checksMaxTime {}

The maximum time in seconds for the checks of a single file.

Definition at line 138 of file settings.h.

Referenced by CppCheck::checkNormalTokens(), and CmdLineParser::parseFromArgs().

◆ checkUnknownFunctionReturn

std::set<std::string> Settings::checkUnknownFunctionReturn

check unknown function return values

Definition at line 144 of file settings.h.

Referenced by MainWindow::getCppcheckSettings(), and valueFlowUnknownFunctionReturn().

◆ checkUnusedTemplates

bool Settings::checkUnusedTemplates = true

◆ clang

bool Settings::clang {}

◆ clangExecutable

std::string Settings::clangExecutable = "clang"

Custom Clang executable.

Definition at line 153 of file settings.h.

Referenced by CppCheck::checkClang(), and CmdLineParser::parseFromArgs().

◆ clangTidy

bool Settings::clangTidy {}

◆ clearIncludeCache

bool Settings::clearIncludeCache {}

Internal: Clear the simplecpp non-existing include cache.

Definition at line 159 of file settings.h.

Referenced by createDUI().

◆ configExcludePaths

std::set<std::string> Settings::configExcludePaths

include paths excluded from checking the configuration

Definition at line 162 of file settings.h.

Referenced by CmdLineParser::parseFromArgs().

◆ cppcheckCfgAbout

std::string Settings::cppcheckCfgAbout

cppcheck.cfg: About text

Definition at line 168 of file settings.h.

Referenced by loadCppcheckCfg(), and MainWindow::MainWindow().

◆ cppcheckCfgProductName

std::string Settings::cppcheckCfgProductName

◆ daca

bool Settings::daca {}

◆ debugnormal

bool Settings::debugnormal {}

◆ debugSimplified

bool Settings::debugSimplified {}

Is –debug-simplified given?

Definition at line 177 of file settings.h.

Referenced by CmdLineParser::parseFromArgs(), and Tokenizer::printDebugOutput().

◆ debugtemplate

bool Settings::debugtemplate {}

◆ debugwarnings

bool Settings::debugwarnings {}

◆ dump

bool Settings::dump {}

Is –dump given?

Definition at line 186 of file settings.h.

Referenced by CppCheck::checkFile(), createDumpFile(), getDumpFileName(), and CmdLineParser::parseFromArgs().

◆ dumpFile

std::string Settings::dumpFile

Definition at line 187 of file settings.h.

Referenced by getDumpFileName().

◆ enforcedLang

Standards::Language Settings::enforcedLang {}

Name of the language that is enforced.

Empty per default.

Definition at line 190 of file settings.h.

Referenced by createDumpFile(), MainWindow::getCppcheckSettings(), CmdLineParser::parseFromArgs(), and TokenList::TokenList().

◆ executor

ExecutorType Settings::executor

◆ exename

std::string Settings::exename

◆ exitCode

int Settings::exitCode {}

If errors are found, this value is returned from main().

Default value is 0.

Definition at line 214 of file settings.h.

Referenced by CppCheckExecutor::check_internal(), and CmdLineParser::parseFromArgs().

◆ fileFilters

std::vector<std::string> Settings::fileFilters

List of –file-filter for analyzing special files.

Definition at line 217 of file settings.h.

Referenced by CmdLineParser::fillSettingsFromArgs(), ImportProject::import(), and CmdLineParser::parseFromArgs().

◆ force

bool Settings::force {}

Force checking the files with "too many" configurations (–force).

Definition at line 220 of file settings.h.

Referenced by CppCheck::checkFile(), MainWindow::doAnalyzeProject(), MainWindow::getCppcheckSettings(), Preprocessor::handleErrors(), and CmdLineParser::parseFromArgs().

◆ includePaths

std::list<std::string> Settings::includePaths

List of include paths, e.g.

"my/includes/" which should be used for finding include files inside source files. (-I)

Definition at line 224 of file settings.h.

Referenced by MainWindow::addIncludeDirs(), CppCheck::check(), CppCheck::checkClang(), CppCheck::checkFile(), createDUI(), CmdLineParser::fillSettingsFromArgs(), ImportProject::importCppcheckGuiProject(), and CmdLineParser::parseFromArgs().

◆ inlineSuppressions

bool Settings::inlineSuppressions {}

Is –inline-suppr given?

Definition at line 227 of file settings.h.

Referenced by MainWindow::getCppcheckSettings(), Preprocessor::inlineSuppressions(), and CmdLineParser::parseFromArgs().

◆ jobs

unsigned int Settings::jobs = 1

◆ libraries

std::list<std::string> Settings::libraries

◆ library

Library Settings::library

Library.

Definition at line 237 of file settings.h.

Referenced by ConditionHandler::afterCondition(), CheckUnusedFunctions::analyseWholeProgram(), Variable::arrayDimensions(), CheckAssert::assertWithSideEffects(), astFunctionYield(), CheckAutoVariables::autoVariables(), CheckBufferOverrun::bufferOverflow(), CheckLeakAutoVar::changeAllocStatusIfRealloc(), CheckUnusedFunctions::check(), CheckBool::checkBitwiseOnBoolean(), checkBufferSize(), CheckOther::checkComparePointers(), CheckClass::checkConst(), CheckClass::checkConstFunc(), CheckOther::checkConstPointer(), CheckOther::checkDuplicateExpression(), CppCheck::checkFile(), CheckIO::checkFileUsage(), CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(), CheckMemoryLeakNoVar::checkForUnusedReturnValue(), CheckUnusedVar::checkFunctionVariableUsage(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), CheckFunctions::checkIgnoredReturnValue(), CheckOther::checkInnerScope(), CheckOther::checkInvalidFree(), CheckFunctions::checkLibraryMatchFunctions(), CheckClass::checkMemset(), CheckClass::checkMemsetType(), CheckFunctions::checkMissingReturn(), CheckOther::checkMisusedScopedObject(), CheckOther::checkOverlappingWrite(), CheckFunctions::checkProhibitedFunctions(), CheckMemoryLeakInFunction::checkReallocUsage(), FwdAnalysis::checkRecursive(), CheckOther::checkRedundantCopy(), CheckClass::checkReturnByReference(), CheckClass::checkReturnPtrThis(), CheckUninitVar::checkScope(), CheckLeakAutoVar::checkScope(), CheckUninitVar::checkScopeForVariable(), CheckSizeof::checkSizeofForPointerSize(), CheckMemoryLeakStructMember::checkStructVariable(), CheckLeakAutoVar::checkTokenInsideExpression(), CheckOther::checkUnreachableCode(), CheckAutoVariables::checkVarLifetimeScope(), CheckIO::checkWrongPrintfScanfArguments(), CheckLeakAutoVar::configurationInfo(), CheckClass::constructors(), CheckClass::copyconstructors(), createDUI(), SymbolDatabase::createSymbolDatabaseEscapeFunctions(), SymbolDatabase::createSymbolDatabaseIncompleteVars(), SymbolDatabase::createSymbolDatabaseSetVariablePointers(), Tokenizer::dump(), Variable::evaluate(), CmdLineParser::fillSettingsFromArgs(), findExpressionChangedSkipDeadCode(), ValueType::fromLibraryType(), CheckLeakAutoVar::functionCall(), CheckMemoryLeak::getAllocationType(), getCastTypeStartToken(), getContainerYield(), MainWindow::getCppcheckSettings(), CheckMemoryLeak::getDeallocationType(), CheckFunctions::getErrorMessages(), getFunctionUsage(), Token::getInvalidValue(), getOutparamAllocation(), CheckMemoryLeak::getReallocationType(), CheckClass::getVirtualFunctionCalls(), CheckClass::hasAllocation(), Executor::hasToLog(), CheckStl::if_find(), CheckStl::invalidContainer(), CheckFunctions::invalidFunctionUsage(), isArrayArg(), isEscapeScope(), CheckUninitVar::isFunctionParUsage(), CheckIO::ArgumentInfo::isLibraryType(), CheckMemoryLeakStructMember::isMalloc(), CheckUninitVar::isMemberVariableAssignment(), CheckNullPointer::isPointerDeRef(), CheckMemoryLeak::isReopenStandardStream(), isSameExpression(), isSameIteratorContainerExpression(), Tokenizer::isScopeNoReturn(), isSimpleExpr(), isVariableChanged(), isVariableChangedByFunctionCall(), isVariableUsage(), CheckUninitVar::isVariableUsage(), CheckStl::knownEmptyContainer(), CmdLineParser::loadLibraries(), CheckStl::mismatchingContainers(), CheckCondition::multiCondition2(), CheckStl::negativeIndex(), CheckNullPointer::nullConstantDereference(), SymbolicConditionHandler::parse(), ContainerConditionHandler::parse(), parsedecl(), CheckUnusedFunctions::parseTokens(), programMemoryParseCondition(), CppCheck::reportErr(), setTokenValue(), SymbolDatabase::setValueType(), SymbolDatabase::setValueTypeInTokenList(), Tokenizer::simplifyTokenList1(), Tokenizer::sizeOfType(), CheckStl::stlBoundaries(), ConditionHandler::traverseCondition(), CheckExceptionSafety::unhandledExceptionSpecification(), CheckOther::unreachableCodeError(), CheckFunctions::useStandardLibrary(), CheckStl::useStlAlgorithm(), valueFlowConditionExpressions(), valueFlowDynamicBufferSize(), valueFlowForwardLifetime(), valueFlowLifetimeFunction(), valueFlowSubFunction(), valueFlowSymbolic(), valueFlowUninit(), valueFlowUnknownFunctionReturn(), and CheckMemoryLeakInClass::variable().

◆ loadAverage

int Settings::loadAverage {}

Load average value.

Definition at line 240 of file settings.h.

Referenced by ProcessExecutor::checkLoadAverage(), and CmdLineParser::parseFromArgs().

◆ maxConfigs

int Settings::maxConfigs = 12

Maximum number of configurations to check before bailing.

Default is 12. (–max-configs=N)

Definition at line 244 of file settings.h.

Referenced by CppCheck::checkFile(), MainWindow::getCppcheckSettings(), CmdLineParser::parseFromArgs(), and CppCheck::tooManyConfigsError().

◆ maxCtuDepth

int Settings::maxCtuDepth = 2

◆ maxTemplateRecursion

int Settings::maxTemplateRecursion = 100

◆ mMisraRuleTexts

std::map<std::string, std::string> Settings::mMisraRuleTexts
private

Definition at line 479 of file settings.h.

Referenced by getMisraRuleText(), and setMisraRuleTexts().

◆ mTerminated

std::atomic< bool > Settings::mTerminated
staticprivate

terminate checking

Definition at line 99 of file settings.h.

Referenced by terminate(), and terminated().

◆ outputFile

std::string Settings::outputFile

write results (–output-file=<file>)

Definition at line 253 of file settings.h.

Referenced by CmdLineParser::parseFromArgs().

◆ performanceValueFlowMaxIfCount

int Settings::performanceValueFlowMaxIfCount = -1

–performance-valueflow-max-if-count=C

Definition at line 261 of file settings.h.

Referenced by CmdLineParser::parseFromArgs(), and setCheckLevel().

◆ performanceValueFlowMaxSubFunctionArgs

int Settings::performanceValueFlowMaxSubFunctionArgs = 256

max number of sets of arguments to pass to subfuncions in valueflow

Definition at line 264 of file settings.h.

Referenced by productParams(), and setCheckLevel().

◆ performanceValueFlowMaxTime

int Settings::performanceValueFlowMaxTime = -1

Experimental: –performance-valueflow-max-time=T.

Definition at line 258 of file settings.h.

Referenced by CmdLineParser::parseFromArgs().

◆ pid

int Settings::pid

pid of cppcheck.

Intention is that this is set in the main process.

Definition at line 267 of file settings.h.

Referenced by CppCheck::executeAddons(), getDumpFileName(), and Settings().

◆ platform

Platform Settings::platform

Definition at line 255 of file settings.h.

Referenced by CheckIO::ArgumentInfo::ArgumentInfo(), CppCheck::check(), CheckCondition::checkCompareValueOutOfTypeRange(), CppCheck::checkFile(), CheckIO::checkFileUsage(), CheckType::checkFloatToIntegerOverflow(), CheckIO::checkFormatString(), CheckMemoryLeakNoVar::checkForUnreleasedInputArgument(), CheckOther::checkIncompleteArrayFill(), CheckType::checkIntegerOverflow(), CheckOther::checkInterlockedDecrement(), CheckType::checkLongCast(), CheckOther::checkPassByReference(), CheckOther::checkRedundantCopy(), CheckClass::checkReturnByReference(), CheckType::checkTooBigBitwiseShift(), CheckIO::checkWrongPrintfScanfArguments(), Tokenizer::combineStringAndCharLiterals(), createDUI(), createDumpFile(), Tokenizer::fillTypeSizes(), ValueType::fromLibraryType(), getAlignOf(), CheckBufferOverrun::getBufferSize(), MainWindow::getCppcheckSettings(), getDimensionsEtc(), CTU::getFileInfo(), getMinMaxValues(), ValueFlow::getSizeOf(), CheckBufferOverrun::isCtuUnsafeBufferUsage(), CheckFunctions::memsetInvalid2ndParam(), CheckBufferOverrun::objectIndex(), ValueType::parseDecl(), parsedecl(), CmdLineParser::parseFromArgs(), CheckLeakAutoVar::ret(), SymbolDatabase::setArrayDimensionsUsingValueFlow(), Preprocessor::setPlatformInfo(), setTokenValueCast(), setValues(), SymbolDatabase::setValueType(), SymbolDatabase::setValueTypeInTokenList(), SymbolDatabase::sizeOfType(), Tokenizer::sizeOfType(), SymbolDatabase::SymbolDatabase(), valueFlowDynamicBufferSize(), valueFlowRightShift(), valueFlowSafeFunctions(), and valueFlowSetConstantValue().

◆ plistOutput

std::string Settings::plistOutput

plist output (–plist-output=<dir>)

Definition at line 270 of file settings.h.

Referenced by CppCheck::checkFile(), CmdLineParser::parseFromArgs(), and CppCheck::reportErr().

◆ premiumArgs

std::string Settings::premiumArgs

◆ preprocessOnly

bool Settings::preprocessOnly {}

Using -E for debugging purposes.

Definition at line 279 of file settings.h.

Referenced by CppCheck::checkFile(), and CmdLineParser::parseFromArgs().

◆ quiet

bool Settings::quiet {}

◆ relativePaths

bool Settings::relativePaths {}

◆ reportProgress

int Settings::reportProgress {-1}

–report-progress

Definition at line 288 of file settings.h.

Referenced by CppCheckExecutor::check_internal(), and CmdLineParser::parseFromArgs().

◆ safeChecks

SafeChecks Settings::safeChecks

◆ safety

bool Settings::safety = false

Safety certified behavior Show checkers report when Cppcheck finishes Make cppcheck checking more strict about critical errors.

  • returns nonzero if there is critical errors
  • a critical error id is not suppressed (by mistake?) with glob pattern

Definition at line 313 of file settings.h.

Referenced by CppCheckExecutor::check_internal(), loadCppcheckCfg(), CmdLineParser::parseFromArgs(), and CppCheck::reportErr().

◆ severity

SimpleEnableGroup<Severity> Settings::severity

Definition at line 358 of file settings.h.

Referenced by CheckUnusedVar::allocatedButUnusedVariableError(), CheckCondition::alwaysTrueFalse(), CheckNullPointer::analyseWholeProgram(), applyEnabled(), CheckBufferOverrun::argumentSize(), CheckNullPointer::arithmetic(), CheckBufferOverrun::arrayIndexError(), CheckBufferOverrun::arrayIndexThenCheck(), CheckAssert::assertWithSideEffects(), CheckAutoVariables::assignFunctionArg(), CheckCondition::assignIf(), CppCheckExecutor::check_internal(), CheckOther::checkAccessOfMovedVariable(), CheckString::checkAlwaysTrueOrFalseStringCompare(), CheckBool::checkAssignBoolToFloat(), CheckCondition::checkAssignmentInCondition(), CheckCondition::checkBadBitmaskCheck(), CheckBool::checkBitwiseOnBoolean(), CheckOther::checkCastIntToCharAndBack(), CheckExceptionSafety::checkCatchExceptionByValue(), CheckOther::checkCharVariable(), CheckOther::checkCommaSeparatedReturn(), CheckCondition::checkCompareValueOutOfTypeRange(), CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalse(), CheckBool::checkComparisonOfBoolExpressionWithInt(), CheckBool::checkComparisonOfBoolWithBool(), CheckBool::checkComparisonOfBoolWithInt(), CheckBool::checkComparisonOfFuncReturningBool(), CheckClass::checkConst(), CheckOther::checkConstPointer(), CheckOther::checkConstVariable(), CheckClass::checkCopyCtorAndEqOperator(), CheckStl::checkDereferenceInvalidIterator(), CheckOther::checkDuplicateBranch(), CheckCondition::checkDuplicateConditionalAssign(), CheckOther::checkDuplicateExpression(), CheckClass::checkDuplInheritedMembers(), CheckOther::checkEvaluationOrder(), CheckClass::checkExplicitConstructors(), CppCheck::checkFile(), CheckIO::checkFileUsage(), CheckStl::checkFindInsert(), CheckIO::checkFormatString(), CheckMemoryLeakNoVar::checkForUnsafeArgAlloc(), CheckOther::checkFuncArgNamesDifferent(), CheckUnusedVar::checkFunctionVariableUsage(), CheckFunctions::checkIgnoredReturnValue(), CheckOther::checkIncompleteArrayFill(), CheckOther::checkIncompleteStatement(), CheckCondition::checkIncorrectLogicOperator(), CheckString::checkIncorrectStringCompare(), CheckBool::checkIncrementBoolean(), CheckCondition::checkInvalidTestForOverflow(), CheckOther::checkKnownArgument(), CheckOther::checkKnownPointerToBool(), CheckType::checkLongCast(), CheckFunctions::checkMathFunctions(), CheckClass::checkMemset(), CheckClass::checkMemsetType(), CheckOther::checkMisusedScopedObject(), CheckCondition::checkModuloAlwaysTrueFalse(), CheckOther::checkModuloOfOne(), CheckStl::checkMutexes(), CheckOther::checkNanInArithmeticExpression(), CheckOther::checkNegativeBitwiseShift(), CheckClass::checkOverride(), CheckOther::checkPassByReference(), CheckCondition::checkPointerAdditionResultNotNull(), CheckFunctions::checkProhibitedFunctions(), CheckMemoryLeakInClass::checkPublicFunctions(), CheckOther::checkRedundantAssignment(), CheckOther::checkRedundantCopy(), CheckOther::checkRedundantPointerOp(), CheckExceptionSafety::checkRethrowCopy(), CheckClass::checkReturnByReference(), CheckOther::checkShadowVariables(), CheckType::checkSignConversion(), CheckOther::checkSignOfUnsignedVariable(), CheckSizeof::checkSizeofForArrayParameter(), CheckSizeof::checkSizeofForNumericParameter(), CheckSizeof::checkSizeofForPointerSize(), CheckUnusedVar::checkStructMemberUsage(), CheckOther::checkSuspiciousCaseInSwitch(), CheckOther::checkSuspiciousSemicolon(), CheckString::checkSuspiciousStringCompare(), CheckClass::checkThisUseAfterFree(), CheckOther::checkUnreachableCode(), CheckClass::checkUnsafeClassRefMember(), CheckOther::checkUnusedLabel(), CheckClass::checkUselessOverride(), CheckOther::checkVarFuncNullUB(), CheckOther::checkVariableScope(), CheckClass::checkVirtualFunctionCallInConstructor(), CheckOther::clarifyCalculation(), CheckCondition::clarifyCondition(), CheckOther::clarifyStatement(), CheckCondition::comparison(), CheckClass::constructors(), CheckClass::copyconstructors(), CheckExceptionSafety::deallocThrow(), CheckExceptionSafety::destructors(), CheckCondition::duplicateCondition(), CppCheck::executeAddons(), CmdLineParser::fillSettingsFromArgs(), MainWindow::getCppcheckSettings(), CppCheck::getErrorMessages(), Token::getInvalidValue(), CheckStl::if_find(), CheckClass::initializationListUsage(), CheckClass::initializerListOrder(), CheckIO::invalidLengthModifierError(), CheckOther::invalidPointerCast(), CheckIO::invalidPrintfArgTypeError_float(), CheckIO::invalidPrintfArgTypeError_n(), CheckIO::invalidPrintfArgTypeError_p(), CheckIO::invalidPrintfArgTypeError_s(), CheckIO::invalidPrintfArgTypeError_sint(), CheckIO::invalidPrintfArgTypeError_uint(), CheckIO::invalidScanf(), CheckIO::invalidScanfArgTypeError_float(), CheckIO::invalidScanfArgTypeError_int(), CheckIO::invalidScanfArgTypeError_s(), CheckIO::invalidScanfFormatWidthError(), isEnabled(), CheckStl::knownEmptyContainer(), CheckFunctions::memsetInvalid2ndParam(), CheckFunctions::memsetZeroBytes(), CheckStl::missingComparison(), CheckCondition::multiCondition(), CheckCondition::multiCondition2(), CheckBufferOverrun::negativeIndexError(), CheckClass::operatorEqRetRefThis(), CheckClass::operatorEqToSelf(), CheckStl::outOfBounds(), CheckString::overlappingStrcmp(), parseEnabled(), CheckBufferOverrun::pointerArithmetic(), Check64BitPortability::pointerassignment(), CheckPostfixOperator::postfixOperator(), CheckClass::privateFunctions(), CppCheck::purgedConfigurationMessage(), CheckOther::redundantBitwiseOperationInSwitchError(), CheckStl::redundantCondition(), SymbolDatabase::returnImplicitIntError(), CheckFunctions::returnLocalStdMove(), CheckBool::returnValueOfFunctionReturningBool(), Settings(), TemplateSimplifier::simplifyTemplateInstantiations(), Tokenizer::simplifyTokenList1(), Tokenizer::simplifyTokens1(), Tokenizer::simplifyTypedef(), CheckStl::size(), CheckSizeof::sizeofCalculation(), CheckSizeof::sizeofFunction(), CheckSizeof::sizeofsizeof(), CheckSizeof::sizeofVoid(), CheckStl::string_c_str(), CheckBufferOverrun::stringNotZeroTerminated(), CheckSizeof::suspiciousSizeofCalculation(), CheckClass::thisSubtraction(), CheckType::tooBigSignedBitwiseShiftError(), CppCheck::tooManyConfigsError(), CheckUnusedVar::unassignedVariableError(), CheckExceptionSafety::unhandledExceptionSpecification(), CheckUnusedVar::unreadVariableError(), CheckMemoryLeakInClass::unsafeClassError(), CheckOther::unusedLabelError(), CheckUnusedVar::unusedVariableError(), TemplateSimplifier::useDefaultArgumentValues(), CheckStl::uselessCalls(), CheckFunctions::useStandardLibrary(), CheckStl::useStlAlgorithm(), CheckVaarg::va_start_argument(), CheckClass::virtualDestructorError(), CheckClass::virtualFunctionCallInConstructorError(), CheckOther::warningOldStylePointerCast(), CheckIO::wrongPrintfScanfArgumentsError(), and CheckIO::wrongPrintfScanfPosixParameterPositionError().

◆ showtime

SHOWTIME_MODES Settings::showtime {}

◆ standards

Standards Settings::standards

◆ summaryReturn

std::set<std::string> Settings::summaryReturn

Definition at line 453 of file settings.h.

Referenced by Tokenizer::isScopeNoReturn(), and loadSummaries().

◆ supprs

Suppressions Settings::supprs

◆ templateFormat

std::string Settings::templateFormat

The output format in which the errors are printed in text mode, e.g.

"{severity} {file}:{line} {message} {id}"

Definition at line 373 of file settings.h.

Referenced by CmdLineParser::parseFromArgs().

◆ templateLocation

std::string Settings::templateLocation

The output format in which the error locations are printed in text mode, e.g.

"{file}:{line} {info}"

Definition at line 377 of file settings.h.

Referenced by Check::getErrorPath(), and CmdLineParser::parseFromArgs().

◆ templateMaxTime

std::size_t Settings::templateMaxTime {}

The maximum time in seconds for the template instantiation.

Definition at line 380 of file settings.h.

Referenced by CmdLineParser::parseFromArgs(), and Tokenizer::simplifyTemplates().

◆ typedefMaxTime

std::size_t Settings::typedefMaxTime {}

The maximum time in seconds for the typedef simplification.

Definition at line 383 of file settings.h.

Referenced by CmdLineParser::parseFromArgs(), and Tokenizer::simplifyTypedefCpp().

◆ userDefines

std::string Settings::userDefines

◆ userIncludes

std::list<std::string> Settings::userIncludes

forced includes given by the user

Definition at line 392 of file settings.h.

Referenced by createDUI(), and CmdLineParser::parseFromArgs().

◆ userUndefs

std::set<std::string> Settings::userUndefs

◆ valueFlowMaxIterations

std::size_t Settings::valueFlowMaxIterations = 4

the maximum iterations of valueflow (–valueflow-max-iterations=T)

Definition at line 395 of file settings.h.

Referenced by CmdLineParser::parseFromArgs().

◆ verbose

bool Settings::verbose {}

◆ xml

bool Settings::xml {}

◆ xml_version

int Settings::xml_version = 2

XML version (–xml-version=..)

Definition at line 404 of file settings.h.

Referenced by CmdLineParser::parseFromArgs().


The documentation for this class was generated from the following files: