Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build warnings for Clang and MSVC #197

Merged
merged 4 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dist
.coveralls.yml

.vscode
.vs

doc/html
doc/latex
Expand Down
8 changes: 5 additions & 3 deletions include/inja/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class SetStatementNode;

class NodeVisitor {
public:
virtual ~NodeVisitor() = default;

virtual void visit(const BlockNode& node) = 0;
virtual void visit(const TextNode& node) = 0;
virtual void visit(const ExpressionNode& node) = 0;
Expand All @@ -59,7 +61,7 @@ class AstNode {
size_t pos;

AstNode(size_t pos) : pos(pos) { }
virtual ~AstNode() { };
virtual ~AstNode() { }
};


Expand Down Expand Up @@ -326,7 +328,7 @@ class IncludeStatementNode : public StatementNode {

void accept(NodeVisitor& v) const {
v.visit(*this);
};
}
};

class SetStatementNode : public StatementNode {
Expand All @@ -338,7 +340,7 @@ class SetStatementNode : public StatementNode {

void accept(NodeVisitor& v) const {
v.visit(*this);
};
}
};

} // namespace inja
Expand Down
2 changes: 1 addition & 1 deletion include/inja/renderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class Renderer : public NodeVisitor {
case Op::Power: {
auto args = get_arguments<2>(node);
if (args[0]->is_number_integer() && args[1]->get<int>() >= 0) {
int result = std::pow(args[0]->get<int>(), args[1]->get<int>());
int result = static_cast<int>(std::pow(args[0]->get<int>(), args[1]->get<int>()));
result_ptr = std::make_shared<json>(std::move(result));
json_tmp_stack.push_back(result_ptr);
} else {
Expand Down
10 changes: 6 additions & 4 deletions single_include/inja/inja.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2351,6 +2351,8 @@ class SetStatementNode;

class NodeVisitor {
public:
virtual ~NodeVisitor() = default;

virtual void visit(const BlockNode& node) = 0;
virtual void visit(const TextNode& node) = 0;
virtual void visit(const ExpressionNode& node) = 0;
Expand All @@ -2377,7 +2379,7 @@ class AstNode {
size_t pos;

AstNode(size_t pos) : pos(pos) { }
virtual ~AstNode() { };
virtual ~AstNode() { }
};


Expand Down Expand Up @@ -2644,7 +2646,7 @@ class IncludeStatementNode : public StatementNode {

void accept(NodeVisitor& v) const {
v.visit(*this);
};
}
};

class SetStatementNode : public StatementNode {
Expand All @@ -2656,7 +2658,7 @@ class SetStatementNode : public StatementNode {

void accept(NodeVisitor& v) const {
v.visit(*this);
};
}
};

} // namespace inja
Expand Down Expand Up @@ -3672,7 +3674,7 @@ class Renderer : public NodeVisitor {
case Op::Power: {
auto args = get_arguments<2>(node);
if (args[0]->is_number_integer() && args[1]->get<int>() >= 0) {
int result = std::pow(args[0]->get<int>(), args[1]->get<int>());
int result = static_cast<int>(std::pow(args[0]->get<int>(), args[1]->get<int>()));
result_ptr = std::make_shared<json>(std::move(result));
json_tmp_stack.push_back(result_ptr);
} else {
Expand Down