mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
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:
@@ -131,8 +131,8 @@ b: {} {};
|
||||
|
||||
AT_BISON_CHECK([-fcaret -Wempty-rule 1.y], [0], [],
|
||||
[[1.y:11.17-18: warning: empty rule without %empty [-Wempty-rule]
|
||||
a: /* empty. */ {};
|
||||
^~
|
||||
11 | a: /* empty. */ {};
|
||||
| ^~
|
||||
]])
|
||||
|
||||
AT_DATA_GRAMMAR([[2.y]],
|
||||
@@ -145,11 +145,11 @@ c: /* empty. */ {};
|
||||
|
||||
AT_BISON_CHECK([-fcaret 2.y], [0], [],
|
||||
[[2.y:11.17-18: warning: empty rule without %empty [-Wempty-rule]
|
||||
a: /* empty. */ {};
|
||||
^~
|
||||
11 | a: /* empty. */ {};
|
||||
| ^~
|
||||
2.y:13.17-18: warning: empty rule without %empty [-Wempty-rule]
|
||||
c: /* empty. */ {};
|
||||
^~
|
||||
13 | c: /* empty. */ {};
|
||||
| ^~
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret -Wno-empty-rule 2.y], [0])
|
||||
@@ -174,21 +174,21 @@ exp:
|
||||
|
||||
AT_BISON_CHECK([-fcaret one.y], [1], [],
|
||||
[[one.y:11.13-18: error: only one %empty allowed per rule
|
||||
%empty {} %empty
|
||||
^~~~~~
|
||||
11 | %empty {} %empty
|
||||
| ^~~~~~
|
||||
one.y:11.3-8: previous declaration
|
||||
%empty {} %empty
|
||||
^~~~~~
|
||||
11 | %empty {} %empty
|
||||
| ^~~~~~
|
||||
one.y: warning: fix-its can be applied. Rerun with option '--update'. [-Wother]
|
||||
]])
|
||||
|
||||
AT_BISON_CHECK([-fcaret -u one.y], [1], [],
|
||||
[[one.y:11.13-18: error: only one %empty allowed per rule
|
||||
%empty {} %empty
|
||||
^~~~~~
|
||||
11 | %empty {} %empty
|
||||
| ^~~~~~
|
||||
one.y:11.3-8: previous declaration
|
||||
%empty {} %empty
|
||||
^~~~~~
|
||||
11 | %empty {} %empty
|
||||
| ^~~~~~
|
||||
bison: file 'one.y' was updated (backup: 'one.y~')
|
||||
]])
|
||||
|
||||
@@ -219,14 +219,14 @@ exp:
|
||||
|
||||
AT_BISON_CHECK([-fcaret two.y], [1], [],
|
||||
[[two.y:11.7-12: error: %empty on non-empty rule
|
||||
'a' %empty {}
|
||||
^~~~~~
|
||||
11 | 'a' %empty {}
|
||||
| ^~~~~~
|
||||
two.y:12.3-8: error: %empty on non-empty rule
|
||||
| %empty 'a' {}
|
||||
^~~~~~
|
||||
12 | | %empty 'a' {}
|
||||
| ^~~~~~
|
||||
two.y:13.3-8: error: %empty on non-empty rule
|
||||
| %empty {} {}
|
||||
^~~~~~
|
||||
13 | | %empty {} {}
|
||||
| ^~~~~~
|
||||
]])
|
||||
|
||||
AT_BISON_OPTION_POPDEFS
|
||||
@@ -1550,17 +1550,17 @@ input.y:32.3-23: warning: unused value: $3 [-Wother]
|
||||
|
||||
AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
|
||||
[[input.y:24.57-59: warning: useless %destructor for type <*> [-Wother]
|
||||
%printer { #error "<*> printer should not be used" } <*>
|
||||
^~~
|
||||
24 | %printer { #error "<*> printer should not be used" } <*>
|
||||
| ^~~
|
||||
input.y:24.57-59: warning: useless %printer for type <*> [-Wother]
|
||||
%printer { #error "<*> printer should not be used" } <*>
|
||||
^~~
|
||||
24 | %printer { #error "<*> printer should not be used" } <*>
|
||||
| ^~~
|
||||
input.y:33.3-23: warning: unset value: $$ [-Wother]
|
||||
{ @$ = 4; } // Only used.
|
||||
^~~~~~~~~~~~~~~~~~~~~
|
||||
33 | { @$ = 4; } // Only used.
|
||||
| ^~~~~~~~~~~~~~~~~~~~~
|
||||
input.y:32.3-23: warning: unused value: $3 [-Wother]
|
||||
{ USE ($$); @$ = 3; } // Only set.
|
||||
^~~~~~~~~~~~~~~~~~~~~
|
||||
32 | { USE ($$); @$ = 3; } // Only set.
|
||||
| ^~~~~~~~~~~~~~~~~~~~~
|
||||
]])
|
||||
|
||||
AT_COMPILE([input])
|
||||
|
||||
Reference in New Issue
Block a user