Skip to content

Commit 881ebbb

Browse files
committed
avoid redundant initialization of simplecpp::Macro::nameTokDef
1 parent 99b76f9 commit 881ebbb

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
@@ -1486,9 +1486,9 @@ namespace simplecpp {
14861486

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

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

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

1515-
Macro(const Macro &other) : nameTokDef(nullptr), files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
1515+
Macro(const Macro &other) : files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
15161516
// TODO: remove the try-catch - see #537
15171517
// avoid bugprone-exception-escape clang-tidy warning
15181518
try {
@@ -2375,7 +2375,7 @@ namespace simplecpp {
23752375
}
23762376

23772377
/** name token in definition */
2378-
const Token *nameTokDef;
2378+
const Token *nameTokDef{};
23792379

23802380
/** arguments for macro */
23812381
std::vector<TokenString> args;

0 commit comments

Comments
 (0)