mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-17 16:23:04 +00:00
merge branch 'maint'
* upstream/maint: maint: post-release administrivia version 3.5.3 news: update for 3.5.3 yacc.c: make sure we properly propagated the user's number for error diagnostics: don't crash because of repeated definitions of error style: initialize some struct members diagnostics: beware of zero-width characters diagnostics: be sure to close the styling when lines are too short muscles: fix incorrect decoding of $ code: be robust to reference with invalid tags build: fix typo doc: update recommandation for libtextstyle style: comment changes examples: use consistently the GFDL header for readmes style: remove useless declarations typo: succesful -> successful README: point to tests/bison, and document --trace gnulib: update maint: post-release administrivia
This commit is contained in:
@@ -37,15 +37,15 @@ AT_BISON_OPTION_PUSHDEFS
|
||||
|
||||
AT_DATA_GRAMMAR([[input.y]], [$2])
|
||||
|
||||
AT_DATA([experr], [$4])
|
||||
|
||||
# For some reason, literal ^M in the input are removed and don't end
|
||||
# in `input.y`. So use the two-character ^M represent it, and let
|
||||
# Perl insert real CR characters.
|
||||
if grep '\^M' input.y >/dev/null; then
|
||||
AT_PERL_REQUIRE([-pi -e 's{\^M}{\r}gx' input.y])
|
||||
if $EGREP ['\^M|\\[0-9][0-9][0-9]'] input.y experr >/dev/null; then
|
||||
AT_PERL_REQUIRE([-pi -e 's{\^M}{\r}g;s{\\(\d{3}|.)}{$v = $[]1; $v =~ /\A\d+\z/ ? chr($v) : $v}ge' input.y experr])
|
||||
fi
|
||||
|
||||
AT_DATA([experr], [$4])
|
||||
|
||||
AT_CHECK([LC_ALL="$locale" $5 bison -fcaret --color=debug -Wall input.y], [$3], [], [experr])
|
||||
|
||||
# When no style, same messages, but without style.
|
||||
@@ -152,6 +152,65 @@ input.y: <warning>warning:</warning> fix-its can be applied. Rerun with option
|
||||
]])
|
||||
|
||||
|
||||
|
||||
## ------------------------------------- ##
|
||||
## Line is too short, and then you die. ##
|
||||
## ------------------------------------- ##
|
||||
|
||||
# We trust the "#line", since that's what allows us to quote the
|
||||
# actual source from which the gramar file was generated. But #line
|
||||
# can also be wrong, and point to a line which is shorter that the bad
|
||||
# one. In which case we can easily forget to close the styling.
|
||||
#
|
||||
# Be sure to have #line point to a line long enough to open the
|
||||
# styling, but not enough to close it.
|
||||
|
||||
AT_TEST([[Line is too short, and then you die]],
|
||||
[[// Beware that there are 9 lines inserted before (including this one).
|
||||
#line 12
|
||||
%token foo 123
|
||||
%token foo 123123
|
||||
%token foo 123
|
||||
%%
|
||||
exp:
|
||||
]],
|
||||
[1],
|
||||
[[input.y:13.8-10: <warning>warning:</warning> symbol foo redeclared [<warning>-Wother</warning>]
|
||||
13 | %token <warning>foo</warning> 123
|
||||
| <warning>^~~</warning>
|
||||
input.y:12.8-10: <note>note:</note> previous declaration
|
||||
12 | %token <note>foo</note> 123123
|
||||
| <note>^~~</note>
|
||||
input.y:13.12-17: <error>error:</error> redefining user token number of foo
|
||||
13 | %token foo <error>123</error>
|
||||
| <error>^~~~~~</error>
|
||||
input.y:14.8-10: <warning>warning:</warning> symbol foo redeclared [<warning>-Wother</warning>]
|
||||
14 | %%
|
||||
| <warning>^~~</warning>
|
||||
input.y:12.8-10: <note>note:</note> previous declaration
|
||||
12 | %token <note>foo</note> 123123
|
||||
| <note>^~~</note>
|
||||
]])
|
||||
|
||||
|
||||
## ----------------------- ##
|
||||
## Zero-width characters. ##
|
||||
## ----------------------- ##
|
||||
|
||||
# We used to open twice the styling for characters that have a
|
||||
# zero-width on display (e.g., \005).
|
||||
|
||||
AT_TEST([[Zero-width characters]],
|
||||
[[%%
|
||||
exp: an\005error.
|
||||
]],
|
||||
[1],
|
||||
[[input.y:10.8: <error>error:</error> invalid character: '\\005'
|
||||
10 | exp: an<error>\005</error>error.
|
||||
| <error>^</error>
|
||||
]])
|
||||
|
||||
|
||||
## -------------------------------------- ##
|
||||
## Tabulations and multibyte characters. ##
|
||||
## -------------------------------------- ##
|
||||
@@ -262,7 +321,7 @@ input.y:10.1-27: <error>error:</error> %define variable 'error2' is not used
|
||||
## ----------------- ##
|
||||
|
||||
# Carriage-return used to count as a newline in the scanner, and not
|
||||
# in diagnostics. Resulting in all sort of nice bugs.
|
||||
# in diagnostics. Resulting in all kinds of nice bugs.
|
||||
|
||||
AT_TEST([[Carriage return]],
|
||||
[[^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M^M
|
||||
|
||||
Reference in New Issue
Block a user