[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RFC: diagnostics: display suggested update after the caret-info
From: |
Akim Demaille |
Subject: |
RFC: diagnostics: display suggested update after the caret-info |
Date: |
Sun, 17 Feb 2019 16:16:37 +0100 |
This commit changes the warning from:
> foo.yy:1.5-18: warning: deprecated directive, use '%define parse.error
> verbose' [-Wdeprecated]
> %error-verbose
> ^~~~~~~~~~~~~~
to:
> foo.yy:1.5-18: warning: deprecated directive [-Wdeprecated]
> %error-verbose
> ^~~~~~~~~~~~~~
> %define parse.error verbose
For the records, when caret-errors are disabled, we have (independently of this
proposed change):
> foo.yy:1.1-14: warning: deprecated directive: '%error-verbose', use '%define
> parse.error verbose' [-Wdeprecated]
I mentioned this here:
https://lists.gnu.org/archive/html/bison-patches/2019-02/msg00080.html
I would really like to know what people think about this change. TIA!
commit 18ce9615df724fad92bca37a3b843c347abf5222
Author: Akim Demaille <address@hidden>
Date: Sat Feb 16 08:01:34 2019 +0100
diagnostics: display suggested update after the caret-info
This commit changes the warning from:
foo.yy:1.5-18: warning: deprecated directive, use '%define parse.error
verbose' [-Wdeprecated]
%error-verbose
^~~~~~~~~~~~~~
to:
foo.yy:1.5-18: warning: deprecated directive [-Wdeprecated]
%error-verbose
^~~~~~~~~~~~~~
%define parse.error verbose
The latter consumes less width.
* src/complain.c (deprecated_directive): Implement this change.
* tests/input.at: Adjust expectations.
diff --git a/src/complain.c b/src/complain.c
index 50f65af5..ddd1541d 100644
--- a/src/complain.c
+++ b/src/complain.c
@@ -390,9 +390,11 @@ void
deprecated_directive (location const *loc, char const *old, char const *upd)
{
if (feature_flag & feature_caret)
- complain (loc, Wdeprecated,
- _("deprecated directive, use %s"),
- quote_n (1, upd));
+ {
+ complain (loc, Wdeprecated,
+ _("deprecated directive"));
+ fprintf (stderr, " %*s%s\n", loc->start.column - 1, "", upd);
+ }
else
complain (loc, Wdeprecated,
_("deprecated directive: %s, use %s"),
diff --git a/tests/input.at b/tests/input.at
index 7494e46a..1a6f0e56 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -1998,21 +1998,26 @@ AT_DATA([[input.y]],
start: %empty;
]])
AT_BISON_CHECK([[-fcaret input.y]], [1], [],
-[[input.y:1.1-26: warning: deprecated directive, use '%define api.push-pull
both' [-Wdeprecated]
+[[input.y:1.1-26: warning: deprecated directive [-Wdeprecated]
%define api.push_pull both
^~~~~~~~~~~~~~~~~~~~~~~~~~
-input.y:2.1-40: warning: deprecated directive, use '%define
lr.keep-unreachable-state maybe' [-Wdeprecated]
+ %define api.push-pull both
+input.y:2.1-40: warning: deprecated directive [-Wdeprecated]
%define lr.keep_unreachable_states maybe
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-input.y:3.1-23: warning: deprecated directive, use '%define api.namespace
{foo}' [-Wdeprecated]
+ %define lr.keep-unreachable-state maybe
+input.y:3.1-23: warning: deprecated directive [-Wdeprecated]
%define namespace "foo"
^~~~~~~~~~~~~~~~~~~~~~~
-input.y:4.1-15: warning: deprecated directive, use '%define api.value.type
variant' [-Wdeprecated]
+ %define api.namespace {foo}
+input.y:4.1-15: warning: deprecated directive [-Wdeprecated]
%define variant
^~~~~~~~~~~~~~~
-input.y:5.1-34: warning: deprecated directive, use '%define api.parser.class
{parser}' [-Wdeprecated]
+ %define api.value.type variant
+input.y:5.1-34: warning: deprecated directive [-Wdeprecated]
%define parser_class_name {parser}
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ %define api.parser.class {parser}
input.y:2.1-40: error: invalid value for %define Boolean variable
'lr.keep-unreachable-state'
%define lr.keep_unreachable_states maybe
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- RFC: diagnostics: display suggested update after the caret-info,
Akim Demaille <=