Fix compile warnings

This commit is contained in:
Max Brunsfeld 2017-07-12 22:08:36 -07:00
parent 62c577af33
commit 7293e6f0cc
6 changed files with 51 additions and 55 deletions

View file

@ -29,7 +29,7 @@ bool LookaheadSet::operator==(const LookaheadSet &other) const {
bool LookaheadSet::contains(const Symbol &symbol) const {
if (symbol == rules::END_OF_INPUT()) return eof;
auto &bits = symbol.is_external() ? external_bits : terminal_bits;
return bits.size() > symbol.index && bits[symbol.index];
return bits.size() > static_cast<size_t>(symbol.index) && bits[symbol.index];
}
size_t LookaheadSet::size() const {
@ -95,7 +95,7 @@ bool LookaheadSet::insert(const Symbol &symbol) {
}
auto &bits = symbol.is_external() ? external_bits : terminal_bits;
if (bits.size() <= symbol.index) {
if (bits.size() <= static_cast<size_t>(symbol.index)) {
bits.resize(symbol.index + 1);
}
if (!bits[symbol.index]) {

View file

@ -86,15 +86,14 @@ recur:
self->ref_count--;
if (self->ref_count > 0) return;
StackNode *last_predecessor = NULL;
StackNode *first_predecessor = NULL;
if (self->link_count > 0) {
unsigned i = 0;
for (; i < self->link_count - 1; i++) {
for (unsigned i = self->link_count - 1; i > 0; i--) {
if (self->links[i].tree) ts_tree_release(self->links[i].tree);
stack_node_release(self->links[i].node, pool);
}
if (self->links[i].tree) ts_tree_release(self->links[i].tree);
last_predecessor = self->links[i].node;
if (self->links[0].tree) ts_tree_release(self->links[0].tree);
first_predecessor = self->links[0].node;
}
if (pool->size < MAX_NODE_POOL_SIZE) {
@ -103,8 +102,8 @@ recur:
ts_free(self);
}
if (last_predecessor) {
self = last_predecessor;
if (first_predecessor) {
self = first_predecessor;
goto recur;
}
}