Cppcheck
Functions
preprocessor.cpp File Reference
#include "preprocessor.h"
#include "errorlogger.h"
#include "errortypes.h"
#include "library.h"
#include "path.h"
#include "platform.h"
#include "settings.h"
#include "standards.h"
#include "suppressions.h"
#include "utils.h"
#include <algorithm>
#include <array>
#include <cstddef>
#include <iterator>
#include <sstream>
#include <utility>
#include <simplecpp.h>

Go to the source code of this file.

Functions

static bool sameline (const simplecpp::Token *tok1, const simplecpp::Token *tok2)
 
static std::string trim (const std::string &s)
 Remove heading and trailing whitespaces from the input parameter. More...
 
static bool parseInlineSuppressionCommentToken (const simplecpp::Token *tok, std::list< SuppressionList::Suppression > &inlineSuppressions, std::list< BadInlineSuppression > &bad)
 
static void addInlineSuppressions (const simplecpp::TokenList &tokens, const Settings &settings, SuppressionList &suppressions, std::list< BadInlineSuppression > &bad)
 
static std::string readcondition (const simplecpp::Token *iftok, const std::set< std::string > &defined, const std::set< std::string > &undefined)
 
static bool hasDefine (const std::string &userDefines, const std::string &cfg)
 
static std::string cfg (const std::vector< std::string > &configs, const std::string &userDefines)
 
static bool isUndefined (const std::string &cfg, const std::set< std::string > &undefined)
 
static bool getConfigsElseIsFalse (const std::vector< std::string > &configs_if, const std::string &userDefines)
 
static const simplecpp::Token * gotoEndIf (const simplecpp::Token *cmdtok)
 
static void getConfigs (const simplecpp::TokenList &tokens, std::set< std::string > &defined, const std::string &userDefines, const std::set< std::string > &undefined, std::set< std::string > &ret)
 
static void splitcfg (const std::string &cfg, std::list< std::string > &defines, const std::string &defaultValue)
 
static simplecpp::DUI createDUI (const Settings &mSettings, const std::string &cfg, const std::string &filename)
 

Function Documentation

◆ addInlineSuppressions()

static void addInlineSuppressions ( const simplecpp::TokenList &  tokens,
const Settings settings,
SuppressionList suppressions,
std::list< BadInlineSuppression > &  bad 
)
static

◆ cfg()

static std::string cfg ( const std::vector< std::string > &  configs,
const std::string &  userDefines 
)
static

◆ createDUI()

static simplecpp::DUI createDUI ( const Settings mSettings,
const std::string &  cfg,
const std::string &  filename 
)
static

◆ getConfigs()

static void getConfigs ( const simplecpp::TokenList &  tokens,
std::set< std::string > &  defined,
const std::string &  userDefines,
const std::set< std::string > &  undefined,
std::set< std::string > &  ret 
)
static

◆ getConfigsElseIsFalse()

static bool getConfigsElseIsFalse ( const std::vector< std::string > &  configs_if,
const std::string &  userDefines 
)
static

Definition at line 470 of file preprocessor.cpp.

References cfg().

Referenced by getConfigs().

◆ gotoEndIf()

static const simplecpp::Token* gotoEndIf ( const simplecpp::Token *  cmdtok)
static

Definition at line 478 of file preprocessor.cpp.

References sameline(), and startsWith().

Referenced by getConfigs().

◆ hasDefine()

static bool hasDefine ( const std::string &  userDefines,
const std::string &  cfg 
)
static

Definition at line 416 of file preprocessor.cpp.

References cfg().

Referenced by cfg().

◆ isUndefined()

static bool isUndefined ( const std::string &  cfg,
const std::set< std::string > &  undefined 
)
static

Definition at line 453 of file preprocessor.cpp.

References cfg().

Referenced by getConfigs().

◆ parseInlineSuppressionCommentToken()

static bool parseInlineSuppressionCommentToken ( const simplecpp::Token *  tok,
std::list< SuppressionList::Suppression > &  inlineSuppressions,
std::list< BadInlineSuppression > &  bad 
)
static

◆ readcondition()

static std::string readcondition ( const simplecpp::Token *  iftok,
const std::set< std::string > &  defined,
const std::set< std::string > &  undefined 
)
static

Definition at line 346 of file preprocessor.cpp.

References sameline().

Referenced by getConfigs().

◆ sameline()

static bool sameline ( const simplecpp::Token *  tok1,
const simplecpp::Token *  tok2 
)
static

◆ splitcfg()

static void splitcfg ( const std::string &  cfg,
std::list< std::string > &  defines,
const std::string &  defaultValue 
)
static

Definition at line 691 of file preprocessor.cpp.

References cfg().

Referenced by createDUI().

◆ trim()

static std::string trim ( const std::string &  s)
static

Remove heading and trailing whitespaces from the input parameter.

If string is all spaces/tabs, return empty string.

Parameters
sThe string to trim.

Definition at line 51 of file preprocessor.cpp.