diagnostics: copy GCC9's format

Currently, when we quote the source file, we indent it with one space,
and preserve tabulations, so there is a discrepancy and the visual
rendering is bad.  One way out is to indent with a tab instead of a
space, but then this space can be used for more information.  This is
what GCC9 does.  Let's play copy cats.

See
https://lists.gnu.org/archive/html/bison-patches/2019-04/msg00025.html
https://developers.redhat.com/blog/2019/03/08/usability-improvements-in-gcc-9/
https://gcc.gnu.org/onlinedocs/gccint/Guidelines-for-Diagnostics.html#Guidelines-for-Diagnostics

* src/location.c (location_caret): Prefix quoted lines with the line
number and a pipe, fitting 8 columns.

* tests/actions.at, tests/c++.at, tests/conflicts.at,
* tests/diagnostics.at, tests/input.at, tests/java.at,
* tests/named-refs.at, tests/reduce.at, tests/regression.at,
* tests/sets.at: Adjust expectations.
Partly by "./build-aux/update-test tests/testsuite.dir/*/testsuite.log"
repeatedly, and partly by hand.
This commit is contained in:
Akim Demaille
2019-04-22 07:52:38 +02:00
parent afe7dfd3b9
commit a9b350fb3a
11 changed files with 502 additions and 502 deletions

View File

@@ -247,17 +247,17 @@ f: B
AT_BISON_CHECK([-Wprecedence -fcaret -o input.c input.y], 0, [],
[[input.y:7.1-9: warning: useless precedence and associativity for U [-Wprecedence]
%nonassoc U
^~~~~~~~~
7 | %nonassoc U
| ^~~~~~~~~
input.y:6.1-6: warning: useless precedence and associativity for V [-Wprecedence]
%right V
^~~~~~
6 | %right V
| ^~~~~~
input.y:5.1-5: warning: useless precedence and associativity for W [-Wprecedence]
%left W
^~~~~
5 | %left W
| ^~~~~
input.y:2.1-11: warning: useless precedence for Z [-Wprecedence]
%precedence Z
^~~~~~~~~~~
2 | %precedence Z
| ^~~~~~~~~~~
]])
AT_CLEANUP
@@ -287,8 +287,8 @@ AT_BISON_CHECK([-o input.c input.y], 0, [],
AT_BISON_CHECK([-fcaret -o input.c input.y], 0, [],
[[input.y:4.9: warning: rule useless in parser due to conflicts [-Wother]
e: 'e' | /* Nothing. */;
^
4 | e: 'e' | /* Nothing. */;
| ^
]])
AT_CLEANUP
@@ -1344,8 +1344,8 @@ b: %expect-rr 4
AT_BISON_CHECK([-fcaret -o input.c input.y], 1, [],
[[input.y:12.4-15: error: reduce/reduce conflicts for rule 8: 3 found, 4 expected
b: %expect-rr 4
^~~~~~~~~~~~
12 | b: %expect-rr 4
| ^~~~~~~~~~~~
]])
AT_CLEANUP
@@ -1373,8 +1373,8 @@ b: %expect-rr 2
AT_BISON_CHECK([-fcaret -o input.c input.y], 1, [],
[[input.y:12.4-15: error: reduce/reduce conflicts for rule 8: 3 found, 2 expected
b: %expect-rr 2
^~~~~~~~~~~~
12 | b: %expect-rr 2
| ^~~~~~~~~~~~
]])
AT_CLEANUP