Build with all warnings enabled
Fix resulting warnings
This commit is contained in:
parent
6253c19524
commit
af64d3fffa
4 changed files with 18 additions and 8 deletions
|
|
@ -184,7 +184,7 @@ namespace tree_sitter {
|
|||
|
||||
string switch_on_parse_state() {
|
||||
string body = "";
|
||||
for (int i = 0; i < parse_table.states.size(); i++)
|
||||
for (size_t i = 0; i < parse_table.states.size(); i++)
|
||||
body += _case(std::to_string(i), code_for_parse_state(parse_table.states[i]));
|
||||
body += _default("PARSE_PANIC();");
|
||||
return _switch("PARSE_STATE()", body);
|
||||
|
|
@ -192,7 +192,7 @@ namespace tree_sitter {
|
|||
|
||||
string switch_on_lex_state() {
|
||||
string body = "";
|
||||
for (int i = 0; i < lex_table.states.size(); i++)
|
||||
for (size_t i = 0; i < lex_table.states.size(); i++)
|
||||
body += _case(std::to_string(i), switch_on_lookahead_char(lex_table.states[i]));
|
||||
body += _case("ts_lex_state_error", switch_on_lookahead_char(lex_table.error_state));
|
||||
body += _default("LEX_PANIC();");
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace tree_sitter {
|
|||
string error;
|
||||
const string input;
|
||||
const size_t length;
|
||||
int position;
|
||||
size_t position;
|
||||
};
|
||||
|
||||
Pattern::Pattern(const string &string) : value(string) {};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ ts_tree * ts_tree_make_leaf(ts_symbol symbol, size_t size, size_t offset) {
|
|||
}
|
||||
|
||||
ts_tree * ts_tree_make_node(ts_symbol symbol, size_t child_count, ts_tree **children, size_t size, size_t offset) {
|
||||
for (int i = 0; i < child_count; i++)
|
||||
for (size_t i = 0; i < child_count; i++)
|
||||
ts_tree_retain(children[i]);
|
||||
ts_tree *result = ts_tree_make(symbol, size, offset);
|
||||
result->data.children = { .count = child_count, .contents = children };
|
||||
|
|
@ -47,7 +47,7 @@ void ts_tree_release(ts_tree *tree) {
|
|||
if (tree->ref_count == 0) {
|
||||
ts_tree **children = ts_tree_children(tree);
|
||||
if (children) {
|
||||
for (int i = 0; i < ts_tree_child_count(tree); i++)
|
||||
for (size_t i = 0; i < ts_tree_child_count(tree); i++)
|
||||
ts_tree_release(children[i]);
|
||||
free(children);
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ int ts_tree_equals(const ts_tree *node1, const ts_tree *node2) {
|
|||
} else {
|
||||
if (node1->data.children.count != node2->data.children.count)
|
||||
return 0;
|
||||
for (int i = 0; i < node1->data.children.count; i++) {
|
||||
for (size_t i = 0; i < node1->data.children.count; i++) {
|
||||
ts_tree *child1 = node1->data.children.contents[i];
|
||||
ts_tree *child2 = node2->data.children.contents[i];
|
||||
if (!ts_tree_equals(child1, child2))
|
||||
|
|
@ -86,7 +86,7 @@ static string __tree_to_string(const ts_tree *tree, const char **symbol_names) {
|
|||
if (!tree) return "#<null-tree>";
|
||||
if (tree->symbol == ts_builtin_sym_error) return "(ERROR)";
|
||||
string result = string("(") + symbol_names[tree->symbol];
|
||||
for (int i = 0; i < tree->data.children.count; i++)
|
||||
for (size_t i = 0; i < tree->data.children.count; i++)
|
||||
result += " " + __tree_to_string(tree->data.children.contents[i], symbol_names);
|
||||
return result + ")";
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ char * ts_tree_string(const ts_tree *tree, const char **symbol_names) {
|
|||
|
||||
char * ts_tree_error_string(const ts_tree *tree, const char **symbol_names) {
|
||||
string result = string("Unexpected character '") + tree->data.error.lookahead_char + "'. Expected:";
|
||||
for (int i = 0; i < tree->data.error.expected_input_count; i++) {
|
||||
for (size_t i = 0; i < tree->data.error.expected_input_count; i++) {
|
||||
ts_symbol symbol = tree->data.error.expected_inputs[i];
|
||||
result += string(" ") + symbol_names[symbol];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@
|
|||
'sources': [
|
||||
'<!@(find include src -name "*.h" -or -name "*.cpp")',
|
||||
],
|
||||
'cflags': [
|
||||
'-Wall',
|
||||
'-Wextra'
|
||||
],
|
||||
'cflags_cc': [
|
||||
'-stdlib=libc++',
|
||||
],
|
||||
|
|
@ -74,6 +78,12 @@
|
|||
'xcode_settings': {
|
||||
'ALWAYS_SEARCH_USER_PATHS': 'NO',
|
||||
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
|
||||
'WARNING_CFLAGS': [
|
||||
'-Wall',
|
||||
'-Wendif-labels',
|
||||
'-W',
|
||||
'-Wno-unused-parameter',
|
||||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue