Skip to content

Commit fa29505

Browse files
committed
avoid redundant initialization of simplecpp::Macro::nameTokDef
1 parent 5f337ae commit fa29505

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

simplecpp.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,9 +1488,9 @@ namespace simplecpp {
14881488

14891489
class Macro {
14901490
public:
1491-
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) {}
1491+
explicit Macro(std::vector<std::string> &f) : valueToken(nullptr), endToken(nullptr), files(f), tokenListDefine(new TokenList(f)), variadic(false), variadicOpt(false), valueDefinedInCode_(false) {}
14921492

1493-
Macro(const Token *tok, std::vector<std::string> &f) : nameTokDef(nullptr), files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(true) {
1493+
Macro(const Token *tok, std::vector<std::string> &f) : files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(true) {
14941494
if (sameline(tok->previousSkipComments(), tok))
14951495
throw std::runtime_error("bad macro syntax");
14961496
if (tok->op != '#')
@@ -1506,15 +1506,15 @@ namespace simplecpp {
15061506
throw std::runtime_error("bad macro syntax");
15071507
}
15081508

1509-
Macro(const std::string &name, const std::string &value, std::vector<std::string> &f) : nameTokDef(nullptr), files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(false) {
1509+
Macro(const std::string &name, const std::string &value, std::vector<std::string> &f) : files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(false) {
15101510
const std::string def(name + ' ' + value);
15111511
StdCharBufStream stream(reinterpret_cast<const unsigned char*>(def.data()), def.size());
15121512
tokenListDefine->readfile(stream);
15131513
if (!parseDefine(tokenListDefine->cfront()))
15141514
throw std::runtime_error("bad macro syntax. macroname=" + name + " value=" + value);
15151515
}
15161516

1517-
Macro(const Macro &other) : nameTokDef(nullptr), files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
1517+
Macro(const Macro &other) : files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
15181518
// TODO: remove the try-catch - see #537
15191519
// avoid bugprone-exception-escape clang-tidy warning
15201520
try {
@@ -2377,7 +2377,7 @@ namespace simplecpp {
23772377
}
23782378

23792379
/** name token in definition */
2380-
const Token *nameTokDef;
2380+
const Token *nameTokDef{};
23812381

23822382
/** arguments for macro */
23832383
std::vector<TokenString> args;

0 commit comments

Comments
 (0)