Skip to content

Commit cd5ba3e

Browse files
committed
avoid redundant initialization of simplecpp::Macro::nameTokDef
1 parent 135e978 commit cd5ba3e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

simplecpp.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,12 +1490,12 @@ namespace simplecpp {
14901490

14911491
class Macro {
14921492
public:
1493-
explicit Macro(std::vector<std::string> &f) : nameTokDef(nullptr), valueToken(nullptr), endToken(nullptr), files(f), tokenListDefine(new TokenList(f)), variadic(false), variadicOpt(false), valueDefinedInCode_(false) {}
1493+
explicit Macro(std::vector<std::string> &f) : valueToken(nullptr), endToken(nullptr), files(f), tokenListDefine(new TokenList(f)), variadic(false), variadicOpt(false), valueDefinedInCode_(false) {}
14941494

14951495
/**
14961496
* @throws std::runtime_error thrown on bad macro syntax
14971497
*/
1498-
Macro(const Token *tok, std::vector<std::string> &f) : nameTokDef(nullptr), files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(true) {
1498+
Macro(const Token *tok, std::vector<std::string> &f) : files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(true) {
14991499
if (sameline(tok->previousSkipComments(), tok))
15001500
throw std::runtime_error("bad macro syntax");
15011501
if (tok->op != '#')
@@ -1514,15 +1514,15 @@ namespace simplecpp {
15141514
/**
15151515
* @throws std::runtime_error thrown on bad macro syntax
15161516
*/
1517-
Macro(const std::string &name, const std::string &value, std::vector<std::string> &f) : nameTokDef(nullptr), files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(false) {
1517+
Macro(const std::string &name, const std::string &value, std::vector<std::string> &f) : files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(false) {
15181518
const std::string def(name + ' ' + value);
15191519
StdCharBufStream stream(reinterpret_cast<const unsigned char*>(def.data()), def.size());
15201520
tokenListDefine->readfile(stream);
15211521
if (!parseDefine(tokenListDefine->cfront()))
15221522
throw std::runtime_error("bad macro syntax. macroname=" + name + " value=" + value);
15231523
}
15241524

1525-
Macro(const Macro &other) : nameTokDef(nullptr), files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
1525+
Macro(const Macro &other) : files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
15261526
// TODO: remove the try-catch - see #537
15271527
// avoid bugprone-exception-escape clang-tidy warning
15281528
try {
@@ -2387,7 +2387,7 @@ namespace simplecpp {
23872387
}
23882388

23892389
/** name token in definition */
2390-
const Token *nameTokDef;
2390+
const Token *nameTokDef{};
23912391

23922392
/** arguments for macro */
23932393
std::vector<TokenString> args;

0 commit comments

Comments
 (0)