From 3f08bfb264e401d384cdfc3dfd8af40eb5fb816b Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 12 Feb 2016 14:07:30 -0800 Subject: [PATCH] Fix build warnings --- spec/runtime/stack_spec.cc | 4 +++- src/compiler/build_tables/build_parse_table.cc | 2 +- src/compiler/parse_grammar.cc | 2 +- src/runtime/document.c | 2 +- src/runtime/parser.c | 4 ++-- src/runtime/stack.c | 2 +- src/runtime/string_input.c | 3 ++- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/spec/runtime/stack_spec.cc b/spec/runtime/stack_spec.cc index 69f3467e..34fec8d4 100644 --- a/spec/runtime/stack_spec.cc +++ b/spec/runtime/stack_spec.cc @@ -79,7 +79,9 @@ describe("Stack", [&]() { ); for (size_t i = 0; i < tree_count; i++) - trees[i] = ts_tree_make_leaf(i, ts_length_zero(), tree_len, {}); + trees[i] = ts_tree_make_leaf(i, ts_length_zero(), tree_len, { + true, true, false, true, + }); }); after_each([&]() { diff --git a/src/compiler/build_tables/build_parse_table.cc b/src/compiler/build_tables/build_parse_table.cc index 37ca7d88..4805ba3c 100644 --- a/src/compiler/build_tables/build_parse_table.cc +++ b/src/compiler/build_tables/build_parse_table.cc @@ -81,7 +81,7 @@ class ParseTableBuilder { mark_fragile_actions(); remove_duplicate_parse_states(); - parse_table.symbols.insert({ rules::ERROR(), {} }); + parse_table.symbols.insert({ rules::ERROR(), {true} }); return { parse_table, CompileError::none() }; } diff --git a/src/compiler/parse_grammar.cc b/src/compiler/parse_grammar.cc index 653e9cca..17bfe6cf 100644 --- a/src/compiler/parse_grammar.cc +++ b/src/compiler/parse_grammar.cc @@ -321,7 +321,7 @@ error: json_value_free(grammar_json); } - return { "", Grammar{}, error_message }; + return { "", Grammar(), error_message }; } } // namespace tree_sitter diff --git a/src/runtime/document.c b/src/runtime/document.c index 8eb0025d..cbe2a236 100644 --- a/src/runtime/document.c +++ b/src/runtime/document.c @@ -26,7 +26,7 @@ void ts_document_free(TSDocument *self) { ts_parser_destroy(&self->parser); if (self->tree) ts_tree_release(self->tree); - ts_document_set_input(self, (TSInput){}); + ts_document_set_input(self, (TSInput){NULL, NULL, NULL, TSInputEncodingUTF8}); ts_free(self); } diff --git a/src/runtime/parser.c b/src/runtime/parser.c index d93111e0..5dcf9988 100644 --- a/src/runtime/parser.c +++ b/src/runtime/parser.c @@ -281,7 +281,7 @@ static ParseActionResult ts_parser__shift(TSParser *self, int head, LOG("merge head:%d", head); vector_erase(&self->lookahead_states, head); return RemovedStackHead; - case StackPushResultContinued: + default: return UpdatedStackHead; } } @@ -473,7 +473,7 @@ static ParseActionResult ts_parser__reduce_error(TSParser *self, int head, return FailedToUpdateStackHead; case RemovedStackHead: return RemovedStackHead; - case UpdatedStackHead: { + default: { StackEntry *entry = ts_stack_head(self->stack, head); entry->position = ts_length_add(entry->position, lookahead->padding); entry->tree->size = ts_length_add(entry->tree->size, lookahead->padding); diff --git a/src/runtime/stack.c b/src/runtime/stack.c index 90b9fa4f..79893bed 100644 --- a/src/runtime/stack.c +++ b/src/runtime/stack.c @@ -288,7 +288,7 @@ void ts_stack_remove_head(Stack *self, int head_index) { StackPushResult ts_stack_push(Stack *self, int head_index, TSStateId state, TSTree *tree) { - assert(head_index < self->heads.size); + assert((size_t)head_index < self->heads.size); assert(tree); TSLength position = ts_tree_total_size(tree); diff --git a/src/runtime/string_input.c b/src/runtime/string_input.c index b7bf47b3..6785bbc9 100644 --- a/src/runtime/string_input.c +++ b/src/runtime/string_input.c @@ -38,8 +38,9 @@ TSInput ts_string_input_make(const char *string) { .payload = input, .read_fn = ts_string_input_read, .seek_fn = ts_string_input_seek, + .encoding = TSInputEncodingUTF8, }; error: - return (TSInput){NULL, NULL, NULL}; + return (TSInput){NULL, NULL, NULL, TSInputEncodingUTF8}; }