Skip to content

Commit 82eff4f

Browse files
committed
avoid redundant initialization of simplecpp::Macro::nameTokDef
1 parent c3479ab commit 82eff4f

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
@@ -1500,12 +1500,12 @@ namespace simplecpp {
15001500

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

15051505
/**
15061506
* @throws std::runtime_error thrown on bad macro syntax
15071507
*/
1508-
Macro(const Token *tok, std::vector<std::string> &f) : nameTokDef(nullptr), files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(true) {
1508+
Macro(const Token *tok, std::vector<std::string> &f) : files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(true) {
15091509
if (sameline(tok->previousSkipComments(), tok))
15101510
throw std::runtime_error("bad macro syntax");
15111511
if (tok->op != '#')
@@ -1524,15 +1524,15 @@ namespace simplecpp {
15241524
/**
15251525
* @throws std::runtime_error thrown on bad macro syntax
15261526
*/
1527-
Macro(const std::string &name, const std::string &value, std::vector<std::string> &f) : nameTokDef(nullptr), files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(false) {
1527+
Macro(const std::string &name, const std::string &value, std::vector<std::string> &f) : files(f), tokenListDefine(new TokenList(f)), valueDefinedInCode_(false) {
15281528
const std::string def(name + ' ' + value);
15291529
StdCharBufStream stream(reinterpret_cast<const unsigned char*>(def.data()), def.size());
15301530
tokenListDefine->readfile(stream);
15311531
if (!parseDefine(tokenListDefine->cfront()))
15321532
throw std::runtime_error("bad macro syntax. macroname=" + name + " value=" + value);
15331533
}
15341534

1535-
Macro(const Macro &other) : nameTokDef(nullptr), files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
1535+
Macro(const Macro &other) : files(other.files), tokenListDefine(other.tokenListDefine), valueDefinedInCode_(other.valueDefinedInCode_) {
15361536
// TODO: remove the try-catch - see #537
15371537
// avoid bugprone-exception-escape clang-tidy warning
15381538
try {
@@ -2410,7 +2410,7 @@ namespace simplecpp {
24102410
}
24112411

24122412
/** name token in definition */
2413-
const Token *nameTokDef;
2413+
const Token *nameTokDef{};
24142414

24152415
/** arguments for macro */
24162416
std::vector<TokenString> args;

0 commit comments

Comments
 (0)