mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Complain about unused %define variables and %code qualifiers.
* NEWS (2.5): Document.
* data/bison.m4 (b4_check_user_names): Complain instead of warn.
* doc/bison.texinfo (Decl Summary): Document complaint, and
improve %define documentation a little otherwise.
* tests/input.at (Reject unused %code qualifiers): Update.
(%define errors): Update.
(%define, --define, --force-define): Update.
(%define backward compatibility): Update.
(Unused %define api.pure): Update.
* tests/push.at (Push Parsing: Unsupported Skeletons): Update.
(cherry picked from commit c6abeab182)
Conflicts:
ChangeLog
This commit is contained in:
@@ -813,11 +813,11 @@ AT_DATA([input-c.y],
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_BISON_CHECK([[input-c.y]], [0], [],
|
||||
[[input-c.y:1.7: warning: %code qualifier `q' is not used
|
||||
input-c.y:2.7-9: warning: %code qualifier `bad' is not used
|
||||
input-c.y:3.7-9: warning: %code qualifier `bad' is not used
|
||||
input-c.y:4.7-12: warning: %code qualifier `format' is not used
|
||||
AT_BISON_CHECK([[input-c.y]], [[1]], [],
|
||||
[[input-c.y:1.7: %code qualifier `q' is not used
|
||||
input-c.y:2.7-9: %code qualifier `bad' is not used
|
||||
input-c.y:3.7-9: %code qualifier `bad' is not used
|
||||
input-c.y:4.7-12: %code qualifier `format' is not used
|
||||
]])
|
||||
|
||||
AT_DATA([input-c-glr.y],
|
||||
@@ -827,10 +827,10 @@ AT_DATA([input-c-glr.y],
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_BISON_CHECK([[input-c-glr.y]], [0], [],
|
||||
[[input-c-glr.y:1.7: warning: %code qualifier `q' is not used
|
||||
input-c-glr.y:2.7-9: warning: %code qualifier `bad' is not used
|
||||
input-c-glr.y:3.8-10: warning: %code qualifier `bad' is not used
|
||||
AT_BISON_CHECK([[input-c-glr.y]], [[1]], [],
|
||||
[[input-c-glr.y:1.7: %code qualifier `q' is not used
|
||||
input-c-glr.y:2.7-9: %code qualifier `bad' is not used
|
||||
input-c-glr.y:3.8-10: %code qualifier `bad' is not used
|
||||
]])
|
||||
|
||||
AT_DATA([input-c++.y],
|
||||
@@ -840,10 +840,10 @@ AT_DATA([input-c++.y],
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_BISON_CHECK([[input-c++.y]], [0], [],
|
||||
[[input-c++.y:1.7: warning: %code qualifier `q' is not used
|
||||
input-c++.y:2.7-9: warning: %code qualifier `bad' is not used
|
||||
input-c++.y:3.8: warning: %code qualifier `q' is not used
|
||||
AT_BISON_CHECK([[input-c++.y]], [[1]], [],
|
||||
[[input-c++.y:1.7: %code qualifier `q' is not used
|
||||
input-c++.y:2.7-9: %code qualifier `bad' is not used
|
||||
input-c++.y:3.8: %code qualifier `q' is not used
|
||||
]])
|
||||
|
||||
AT_DATA([input-c++-glr.y],
|
||||
@@ -853,10 +853,10 @@ AT_DATA([input-c++-glr.y],
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_BISON_CHECK([[input-c++-glr.y]], [0], [],
|
||||
[[input-c++-glr.y:1.7-9: warning: %code qualifier `bad' is not used
|
||||
input-c++-glr.y:2.7: warning: %code qualifier `q' is not used
|
||||
input-c++-glr.y:3.7: warning: %code qualifier `q' is not used
|
||||
AT_BISON_CHECK([[input-c++-glr.y]], [[1]], [],
|
||||
[[input-c++-glr.y:1.7-9: %code qualifier `bad' is not used
|
||||
input-c++-glr.y:2.7: %code qualifier `q' is not used
|
||||
input-c++-glr.y:3.7: %code qualifier `q' is not used
|
||||
]])
|
||||
|
||||
AT_DATA([special-char-@@.y],
|
||||
@@ -866,10 +866,10 @@ AT_DATA([special-char-@@.y],
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_BISON_CHECK([[special-char-@@.y]], [0], [],
|
||||
[[special-char-@@.y:1.7-9: warning: %code qualifier `bad' is not used
|
||||
special-char-@@.y:2.7: warning: %code qualifier `q' is not used
|
||||
special-char-@@.y:3.7: warning: %code qualifier `q' is not used
|
||||
AT_BISON_CHECK([[special-char-@@.y]], [[1]], [],
|
||||
[[special-char-@@.y:1.7-9: %code qualifier `bad' is not used
|
||||
special-char-@@.y:2.7: %code qualifier `q' is not used
|
||||
special-char-@@.y:3.7: %code qualifier `q' is not used
|
||||
]])
|
||||
|
||||
AT_DATA([special-char-@:>@.y],
|
||||
@@ -879,10 +879,10 @@ AT_DATA([special-char-@:>@.y],
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_BISON_CHECK([[special-char-@:>@.y]], [0], [],
|
||||
[[special-char-@:>@.y:1.7-9: warning: %code qualifier `bad' is not used
|
||||
special-char-@:>@.y:2.7: warning: %code qualifier `q' is not used
|
||||
special-char-@:>@.y:3.7: warning: %code qualifier `q' is not used
|
||||
AT_BISON_CHECK([[special-char-@:>@.y]], [[1]], [],
|
||||
[[special-char-@:>@.y:1.7-9: %code qualifier `bad' is not used
|
||||
special-char-@:>@.y:2.7: %code qualifier `q' is not used
|
||||
special-char-@:>@.y:3.7: %code qualifier `q' is not used
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -917,8 +917,8 @@ AT_DATA([input-unused.y],
|
||||
start: ;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input-unused.y]], [[0]], [],
|
||||
[[input-unused.y:1.9-11: warning: %define variable `var' is not used
|
||||
AT_BISON_CHECK([[input-unused.y]], [[1]], [],
|
||||
[[input-unused.y:1.9-11: %define variable `var' is not used
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -928,9 +928,9 @@ AT_CLEANUP
|
||||
## %define, --define, --force-define. ##
|
||||
## ----------------------------------- ##
|
||||
|
||||
AT_SETUP([%define, --define, --force-define])
|
||||
AT_SETUP([[%define, --define, --force-define]])
|
||||
|
||||
AT_DATA([skel.c],
|
||||
AT_DATA([[skel.c]],
|
||||
[[m4@&t@_divert_push(0)@
|
||||
@output(b4_parser_file_name@)@
|
||||
[var-dd: ]b4_percent_define_get([[var-dd]])[
|
||||
@@ -939,23 +939,16 @@ var-dfg: ]b4_percent_define_get([[var-dfg]])[
|
||||
var-fd: ]b4_percent_define_get([[var-fd]])
|
||||
m4@&t@_divert_pop(0)
|
||||
]])
|
||||
|
||||
AT_DATA([input.y],
|
||||
AT_DATA([[input.y]],
|
||||
[[%define var-dfg "gram"
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \
|
||||
-Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \
|
||||
-Dvar-dfg=cmd-d -Fvar-dfg=cmd-f \
|
||||
-Fvar-fd=cmd-f -Dvar-fd=cmd-d \
|
||||
-Dunused-d -Funused-f \
|
||||
--skeleton ./skel.c input.y]], [[0]], [],
|
||||
[[<command line>:10: warning: %define variable `unused-d' is not used
|
||||
<command line>:11: warning: %define variable `unused-f' is not used
|
||||
]])
|
||||
|
||||
--skeleton ./skel.c input.y]])
|
||||
AT_CHECK([[cat input.tab.c]], [[0]],
|
||||
[[var-dd: cmd-d2
|
||||
var-ff: cmd-f2
|
||||
@@ -963,17 +956,25 @@ var-dfg: cmd-f
|
||||
var-fd: cmd-d
|
||||
]])
|
||||
|
||||
AT_DATA([input-dg.y],
|
||||
AT_DATA([[input-dg.y]],
|
||||
[[%define var "gram"
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[-Dvar=cmd-d input-dg.y]], [[1]], [],
|
||||
[[input-dg.y:1.9-11: %define variable `var' redefined
|
||||
<command line>:2: previous definition
|
||||
]])
|
||||
|
||||
AT_DATA([[input-unused.y]],
|
||||
[[%%
|
||||
start: ;
|
||||
]])
|
||||
AT_BISON_CHECK([[-Dunused-d -Funused-f input-unused.y]], [[1]], [],
|
||||
[[<command line>:2: %define variable `unused-d' is not used
|
||||
<command line>:3: %define variable `unused-f' is not used
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
## --------------------------- ##
|
||||
@@ -1065,8 +1066,8 @@ AT_DATA([[input.y]],
|
||||
%%
|
||||
start: ;
|
||||
]])
|
||||
AT_BISON_CHECK([[input.y]], [0], [],
|
||||
[[input.y:1.9-15: warning: %define variable `foo_bar' is not used
|
||||
AT_BISON_CHECK([[input.y]], [[1]], [],
|
||||
[[input.y:1.9-15: %define variable `foo_bar' is not used
|
||||
]])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1090,8 +1091,8 @@ AT_DATA([[input.y]],
|
||||
start: ;
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([[input.y]], [0], [],
|
||||
[[input.y:1.9-16: warning: %define variable `api.pure' is not used
|
||||
AT_BISON_CHECK([[input.y]], [[1]], [],
|
||||
[[input.y:1.9-16: %define variable `api.pure' is not used
|
||||
]])
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user