mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
warnings: used but undeclared symbols are warnings
We used to raise an error if a symbol appears only in a %printer or %destructor. Make it a warning. * src/symtab.h (status): New enum. (symbol): Replace the binary "declared" with the three-state "status". Adjust dependencies. * src/symtab.c (symbol_check_defined): Needed symbols are an error, whereas "used" are simply warnings. * src/symlist.c (symbol_list_destructor_set, symbol_list_printer): Set symbol status to 'used' when associated to destructors or printers. * input.at (Undeclared symbols used for a printer or destructor): New.
This commit is contained in:
committed by
Akim Demaille
parent
dda2c1adba
commit
b921d92fcb
@@ -271,6 +271,30 @@ input.y:5.10-24: previous declaration
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
## ---------------------------------------------------- ##
|
||||
## Undeclared symbols used for a printer or destructor. ##
|
||||
## ---------------------------------------------------- ##
|
||||
|
||||
AT_SETUP([Undeclared symbols used for a printer or destructor])
|
||||
|
||||
AT_DATA([[input.y]],
|
||||
[[%printer {} token1
|
||||
%destructor {} token2
|
||||
|
||||
%%
|
||||
exp: "a";
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([input.y], [0], [],
|
||||
[[input.y:1.13-18: warning: symbol token1 is used, but is not defined as a token and has no rules
|
||||
input.y:2.16-21: warning: symbol token2 is used, but is not defined as a token and has no rules
|
||||
input.y: warning: 2 nonterminals useless in grammar
|
||||
input.y:1.13-18: warning: nonterminal useless in grammar: token1
|
||||
input.y:2.16-21: warning: nonterminal useless in grammar: token2
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
## ---------------------------------------- ##
|
||||
## Unused values with default %destructor. ##
|
||||
|
||||
Reference in New Issue
Block a user