Skip to content

Commit c07e3e5

Browse files
committed
avoid redundant initialization of simplecpp::Macro::nameTokDef
1 parent e656480 commit c07e3e5

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
@@ -1485,9 +1485,9 @@ namespace simplecpp {
14851485

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

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

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

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

23762376
/** name token in definition */
2377-
const Token *nameTokDef;
2377+
const Token *nameTokDef{};
23782378

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

0 commit comments

Comments
 (0)