Skip to content

Commit 3901bbe

Browse files
committed
avoid redundant initialization of simplecpp::Macro::nameTokDef
1 parent a75d5bc commit 3901bbe

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
@@ -1487,9 +1487,9 @@ namespace simplecpp {
14871487

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

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

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

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

23782378
/** name token in definition */
2379-
const Token *nameTokDef;
2379+
const Token *nameTokDef{};
23802380

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

0 commit comments

Comments
 (0)