Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stevecheckoway committed Oct 4, 2018
1 parent 54641d2 commit 55f50a3
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions gumbo-parser/src/char_ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -22218,6 +22218,8 @@ size_t match_named_char_ref (
}

#line 2150 "src/char_ref.rl"
(void)ts;
(void)act;
size = p - str;
return cs >= 7623? size:0;
}
2 changes: 2 additions & 0 deletions gumbo-parser/src/char_ref.rl
Original file line number Diff line number Diff line change
Expand Up @@ -2147,6 +2147,8 @@ size_t match_named_char_ref (
output[0] = output[1] = kGumboNoChar;
%% write init;
%% write exec;
(void)ts;
(void)act;
size = p - str;
return cs >= %%{ write first_final; }%%? size:0;
}
3 changes: 3 additions & 0 deletions gumbo-parser/src/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,9 @@ const char* gumbo_error_code(const GumboError* error) {
case GUMBO_ERR_PARSER:
return "generic-parser";
}
// Silence warning about control reaching end of non-void function.
// All errors _should_ be handled in the switch statement.
return "generic-parser";
}

static void error_to_string (
Expand Down
6 changes: 3 additions & 3 deletions gumbo-parser/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -4782,10 +4782,10 @@ GumboOutput* gumbo_parse_with_options (
break;
}
gumbo_debug (
"Handling %s token @%zu:%zu in state %u.\n",
"Handling %s token @%lu:%lu in state %u.\n",
(char*) token_type,
token.position.line,
token.position.column,
(unsigned long)token.position.line,
(unsigned long)token.position.column,
state->_insertion_mode
);

Expand Down
3 changes: 2 additions & 1 deletion gumbo-parser/test/token_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GumboCharacterTokenBufferTest : public GumboTest {

void Fill(const char* input, size_t size = -1) {
gumbo_character_token_buffer_clear(&buffer_);
if (size == -1)
if (size == static_cast<size_t>(-1))
size = strlen(input);
text_ = input;
gumbo_tokenizer_state_init(&parser_, input, size);
Expand Down Expand Up @@ -192,6 +192,7 @@ TEST_F(GumboCharacterTokenBufferTest, CarriageReturn) {
EXPECT_EQ(0, t.position.offset);
EXPECT_EQ(&text_[0], t.original_text.data);
EXPECT_EQ(6, t.original_text.length);
errors_are_expected_ = true;
}

} // namespace
Expand Down
2 changes: 1 addition & 1 deletion gumbo-parser/test/tokenizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class GumboTokenizerTest : public GumboTest {
gumbo_token_destroy(&token_);
text_ = input;
gumbo_tokenizer_state_destroy(&parser_);
if (size == -1)
if (size == static_cast<size_t>(-1))
size = strlen(input);
gumbo_tokenizer_state_init(&parser_, input, size);
at_start_ = true;
Expand Down
2 changes: 2 additions & 0 deletions scripts/entities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
output[0] = output[1] = kGumboNoChar;
%% write init;
%% write exec;
(void)ts;
(void)act;
size = p - str;
return cs >= %%{ write first_final; }%%? size:0;
}
Expand Down

0 comments on commit 55f50a3

Please sign in to comment.