[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 00/12] {master} explicit empty right-hand side of a rule
From: |
Akim Demaille |
Subject: |
[PATCH 00/12] {master} explicit empty right-hand side of a rule |
Date: |
Sat, 16 Feb 2013 14:55:36 +0100 |
Joel wrote:
> How about the following proposal?
>
> 1. -Wall will continue to mean all warnings rather than trying to mimic
> gcc's -Wall. If someone specifies -Wall, he has no right to complain that
> it enables a warning (such as -Wempty-rule) that he doesn't find useful.
> He explicitly requested all warnings that Bison provides and might ever
> provide.
>
> 2. -Wempty-rule will be off by default for now because it would likely be
> too noisy for projects not ready to rewrite for %empty. A use of %empty
> will enable it by default.
>
> 3. Yacc mode should have no influence on whether -Wempty-rule is enabled.
> That is, because existing Yacc-compatible grammars don't use %empty, they
> won't produce the warnings unless the user has requested them.
This is a nice summary, and that's what I implemented.
It's funny how a single character can influence your mind: as long as
I wanted to use "$empty", I saw it as a pseudo-symbol, and meant to
treat it as a symbol (appended to the rule by the parser). Many
complications follow from that (in both checking valid uses of %empty,
and when stripping %empty when building the tables).
But once you suggested "%empty", I started to see it as an "adjective"
about rules, much like %prec and other %dprecs. The implementation is
then much simpler, and more consistent with the other directives.
This batch of commits relies on previous changes that were made so
that we could implement "if %empty is used then enable -Wempty-rule,
unless -Wno-empty-rule":
http://lists.gnu.org/archive/html/bison-patches/2013-02/msg00043.html
One question is whether the documentation should be moved to use
%empty. I decided to do forward and use it everywhere, but of course
to leave a note about compatibility with Yacc.
The last three patches are boring, and should be sent in a separate
thread, but I feel lazy...
Akim Demaille (12):
grammar: introduce %empty
parser: use %empty
regen
tests: use %empty
-Wempty-rule: diagnose empty rules without %empty
diagnostics: %empty enables -Wempty-rule
report: use %empty to denote empty rules
doc: introduce %empty and -Wempty-rule
doc: use %empty instead of /* empty */
style: no longer use backquotes in messages
style: no longer use backquotes
style: no longer use backquotes
NEWS | 22 ++
README | 2 +-
REFERENCES | 2 +-
THANKS | 1 +
TODO | 8 +-
configure.ac | 2 +-
data/README | 2 +-
data/bison.m4 | 6 +-
data/c++.m4 | 4 +-
data/c.m4 | 4 +-
data/java.m4 | 2 +-
data/lalr1.cc | 2 +-
data/lalr1.java | 2 +-
data/yacc.c | 12 +-
doc/bison.texi | 159 +++++++++-----
doc/local.mk | 2 +-
etc/bench.pl.in | 4 +-
lib/libiberty.h | 2 +-
lib/timevar.h | 2 +-
src/complain.c | 11 +
src/complain.h | 5 +
src/conflicts.c | 2 +-
src/files.c | 26 +--
src/getargs.c | 49 ++---
src/gram.c | 6 +-
src/gram.h | 12 +-
src/lalr.c | 2 +-
src/location.c | 2 +-
src/location.h | 2 +-
src/muscle-tab.c | 8 +-
src/muscle-tab.h | 2 +-
src/output.c | 2 +-
src/parse-gram.c | 552 +++++++++++++++++++++++++-----------------------
src/parse-gram.h | 8 +-
src/parse-gram.y | 30 +--
src/print-xml.c | 2 +-
src/print.c | 4 +-
src/reader.c | 37 +++-
src/reader.h | 2 +
src/reduce.c | 2 +-
src/scan-gram.l | 1 +
src/scan-skel.l | 6 +-
src/symlist.c | 1 +
src/symlist.h | 4 +
src/symtab.h | 6 +-
src/system.h | 2 +-
src/tables.c | 14 +-
tests/actions.at | 116 +++++++++-
tests/atlocal.in | 2 +-
tests/c++.at | 4 +-
tests/calc.at | 40 ++--
tests/conflicts.at | 22 +-
tests/existing.at | 93 ++++++--
tests/glr-regression.at | 8 +-
tests/input.at | 90 ++++----
tests/java.at | 16 +-
tests/local.at | 14 +-
tests/reduce.at | 6 +-
tests/regression.at | 14 +-
tests/sets.at | 10 +-
tests/synclines.at | 2 +-
61 files changed, 901 insertions(+), 576 deletions(-)
--
1.8.1.3
- Re: RFC: explicit empty right-hand side of a rule, Joel E. Denny, 2013/02/03
- Re: RFC: explicit empty right-hand side of a rule, Akim Demaille, 2013/02/03
- Re: RFC: explicit empty right-hand side of a rule, Joel E. Denny, 2013/02/03
- Re: RFC: explicit empty right-hand side of a rule, Akim Demaille, 2013/02/04
- Re: RFC: explicit empty right-hand side of a rule, Joel E. Denny, 2013/02/04
- Re: RFC: explicit empty right-hand side of a rule, Akim Demaille, 2013/02/05
- Re: RFC: explicit empty right-hand side of a rule, Joel E. Denny, 2013/02/05
- [PATCH 00/12] {master} explicit empty right-hand side of a rule,
Akim Demaille <=
- Re: [PATCH 00/12] {master} explicit empty right-hand side of a rule, Akim Demaille, 2013/02/16
- Re: [PATCH 00/12] {master} explicit empty right-hand side of a rule, Akim Demaille, 2013/02/19
- [PATCH 02/12] parser: use %empty, Akim Demaille, 2013/02/18
- [PATCH 01/12] grammar: introduce %empty, Akim Demaille, 2013/02/18
- Re: [PATCH 01/12] grammar: introduce %empty, Akim Demaille, 2013/02/18
- [PATCH 10/12] style: no longer use backquotes in messages, Akim Demaille, 2013/02/18
- [PATCH 08/12] doc: introduce %empty and -Wempty-rule, Akim Demaille, 2013/02/18
- Re: [PATCH 08/12] doc: introduce %empty and -Wempty-rule, Akim Demaille, 2013/02/16
- [PATCH 07/12] report: use %empty to denote empty rules, Akim Demaille, 2013/02/18
- [PATCH 09/12] doc: use %empty instead of /* empty */, Akim Demaille, 2013/02/18