mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 13:23:04 +00:00
* src/reduce.c (reduce_grammar): When the language is empty,
complain about the start symbol, not the axiom. Use its location. * tests/reduce.at (Empty Language): New.
This commit is contained in:
@@ -332,3 +332,24 @@ Useless rules
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
|
||||
## ---------------- ##
|
||||
## Empty Language. ##
|
||||
## ---------------- ##
|
||||
|
||||
AT_SETUP([Empty Language])
|
||||
|
||||
AT_DATA([[input.y]],
|
||||
[[%output="input.c"
|
||||
%%
|
||||
exp: exp;
|
||||
]])
|
||||
|
||||
AT_CHECK([[bison input.y]], 1, [],
|
||||
[[input.y: warning: 2 useless nonterminals and 2 useless rules
|
||||
input.y:3.1-3: fatal error: start symbol exp does not derive any sentence
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
Reference in New Issue
Block a user