From 3a8c3c1d718879f1ed05eea576869e3ba1b83262 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Sat, 10 Oct 2020 18:00:24 +0300 Subject: Make clang-tidy run without warnings on JSImpl --- JSImpl/src/Expression.h | 2 +- JSImpl/src/JSONParser.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'JSImpl/src') diff --git a/JSImpl/src/Expression.h b/JSImpl/src/Expression.h index 333568f..37b927f 100644 --- a/JSImpl/src/Expression.h +++ b/JSImpl/src/Expression.h @@ -45,7 +45,7 @@ class Expression : public IPLEnableShared MEMBERS_ITERATOR(GENERATE_GETTERS) \ private: \ MEMBERS_ITERATOR(GENERATE_MEMBER_DEFINITIONS) \ - bool m_dummy; \ + bool m_dummy; /* NOLINT */ \ }; EXPRESSION_DEFINITION_ITERATOR(GENERATE_EXPRESSION); diff --git a/JSImpl/src/JSONParser.cpp b/JSImpl/src/JSONParser.cpp index 275fb0e..3f87aad 100644 --- a/JSImpl/src/JSONParser.cpp +++ b/JSImpl/src/JSONParser.cpp @@ -55,7 +55,7 @@ EXPRESSION_DEFINITION_ITERATOR(GENERATE_EXPRESSION_TYPE_ENUMS); #undef GENERATE_EXPRESSION_TYPE_ENUM_MEMBERS template -ExpressionPtr JSONParseWrap(const char*& json, const char* eName) +ExpressionPtr JSONParseWrap(const char*&, const char*) { assert(false); return nullptr; -- cgit v1.3.1-23-gd82d From ec12d61c01dff776998bd043e565d6066dc59e98 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Sun, 18 Oct 2020 15:43:16 +0300 Subject: Remove unused function --- JSImpl/src/Lexer.cpp | 5 ----- 1 file changed, 5 deletions(-) (limited to 'JSImpl/src') diff --git a/JSImpl/src/Lexer.cpp b/JSImpl/src/Lexer.cpp index 4a2deb8..30a7e42 100644 --- a/JSImpl/src/Lexer.cpp +++ b/JSImpl/src/Lexer.cpp @@ -33,11 +33,6 @@ inline bool IsStringBound(char c) return c == '\'' || c == '"'; } -inline bool IsWhiteSpace(char c) -{ - return c == ' '; -} - inline bool IsNewLine(char c) { return c == '\n'; -- cgit v1.3.1-23-gd82d From 6eca913a22b7132a4dcb0bf1a5b8542f81752141 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Sun, 18 Oct 2020 15:45:31 +0300 Subject: Fix uninitialized value --- JSImpl/src/ASTInterpreter.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'JSImpl/src') diff --git a/JSImpl/src/ASTInterpreter.cpp b/JSImpl/src/ASTInterpreter.cpp index f56706a..baf38ae 100644 --- a/JSImpl/src/ASTInterpreter.cpp +++ b/JSImpl/src/ASTInterpreter.cpp @@ -229,6 +229,7 @@ struct LValueExtractor : public ExpressionVisitor public: LValueExtractor(ASTInterpreter* interpreter) : m_Interpreter(interpreter) + , m_LValue(nullptr) {} ~LValueExtractor() {} -- cgit v1.3.1-23-gd82d From 9cf31d4b4e389f7c879aa8750a397e32f55a43d1 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Mon, 19 Oct 2020 22:49:27 +0300 Subject: Fix warnings about assignment in conditions --- JSImpl/src/Expression.h | 5 ++++- JSImpl/src/Parser.cpp | 42 +++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 22 deletions(-) (limited to 'JSImpl/src') diff --git a/JSImpl/src/Expression.h b/JSImpl/src/Expression.h index 37b927f..570687a 100644 --- a/JSImpl/src/Expression.h +++ b/JSImpl/src/Expression.h @@ -38,7 +38,10 @@ class Expression : public IPLEnableShared public: \ ClassName(MEMBERS_ITERATOR(EXPAND_ARGUMENT) bool __dummy = 0) \ : \ - MEMBERS_ITERATOR(EXPAND_INITIALIZER_LIST) m_dummy(__dummy) {} \ + MEMBERS_ITERATOR(EXPAND_INITIALIZER_LIST) m_dummy(__dummy) \ + { \ + (void)m_dummy; /* silence warning about unused private field */ \ + } \ virtual ~ClassName() {} \ virtual void Accept(ExpressionVisitor& v) override { v.Visit(this); } \ \ diff --git a/JSImpl/src/Parser.cpp b/JSImpl/src/Parser.cpp index 4bc97ce..00907a0 100644 --- a/JSImpl/src/Parser.cpp +++ b/JSImpl/src/Parser.cpp @@ -373,12 +373,12 @@ ExpressionPtr Parser::LeftSideExpression(NormalType a) { ExpressionPtr result; auto ss = Snapshot(); - if (result = CallExpression(a)) + if ((result = CallExpression(a))) { return result; } Restore(ss); - if (result = ShortNewExpression()) + if ((result = ShortNewExpression())) { return result; } @@ -464,12 +464,12 @@ ExpressionPtr Parser::ShortNewSubexpression() { ExpressionPtr result; auto ss = Snapshot(); - if (result = FullNewSubexpression()) + if ((result = FullNewSubexpression())) { return result; } Restore(ss); - if (result = ShortNewExpression()) + if ((result = ShortNewExpression())) { return result; } @@ -490,7 +490,7 @@ ExpressionPtr Parser::FullNewExpression() ExpressionPtr Parser::FullNewSubexpression() { ExpressionPtr result; - if (result = PrimaryExpression(NormalType::Normal)) + if ((result = PrimaryExpression(NormalType::Normal))) { return result; } @@ -764,22 +764,22 @@ ExpressionPtr Parser::Expression(NormalType a, AllowType b) ExpressionPtr Parser::Statement() { ExpressionPtr result; - if (result = EmptyStatement()) return result; - if (result = Expression(NormalType::Initial, AllowType::AllowIn)) return result; - if (result = VariableDefinition(AllowType::AllowIn)) return result; - if (result = Block()) return result; - if (result = LabeledStatement()) return result; - if (result = IfStatementfull()) return result; - if (result = SwitchStatement()) return result; - if (result = DoStatement()) return result; - if (result = WhileStatement()) return result; - if (result = ForStatement()) return result; - if (result = WithStatement()) return result; - if (result = ContinueStatement()) return result; - if (result = BreakStatement()) return result; - if (result = OptionalLabel()) return result; - if (result = ReturnStatement()) return result; - if (result = TryStatement()) return result; + if ((result = EmptyStatement())) return result; + if ((result = Expression(NormalType::Initial, AllowType::AllowIn))) return result; + if ((result = VariableDefinition(AllowType::AllowIn))) return result; + if ((result = Block())) return result; + if ((result = LabeledStatement())) return result; + if ((result = IfStatementfull())) return result; + if ((result = SwitchStatement())) return result; + if ((result = DoStatement())) return result; + if ((result = WhileStatement())) return result; + if ((result = ForStatement())) return result; + if ((result = WithStatement())) return result; + if ((result = ContinueStatement())) return result; + if ((result = BreakStatement())) return result; + if ((result = OptionalLabel())) return result; + if ((result = ReturnStatement())) return result; + if ((result = TryStatement())) return result; return result; } -- cgit v1.3.1-23-gd82d From 7eb2b8e1ec0f5aaf1854cafcb1de7f9cf7d86e3c Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Sat, 28 Nov 2020 10:42:25 +0200 Subject: Fix clang-tidy warnings --- JSImpl/src/Parser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'JSImpl/src') diff --git a/JSImpl/src/Parser.cpp b/JSImpl/src/Parser.cpp index 00907a0..8f415fb 100644 --- a/JSImpl/src/Parser.cpp +++ b/JSImpl/src/Parser.cpp @@ -140,7 +140,8 @@ ExpressionPtr Parser::PrimaryExpression(NormalType a) { if (a == NormalType::Initial) { - return SimpleExpression(); + auto simple = SimpleExpression(); + return simple; } if (auto simple = SimpleExpression()) @@ -682,9 +683,11 @@ ExpressionPtr Parser::ConditionalExpression(NormalType a, AllowType b) if (Match(TokenType::QuestionMark)) { auto trueExpr= AssignmentExpression(NormalType::Normal, b); + (void)trueExpr; if (Match(TokenType::Colon)) { auto falseExpr = AssignmentExpression(NormalType::Normal, b); + (void)falseExpr; // TODO implement trinary operator assert(false); return ExpressionPtr(); -- cgit v1.3.1-23-gd82d