mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
There are warnings (-Wextra) in generated C++ code:
ltlparse.cc: In member function 'ltlyy::parser::symbol_number_type
ltlyy::parser::by_state::type_get() const':
ltlparse.cc:452:33: warning: enumeral and non-enumeral type in
conditional expression
return state == empty_state ? empty_symbol : yystos_[state];
Reported by Alexandre Duret-Lutz.
It turns out that -Wall and -Wextra were disabled because of a stupid
typo.
* configure.ac: Fix the stupid typo.
* data/lalr1.cc, src/AnnotationList.c, src/InadequacyList.c,
* src/ielr.c, src/print.c, src/scan-code.l, src/symlist.c,
* src/symlist.h, src/symtab.c, src/tables.c, tests/actions.at,
* tests/calc.at, tests/cxx-type.at, tests/glr-regression.at,
* tests/named-refs.at, tests/torture.at:
Fix warnings, mostly issues about variables used only with assertions,
which are disabled with -DNDEBUG.
80 lines
2.4 KiB
C
80 lines
2.4 KiB
C
/* IELR's inadequacy list.
|
|
|
|
Copyright (C) 2009-2015 Free Software Foundation, Inc.
|
|
|
|
This file is part of Bison, the GNU Compiler Compiler.
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#include <config.h>
|
|
#include "system.h"
|
|
|
|
#include "InadequacyList.h"
|
|
|
|
ContributionIndex const ContributionIndex__none = -1;
|
|
ContributionIndex const ContributionIndex__error_action = -2;
|
|
|
|
InadequacyList *
|
|
InadequacyList__new_conflict (state *manifesting_state, symbol *token,
|
|
bitset actions,
|
|
InadequacyListNodeCount *node_count)
|
|
{
|
|
InadequacyList *result = xmalloc (sizeof *result);
|
|
result->id = (*node_count)++;
|
|
aver (*node_count != 0);
|
|
result->next = NULL;
|
|
result->manifestingState = manifesting_state;
|
|
result->contributionCount = bitset_count (actions);
|
|
result->inadequacy.conflict.token = token;
|
|
result->inadequacy.conflict.actions = actions;
|
|
return result;
|
|
}
|
|
|
|
void
|
|
InadequacyList__delete (InadequacyList *self)
|
|
{
|
|
while (self)
|
|
{
|
|
InadequacyList *node = self;
|
|
self = self->next;
|
|
bitset_free (node->inadequacy.conflict.actions);
|
|
free (node);
|
|
}
|
|
}
|
|
|
|
ContributionIndex
|
|
InadequacyList__getShiftContributionIndex (InadequacyList const *self)
|
|
{
|
|
if (!bitset_test (self->inadequacy.conflict.actions,
|
|
self->manifestingState->reductions->num))
|
|
return ContributionIndex__none;
|
|
return self->contributionCount - 1;
|
|
}
|
|
|
|
symbol *
|
|
InadequacyList__getContributionToken (InadequacyList const *self,
|
|
ContributionIndex i)
|
|
{
|
|
aver (0 <= i && i < self->contributionCount); (void) i;
|
|
return self->inadequacy.conflict.token;
|
|
}
|
|
|
|
void
|
|
InadequacyList__prependTo (InadequacyList *self, InadequacyList **list)
|
|
{
|
|
InadequacyList *head_old = *list;
|
|
*list = self;
|
|
self->next = head_old;
|
|
}
|