[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Don't suppress warnings about unused parse.error.
From: |
Joel E. Denny |
Subject: |
Re: Don't suppress warnings about unused parse.error. |
Date: |
Thu, 3 Sep 2009 16:11:12 -0400 (EDT) |
User-agent: |
Alpine 1.00 (DEB 882 2007-12-20) |
On Thu, 3 Sep 2009, Joel E. Denny wrote:
> >From 82db7cdb69931bfbc547a2e84ee06fdd7293e6e9 Mon Sep 17 00:00:00 2001
> From: Joel E. Denny <address@hidden>
> Date: Thu, 3 Sep 2009 14:27:16 -0400
> Subject: [PATCH] Don't suppress warnings about unused parse.error.
And actually, I'd rather unused %define variables produce complaints not
warnings. Likewise for unused %code qualifiers. Any objections to the
following patch for master and branch-2.5?
>From 974a14dcb6de7970d8ee943c7470d23052cac378 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Thu, 3 Sep 2009 16:04:10 -0400
Subject: [PATCH] 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.
---
ChangeLog | 14 ++++++++
NEWS | 4 ++
data/bison.m4 | 14 ++++----
doc/bison.texinfo | 17 ++++++----
tests/input.at | 89 +++++++++++++++++++++++++++--------------------------
tests/push.at | 4 +-
6 files changed, 82 insertions(+), 60 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 754063d..03ff3c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2009-09-03 Joel E. Denny <address@hidden>
+ 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.
+
+2009-09-03 Joel E. Denny <address@hidden>
+
Don't suppress warnings about unused parse.error.
* data/bison.m4 (b4_error_verbose_flag): Don't examine value of
%define variable parse.error unless b4_error_verbose_flag is
diff --git a/NEWS b/NEWS
index 63d09a3..e9a5dae 100644
--- a/NEWS
+++ b/NEWS
@@ -68,8 +68,12 @@ Bison News
These features are experimental. More user feedback will help to
stabilize them.
+** Unrecognized %code qualifiers are now an error not a warning.
+
** %define improvements.
+*** Unrecognized variables are now an error not a warning.
+
*** Multiple invocations for any variable is now an error not a warning.
*** Can now be invoked via the command line.
diff --git a/data/bison.m4 b/data/bison.m4
index 4a36802..2ec96db 100644
--- a/data/bison.m4
+++ b/data/bison.m4
@@ -500,10 +500,10 @@ b4_define_user_code([stype])
# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
-# --------------------------------------------------------
-# Warn if any name of type WHAT is used by the user (as recorded in USER-LIST)
-# but is not used by Bison (as recorded by macros in the namespace
-# BISON-NAMESPACE).
+# -----------------------------------------------------
+# Complain if any name of type WHAT is used by the user (as recorded in
+# USER-LIST) but is not used by Bison (as recorded by macros in the
+# namespace BISON-NAMESPACE).
#
# USER-LIST must expand to a list specifying all user occurrences of all names
# of type WHAT. Each item in the list must be a triplet specifying one
@@ -541,9 +541,9 @@ m4_pushdef([b4_user_name], m4_car(b4_occurrence))dnl
m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl
m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))dnl
m4_ifndef($3[(]m4_quote(b4_user_name)[)],
- [b4_warn_at([b4_start], [b4_end],
- [[%s `%s' is not used]],
- [$1], [b4_user_name])])[]dnl
+ [b4_complain_at([b4_start], [b4_end],
+ [[%s `%s' is not used]],
+ [$1], [b4_user_name])])[]dnl
m4_popdef([b4_occurrence])dnl
m4_popdef([b4_user_name])dnl
m4_popdef([b4_start])dnl
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index 4cc5a77..12c5ed3 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -4763,7 +4763,9 @@ use this form instead.
@var{qualifier} identifies the purpose of @var{code} and thus the location(s)
where Bison should generate it.
-Not all values of @var{qualifier} are available for all target languages:
+Not all @var{qualifier}s are accepted for all target languages.
+Unaccepted @var{qualifier}s produce an error.
+Some of the accepted @var{qualifier}s are:
@itemize @bullet
@item requires
@@ -4845,9 +4847,6 @@ parse.trace}.
@deffnx {Directive} %define @var{variable} @var{value}
@deffnx {Directive} %define @var{variable} "@var{value}"
Define a variable to adjust Bison's behavior.
-The possible choices for @var{variable}, as well as their meanings, depend on
-the selected target language and/or the parser skeleton (@pxref{Decl
-Summary,,%language}, @pxref{Decl Summary,,%skeleton}).
It is an error if a @var{variable} is defined by @code{%define} multiple
times, but see @ref{Bison Options,,-D @address@hidden
@@ -4859,7 +4858,7 @@ digit.
Omitting @code{"@var{value}"} entirely is always equivalent to specifying
@code{""}.
-Some @var{variable}s may be used as Booleans.
+Some @var{variable}s take Boolean values.
In this case, Bison will complain if the variable definition does not meet one
of the following four conditions:
@@ -4872,10 +4871,14 @@ This is equivalent to @code{true}.
@item @address@hidden is @code{false}.
@item @var{variable} is never defined.
-In this case, Bison selects a default value, which may depend on the selected
-target language and/or parser skeleton.
+In this case, Bison selects a default value.
@end enumerate
+What @var{variable}s are accepted, as well as their meanings and default
+values, depend on the selected target language and/or the parser
+skeleton (@pxref{Decl Summary,,%language}, @pxref{Decl
+Summary,,%skeleton}).
+Unaccepted @var{variable}s produce an error.
Some of the accepted @var{variable}s are:
@table @code
diff --git a/tests/input.at b/tests/input.at
index 3f08a1b..ab01cbe 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -808,11 +808,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],
@@ -822,10 +822,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],
@@ -835,10 +835,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],
@@ -848,10 +848,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],
@@ -861,10 +861,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],
@@ -874,10 +874,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
@@ -912,8 +912,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
@@ -923,9 +923,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@&address@hidden(0)@
@output(b4_parser_file_name@)@
[var-dd: ]b4_percent_define_get([[var-dd]])[
@@ -934,23 +934,16 @@ var-dfg: ]b4_percent_define_get([[var-dfg]])[
var-fd: ]b4_percent_define_get([[var-fd]])
m4@&address@hidden(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
@@ -958,17 +951,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
## --------------------------- ##
@@ -1071,8 +1072,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
@@ -1096,8 +1097,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
]])
])
diff --git a/tests/push.at b/tests/push.at
index 831be0c..4c548fd 100644
--- a/tests/push.at
+++ b/tests/push.at
@@ -161,8 +161,8 @@ AT_DATA([[input.y]],
start: ;
]])
-AT_BISON_CHECK([[input.y]], [0], [],
-[[input.y:2.9-21: warning: %define variable `api.push-pull' is not used
+AT_BISON_CHECK([[input.y]], [[1]], [],
+[[input.y:2.9-21: %define variable `api.push-pull' is not used
]])
AT_CLEANUP
--
1.5.4.3