mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-10 12:53:03 +00:00
undefined but unused is a warning
* src/symtab.c (symbol_check_defined): Undeclared symbols are only a warning. * tests/input.at (Undeclared symbols used for a printer or destructor): Rename as... (Undefined symbols): this, and check this case. * NEWS: Doc it.
This commit is contained in:
26
src/symtab.c
26
src/symtab.c
@@ -383,26 +383,12 @@ symbol_check_defined (symbol *sym)
|
||||
{
|
||||
if (sym->class == unknown_sym)
|
||||
{
|
||||
switch (sym->status)
|
||||
{
|
||||
case used:
|
||||
complain_at (sym->location, Wother,
|
||||
_("symbol %s is used, but is not defined as a token"
|
||||
" and has no rules"),
|
||||
sym->tag);
|
||||
break;
|
||||
case undeclared:
|
||||
case needed:
|
||||
complain_at (sym->location, complaint,
|
||||
_("symbol %s is used, but is not defined as a token"
|
||||
" and has no rules"),
|
||||
sym->tag);
|
||||
break;
|
||||
case declared:
|
||||
/* If declared, then sym->class != unknown_sym. */
|
||||
assert (0);
|
||||
}
|
||||
|
||||
assert (sym->status != declared);
|
||||
complain_at (sym->location,
|
||||
sym->status == needed ? complaint : Wother,
|
||||
_("symbol %s is used, but is not defined as a token"
|
||||
" and has no rules"),
|
||||
sym->tag);
|
||||
sym->class = nterm_sym;
|
||||
sym->number = nvars++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user