diagnostics: prefer ^~~~ to ^^^^ to underline code

That's what both GCC and Clang do, and it is indeed much nicer to
read.  From:

    foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
     %error-verbose
     ^^^^^^^^^^^^^^
    foo.y:4.1-20: warning: deprecated directive, use '%define api.prefix {foo}' [-Wdeprecated]
     %name-prefix = "foo"
     ^^^^^^^^^^^^^^^^^^^^

to:

    foo.y:1.1-14: warning: deprecated directive, use '%define parse.error verbose' [-Wdeprecated]
     %error-verbose
     ^~~~~~~~~~~~~~
    foo.y:4.1-20: warning: deprecated directive, use '%define api.prefix {foo}' [-Wdeprecated]
     %name-prefix = "foo"
     ^~~~~~~~~~~~~~~~~~~~

* src/location.c (location_caret): Use ^~~~.
Adjust tests expectations.
This commit is contained in:
Akim Demaille
2019-01-13 08:41:28 +01:00
parent 8c3a7687e4
commit a7ff1c75be
8 changed files with 215 additions and 215 deletions

View File

@@ -134,31 +134,31 @@ AT_BISON_CHECK([[-fcaret input.y]], 0, [],
input.y: warning: 9 rules useless in grammar [-Wother]
input.y:6.1-8: warning: nonterminal useless in grammar: useless1 [-Wother]
useless1: '1';
^^^^^^^^
^~~~~~~~
input.y:7.1-8: warning: nonterminal useless in grammar: useless2 [-Wother]
useless2: '2';
^^^^^^^^
^~~~~~~~
input.y:8.1-8: warning: nonterminal useless in grammar: useless3 [-Wother]
useless3: '3';
^^^^^^^^
^~~~~~~~
input.y:9.1-8: warning: nonterminal useless in grammar: useless4 [-Wother]
useless4: '4';
^^^^^^^^
^~~~~~~~
input.y:10.1-8: warning: nonterminal useless in grammar: useless5 [-Wother]
useless5: '5';
^^^^^^^^
^~~~~~~~
input.y:11.1-8: warning: nonterminal useless in grammar: useless6 [-Wother]
useless6: '6';
^^^^^^^^
^~~~~~~~
input.y:12.1-8: warning: nonterminal useless in grammar: useless7 [-Wother]
useless7: '7';
^^^^^^^^
^~~~~~~~
input.y:13.1-8: warning: nonterminal useless in grammar: useless8 [-Wother]
useless8: '8';
^^^^^^^^
^~~~~~~~
input.y:14.1-8: warning: nonterminal useless in grammar: useless9 [-Wother]
useless9: '9';
^^^^^^^^
^~~~~~~~
]])
@@ -240,13 +240,13 @@ AT_BISON_CHECK([[-fcaret not-reduced.y]], 0, [],
not-reduced.y: warning: 3 rules useless in grammar [-Wother]
not-reduced.y:14.1-13: warning: nonterminal useless in grammar: not_reachable [-Wother]
not_reachable: useful { /* A not reachable action. */ }
^^^^^^^^^^^^^
^~~~~~~~~~~~~
not-reduced.y:17.1-14: warning: nonterminal useless in grammar: non_productive [-Wother]
non_productive: non_productive useless_token
^^^^^^^^^^^^^^
^~~~~~~~~~~~~~
not-reduced.y:11.6-57: warning: rule useless in grammar [-Wother]
| non_productive { /* A non productive action. */ }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
]])
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' not-reduced.output]], 0,
@@ -319,13 +319,13 @@ AT_BISON_CHECK([[-fcaret input.y]], 0, [],
input.y: warning: 3 rules useless in grammar [-Wother]
input.y:6.1-11: warning: nonterminal useless in grammar: underivable [-Wother]
underivable: indirection;
^^^^^^^^^^^
^~~~~~~~~~~
input.y:7.1-11: warning: nonterminal useless in grammar: indirection [-Wother]
indirection: underivable;
^^^^^^^^^^^
^~~~~~~~~~~
input.y:5.15-25: warning: rule useless in grammar [-Wother]
exp: useful | underivable;
^^^^^^^^^^^
^~~~~~~~~~~
]])
AT_CHECK([[sed -n '/^Grammar/q;/^$/!p' input.output]], 0,