[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
diagnostics: properly indent the "previous declaration" message
From: |
Akim Demaille |
Subject: |
diagnostics: properly indent the "previous declaration" message |
Date: |
Wed, 16 Jan 2019 08:44:16 +0100 |
commit b44393299120b9c8f7cb490e778a869dcbd7b7f9
Author: Akim Demaille <address@hidden>
Date: Wed Jan 16 08:29:03 2019 +0100
diagnostics: properly indent the "previous declaration" message
* src/complain.c (duplicate_directive, duplicate_rule_directive):
Here.
diff --git a/src/complain.c b/src/complain.c
index 6b6b2c0b..813a442d 100644
--- a/src/complain.c
+++ b/src/complain.c
@@ -403,11 +403,12 @@ void
duplicate_directive (char const *directive,
location first, location second)
{
+ unsigned i = 0;
if (feature_flag & feature_caret)
- complain (&second, Wother, _("duplicate directive"));
+ complain_indent (&second, Wother, &i, _("duplicate directive"));
else
- complain (&second, Wother, _("duplicate directive: %s"), directive);
- unsigned i = SUB_INDENT;
+ complain_indent (&second, Wother, &i, _("duplicate directive: %s"),
directive);
+ i += SUB_INDENT;
complain_indent (&first, complaint, &i, _("previous declaration"));
fixits_register (&second, "");
}
@@ -416,7 +417,8 @@ void
duplicate_rule_directive (char const *directive,
location first, location second)
{
- complain (&second, complaint, _("only one %s allowed per rule"), directive);
- unsigned i = SUB_INDENT;
+ unsigned i = 0;
+ complain_indent (&second, complaint, &i, _("only one %s allowed per rule"),
directive);
+ i += SUB_INDENT;
complain_indent (&first, complaint, &i, _("previous declaration"));
}
diff --git a/tests/actions.at b/tests/actions.at
index 787435e3..e5654a47 100644
--- a/tests/actions.at
+++ b/tests/actions.at
@@ -171,7 +171,7 @@ AT_BISON_CHECK([-fcaret one.y], [1], [],
[[one.y:11.13-18: error: only one %empty allowed per rule
%empty {} %empty
^~~~~~
-one.y:11.3-8: previous declaration
+one.y:11.3-8: previous declaration
%empty {} %empty
^~~~~~
]])
diff --git a/tests/input.at b/tests/input.at
index 3314d680..39294bf6 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -2527,10 +2527,10 @@ fix-it:"input.y":{14:1-15:3}:"%file-prefix"
input.y:17.1-19: warning: deprecated directive: '%fixed-output_files', use
'%fixed-output-files' [-Wdeprecated]
fix-it:"input.y":{17:1-17:20}:"%fixed-output-files"
input.y:18.1-19: warning: duplicate directive: %fixed_output-files [-Wother]
-input.y:17.1-19: previous declaration
+input.y:17.1-19: previous declaration
fix-it:"input.y":{18:1-18:20}:""
input.y:19.1-19: warning: duplicate directive: %fixed-output-files [-Wother]
-input.y:17.1-19: previous declaration
+input.y:17.1-19: previous declaration
fix-it:"input.y":{19:1-19:20}:""
input.y:20.1-19: warning: deprecated directive: '%name-prefix= "foo"', use
'%define api.prefix {foo}' [-Wdeprecated]
fix-it:"input.y":{20:1-20:20}:"%define api.prefix {foo}"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- diagnostics: properly indent the "previous declaration" message,
Akim Demaille <=