Skip to content

Commit

Permalink
Fixed warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
yhirose committed Mar 29, 2020
1 parent c416d84 commit fdfd1f4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion example/calc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int main(void) {
%whitespace <- [ \t]*
)");

assert((bool)parser == true);
assert(static_cast<bool>(parser) == true);

// (3) Setup actions
parser["Additive"] = [](const SemanticValues& sv) {
Expand Down
6 changes: 3 additions & 3 deletions lint/peglint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

using namespace std;

bool read_file(const char* path, vector<char>& buff)
inline bool read_file(const char* path, vector<char>& buff)
{
ifstream ifs(path, ios::in | ios::binary);
if (ifs.fail()) {
Expand Down Expand Up @@ -128,13 +128,13 @@ int main(int argc, const char** argv)
const peg::any& /*dt*/,
size_t len) {
auto pos = static_cast<size_t>(s - c.s);
if (len != -1) {
if (len != static_cast<size_t>(-1)) {
pos += len;
}
string indent;
auto level = c.trace_ids.size() - 1;
while (level--) { indent += ""; }
auto ret = len != -1 ? "└o " : "└x ";
auto ret = len != static_cast<size_t>(-1) ? "└o " : "└x ";
std::stringstream choice;
if (sv.choice_count() > 0) {
choice << " " << sv.choice() << "/" << sv.choice_count();
Expand Down
1 change: 0 additions & 1 deletion peglib.h
Original file line number Diff line number Diff line change
Expand Up @@ -3143,7 +3143,6 @@ class ParserGenerator {
};

g["Loop"] = [&](const SemanticValues &sv) {
std::pair<size_t, size_t> dummy;
switch (sv.choice()) {
case 0: // Option
return Loop{Loop::Type::opt, std::pair<size_t, size_t>()};
Expand Down
4 changes: 2 additions & 2 deletions test/test3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

using namespace peg;

bool exact(Grammar& g, const char* d, const char* s) {
inline bool exact(Grammar& g, const char* d, const char* s) {
auto n = strlen(s);
auto r = g[d].parse(s, n);
return r.ret && r.len == n;
}

Grammar& make_peg_grammar() {
inline Grammar& make_peg_grammar() {
return ParserGenerator::grammar();
}

Expand Down

0 comments on commit fdfd1f4

Please sign in to comment.