On Tue, 30 Mar 2010, Joel E. Denny wrote: > On Mon, 29 Mar 2010, Richard Stallman wrote: > > > POSIX specifies that an error be reported for any identifier that does > > not appear on the LHS of a grammar rule and that is not defined by > > %token, %left, %right, or %nonassoc. Bison 2.3b and later lost this > > error report for the case when an identifier appears only after a > > %prec directive. It is now restored. However, for backward > > compatibility with recent Bison releases, it is only a warning for > > now. In Bison 2.5 and later, it will return to being an error. > > > > Why not keep it as a warning only? > > Fine with me. Any opinions from anyone else?
I pushed the first patch below to master and branch-2.5. I pushed the second patch to branch-2.4.3, branch-2.5, and master. >From 02354690ee02dfa05564137aafc6721eb54d21ab Mon Sep 17 00:00:00 2001 From: Joel E. Denny <[email protected]> Date: Fri, 30 Apr 2010 14:41:07 -0400 Subject: [PATCH] Revert 2009-12-30 change for undefined %prec token complaints. That is, keep them as warnings because that should be sufficient to satisfy POSIX without creating backward compatibility issues. Suggested by Richard Stallman at <http://lists.gnu.org/archive/html/bison-patches/2010-03/msg00033.html>. * NEWS (2.5): Remove mention of complaint. * src/reader.c (grammar_rule_check): Convert warning back to complaint. * tests/input.at (%prec's token must be defined): Update. --- ChangeLog | 12 ++++++++++++ NEWS | 6 ------ src/reader.c | 4 ++-- tests/input.at | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f16e056..c129357 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2010-04-30 Joel E. Denny <[email protected]> + + Revert 2009-12-30 change for undefined %prec token complaints. + That is, keep them as warnings because that should be sufficient + to satisfy POSIX without creating backward compatibility issues. + Suggested by Richard Stallman at + <http://lists.gnu.org/archive/html/bison-patches/2010-03/msg00033.html>. + * NEWS (2.5): Remove mention of complaint. + * src/reader.c (grammar_rule_check): Convert warning back to + complaint. + * tests/input.at (%prec's token must be defined): Update. + 2010-04-25 Joel E. Denny <[email protected]> build: don't require src/bison during bootstrap. diff --git a/NEWS b/NEWS index 4c4409b..acdd5be 100644 --- a/NEWS +++ b/NEWS @@ -180,12 +180,6 @@ Bison News discussion of how to suppress C preprocessor warnings about YYFAIL being unused, see the Bison 2.4.2 NEWS entry. -** `%prec IDENTIFIER' requires IDENTIFIER to be defined separately. - - As promised in Bison 2.4.2's NEWS entry, it is now an error if a token - that appears after a %prec directive is not defined by %token, %left, - %right, or %nonassoc. This is required by POSIX. - ** Temporary hack for adding a semicolon to the user action. Previously, Bison appended a semicolon to every user action for diff --git a/src/reader.c b/src/reader.c index 03c5bae..f1be24b 100644 --- a/src/reader.c +++ b/src/reader.c @@ -327,8 +327,8 @@ grammar_rule_check (const symbol_list *r) if (r->ruleprec && r->ruleprec->tag[0] != '\'' && r->ruleprec->tag[0] != '"' && !r->ruleprec->declared && !r->ruleprec->prec) - complain_at (r->location, _("token for %%prec is not defined: %s"), - r->ruleprec->tag); + warn_at (r->location, _("token for %%prec is not defined: %s"), + r->ruleprec->tag); } diff --git a/tests/input.at b/tests/input.at index 71fc356..64a1809 100644 --- a/tests/input.at +++ b/tests/input.at @@ -806,8 +806,8 @@ AT_DATA([[input.y]], start: %prec PREC ; ]]) -AT_BISON_CHECK([[input.y]], [[1]], [], -[[input.y:2.8-17: token for %prec is not defined: PREC +AT_BISON_CHECK([[input.y]], [[0]], [], +[[input.y:2.8-17: warning: token for %prec is not defined: PREC ]]) AT_CLEANUP -- 1.5.4.3 >From ff1f7871df81d5183eafeff380104da7a4a94749 Mon Sep 17 00:00:00 2001 From: Joel E. Denny <[email protected]> Date: Fri, 30 Apr 2010 15:29:23 -0400 Subject: [PATCH] Document that undefined %prec identifier warnings will remain. * NEWS (2.4.3): Here. (2.4.2): Here. --- ChangeLog | 6 ++++++ NEWS | 7 +++++++ 2 files changed, 13 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18b0946..a1dbfbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-04-30 Joel E. Denny <[email protected]> + + Document that undefined %prec identifier warnings will remain. + * NEWS (2.4.3): Here. + (2.4.2): Here. + 2010-04-25 Joel E. Denny <[email protected]> build: don't require src/bison during bootstrap. diff --git a/NEWS b/NEWS index ceee3d9..66622ac 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,11 @@ Bison News ** Failures in the test suite for some versions of Sun Studio C++ have been fixed. +** Contrary to Bison 2.4.2's NEWS entry, it has been decided that + warnings about undefined %prec identifiers will not be converted to + errors in Bison 2.5. They will remain warnings, which should be + sufficient for POSIX while avoiding backward compatibility issues. + * Changes in version 2.4.2 (2010-03-20): ** Some portability problems that resulted in failures and livelocks @@ -28,6 +33,8 @@ Bison News %prec directive. It is now restored. However, for backward compatibility with recent Bison releases, it is only a warning for now. In Bison 2.5 and later, it will return to being an error. + [Between the 2.4.2 and 2.4.3 releases, it was decided that this + warning will not be converted to an error in Bison 2.5.] ** Detection of GNU M4 1.4.6 or newer during configure is improved. -- 1.5.4.3
