Cppcheck
Public Member Functions | Private Member Functions | Static Private Member Functions | List of all members
CheckVaarg Class Reference

Checking for misusage of variable argument lists. More...

#include <checkvaarg.h>

Inheritance diagram for CheckVaarg:
Check

Public Member Functions

 CheckVaarg ()
 
- Public Member Functions inherited from Check
 Check (const std::string &aname)
 This constructor is used when registering the CheckClass. More...
 
virtual ~Check ()
 
 Check (const Check &)=delete
 
Checkoperator= (const Check &)=delete
 
const std::string & name () const
 class name, used to generate documentation More...
 
virtual FileInfogetFileInfo (const Tokenizer &, const Settings &) const
 
virtual FileInfoloadFileInfoFromXml (const tinyxml2::XMLElement *xmlElement) const
 
virtual bool analyseWholeProgram (const CTU::FileInfo *ctu, const std::list< FileInfo * > &fileInfo, const Settings &, ErrorLogger &)
 

Private Member Functions

 CheckVaarg (const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
 
void runChecks (const Tokenizer &tokenizer, ErrorLogger *errorLogger) override
 run checks, the token list is not simplified More...
 
void va_start_argument ()
 
void va_list_usage ()
 
void wrongParameterTo_va_start_error (const Token *tok, const std::string &paramIsName, const std::string &paramShouldName)
 
void referenceAs_va_start_error (const Token *tok, const std::string &paramName)
 
void va_end_missingError (const Token *tok, const std::string &varname)
 
void va_list_usedBeforeStartedError (const Token *tok, const std::string &varname)
 
void va_start_subsequentCallsError (const Token *tok, const std::string &varname)
 
void getErrorMessages (ErrorLogger *errorLogger, const Settings *settings) const override
 get error messages More...
 
std::string classInfo () const override
 get information about this class, used to generate documentation More...
 

Static Private Member Functions

static std::string myName ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Check
static std::list< Check * > & instances ()
 List of registered check classes. More...
 
static void writeToErrorList (const ErrorMessage &errmsg)
 Write given error to stdout in xml format. More...
 
- Protected Member Functions inherited from Check
 Check (std::string aname, const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
 This constructor is used when running checks. More...
 
void reportError (const Token *tok, const Severity severity, const std::string &id, const std::string &msg)
 report an error More...
 
void reportError (const Token *tok, const Severity severity, const std::string &id, const std::string &msg, const CWE &cwe, Certainty certainty)
 report an error More...
 
void reportError (const std::list< const Token * > &callstack, Severity severity, const std::string &id, const std::string &msg)
 report an error More...
 
void reportError (const std::list< const Token * > &callstack, Severity severity, const std::string &id, const std::string &msg, const CWE &cwe, Certainty certainty)
 report an error More...
 
void reportError (const ErrorPath &errorPath, Severity severity, const char id[], const std::string &msg, const CWE &cwe, Certainty certainty)
 
void logChecker (const char id[])
 log checker More...
 
ErrorPath getErrorPath (const Token *errtok, const ValueFlow::Value *value, std::string bug) const
 
bool wrongData (const Token *tok, const char *str)
 Use WRONG_DATA in checkers when you check for wrong data. More...
 
- Static Protected Member Functions inherited from Check
static std::string getMessageId (const ValueFlow::Value &value, const char id[])
 
- Protected Attributes inherited from Check
const Tokenizer *const mTokenizer {}
 
const Settings *const mSettings {}
 
ErrorLogger *const mErrorLogger {}
 

Detailed Description

Checking for misusage of variable argument lists.

Definition at line 42 of file checkvaarg.h.

Constructor & Destructor Documentation

◆ CheckVaarg() [1/2]

CheckVaarg::CheckVaarg ( )
inline

Definition at line 44 of file checkvaarg.h.

◆ CheckVaarg() [2/2]

CheckVaarg::CheckVaarg ( const Tokenizer tokenizer,
const Settings settings,
ErrorLogger errorLogger 
)
inlineprivate

Definition at line 47 of file checkvaarg.h.

Member Function Documentation

◆ classInfo()

std::string CheckVaarg::classInfo ( ) const
inlineoverrideprivatevirtual

get information about this class, used to generate documentation

Implements Check.

Definition at line 78 of file checkvaarg.h.

◆ getErrorMessages()

void CheckVaarg::getErrorMessages ( ErrorLogger errorLogger,
const Settings settings 
) const
inlineoverrideprivatevirtual

◆ myName()

static std::string CheckVaarg::myName ( )
inlinestaticprivate

Definition at line 74 of file checkvaarg.h.

◆ referenceAs_va_start_error()

void CheckVaarg::referenceAs_va_start_error ( const Token tok,
const std::string &  paramName 
)
private

Definition at line 90 of file checkvaarg.cpp.

References CWE758, error, normal, and Check::reportError().

Referenced by getErrorMessages(), and va_start_argument().

◆ runChecks()

void CheckVaarg::runChecks ( const Tokenizer ,
ErrorLogger  
)
inlineoverrideprivatevirtual

run checks, the token list is not simplified

Implements Check.

Definition at line 50 of file checkvaarg.h.

References Tokenizer::getSettings(), va_list_usage(), and va_start_argument().

◆ va_end_missingError()

void CheckVaarg::va_end_missingError ( const Token tok,
const std::string &  varname 
)
private

Definition at line 166 of file checkvaarg.cpp.

References CWE664, error, normal, and Check::reportError().

Referenced by getErrorMessages(), and va_list_usage().

◆ va_list_usage()

void CheckVaarg::va_list_usage ( )
private

◆ va_list_usedBeforeStartedError()

void CheckVaarg::va_list_usedBeforeStartedError ( const Token tok,
const std::string &  varname 
)
private

Definition at line 172 of file checkvaarg.cpp.

References CWE664, error, normal, and Check::reportError().

Referenced by getErrorMessages(), and va_list_usage().

◆ va_start_argument()

void CheckVaarg::va_start_argument ( )
private

◆ va_start_subsequentCallsError()

void CheckVaarg::va_start_subsequentCallsError ( const Token tok,
const std::string &  varname 
)
private

Definition at line 178 of file checkvaarg.cpp.

References CWE664, error, normal, and Check::reportError().

Referenced by getErrorMessages(), and va_list_usage().

◆ wrongParameterTo_va_start_error()

void CheckVaarg::wrongParameterTo_va_start_error ( const Token tok,
const std::string &  paramIsName,
const std::string &  paramShouldName 
)
private

Definition at line 84 of file checkvaarg.cpp.

References CWE688, normal, Check::reportError(), and warning.

Referenced by getErrorMessages(), and va_start_argument().


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