Skip to content

Commit c4b0ff7

Browse files
facontidavideclaude
andcommitted
Fix clang-tidy warnings in script parser and tokenizer
- Add explicit != 0 for implicit int->bool conversions from ctype functions (readability-implicit-bool-conversion) - Value-initialize op variables in switch statements (cppcoreguidelines-init-variables) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7cefede commit c4b0ff7

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/script_parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ class ScriptParser
304304
Ast::expr_ptr parseAssignment(Ast::expr_ptr left)
305305
{
306306
const auto& opTok = advance();
307-
Ast::ExprAssignment::op_t op;
307+
Ast::ExprAssignment::op_t op{};
308308
switch(opTok.type)
309309
{
310310
case TokenType::ColonEqual:
@@ -382,7 +382,7 @@ class ScriptParser
382382
static Ast::expr_ptr makeBinary(Ast::expr_ptr left, TokenType opType,
383383
Ast::expr_ptr right)
384384
{
385-
Ast::ExprBinaryArithmetic::op_t op;
385+
Ast::ExprBinaryArithmetic::op_t op{};
386386
switch(opType)
387387
{
388388
case TokenType::Plus:

src/script_tokenizer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ namespace
2222

2323
bool isIdentStart(char c)
2424
{
25-
return std::isalpha(static_cast<unsigned char>(c)) || c == '_' || c == '@';
25+
return std::isalpha(static_cast<unsigned char>(c)) != 0 || c == '_' || c == '@';
2626
}
2727

2828
bool isIdentChar(char c)
2929
{
30-
return std::isalnum(static_cast<unsigned char>(c)) || c == '_';
30+
return std::isalnum(static_cast<unsigned char>(c)) != 0 || c == '_';
3131
}
3232

3333
bool isDigit(char c)
3434
{
35-
return std::isdigit(static_cast<unsigned char>(c));
35+
return std::isdigit(static_cast<unsigned char>(c)) != 0;
3636
}
3737

3838
bool isHexDigit(char c)
3939
{
40-
return std::isxdigit(static_cast<unsigned char>(c));
40+
return std::isxdigit(static_cast<unsigned char>(c)) != 0;
4141
}
4242

4343
} // namespace

0 commit comments

Comments
 (0)