From: Joel E. Denny Date: Wed, 30 Dec 2009 08:14:12 +0000 (-0500) Subject: POSIX: complain if %prec's token was not defined. X-Git-Tag: v2.7.90~728 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/882be728b2481ed2f83805ab8d2cbbab2830f39c POSIX: complain if %prec's token was not defined. * NEWS (2.5): Document. * src/reader.c (grammar_rule_check): Convert warning to complaint. * tests/input.at (%prec's token must be defined): Update. (cherry picked from commit 510df9519ec6347c13a57535d0589e3a87bfe2fe) --- diff --git a/ChangeLog b/ChangeLog index 699ede37..5388e29c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-12-30 Joel E. Denny + + POSIX: complain if %prec's token was not defined. + * NEWS (2.5): Document. + * src/reader.c (grammar_rule_check): Convert warning to + complaint. + * tests/input.at (%prec's token must be defined): Update. + 2009-12-30 Joel E. Denny POSIX: warn if %prec's token was not defined. diff --git a/NEWS b/NEWS index 57997905..13b199e6 100644 --- a/NEWS +++ b/NEWS @@ -180,6 +180,12 @@ 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 250e4f8b..3f007541 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) - warn_at (r->location, _("token for %%prec is not defined: %s"), - r->ruleprec->tag); + complain_at (r->location, _("token for %%prec is not defined: %s"), + r->ruleprec->tag); } diff --git a/tests/input.at b/tests/input.at index 6f0d70c3..1a08f356 100644 --- a/tests/input.at +++ b/tests/input.at @@ -807,8 +807,8 @@ AT_DATA([[input.y]], start: %prec PREC ; ]]) -AT_BISON_CHECK([[input.y]], [[0]], [], -[[input.y:2.8-17: warning: token for %prec is not defined: PREC +AT_BISON_CHECK([[input.y]], [[1]], [], +[[input.y:2.8-17: token for %prec is not defined: PREC ]]) AT_CLEANUP