[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/6] errors: indent "%define var" redefinition context
From: |
Theophile Ranquet |
Subject: |
[PATCH 3/6] errors: indent "%define var" redefinition context |
Date: |
Wed, 26 Sep 2012 15:45:13 +0200 |
From: Theophile Ranquet <address@hidden>
This is the continuation of the work on the readability of errors
context.
For example, what used to be:
input.y:2.9-11: %define variable 'var' redefined
input.y:1.9-11: previous definition
is now:
input.y:2.9-11: %define variable 'var' redefined
input.y:1.9-11: previous definition
* src/muscle-tab.c (muscle_percent_define_insert): Use
complain_at_indent to output with increased indentation level.
* tests/input.at: Apply this change.
Signed-off-by: Akim Demaille <address@hidden>
---
src/muscle-tab.c | 10 ++++++----
tests/input.at | 6 +++---
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/muscle-tab.c b/src/muscle-tab.c
index bd1fd17..d187f82 100644
--- a/src/muscle-tab.c
+++ b/src/muscle-tab.c
@@ -426,6 +426,7 @@ muscle_percent_define_insert (char const *variable,
location variable_loc,
if (how == MUSCLE_PERCENT_DEFINE_GRAMMAR_FILE
&& muscle_find_const (name))
{
+ unsigned i = 0;
muscle_percent_define_how how_old =
atoi (muscle_find_const (how_name));
if (how_old == MUSCLE_PERCENT_DEFINE_F)
@@ -433,10 +434,11 @@ muscle_percent_define_insert (char const *variable,
location variable_loc,
free (variable_tr);
return;
}
- complain_at (variable_loc, _("%%define variable %s redefined"),
- quote (variable));
- complain_at (muscle_percent_define_get_loc (variable),
- _("previous definition"));
+ complain_at_indent (variable_loc, &i,
+ _("%%define variable %s redefined"), quote
(variable));
+ i += SUB_INDENT;
+ complain_at_indent (muscle_percent_define_get_loc (variable), &i,
+ _("previous definition"));
}
MUSCLE_INSERT_STRING (name, value);
diff --git a/tests/input.at b/tests/input.at
index fc92abe..2facf9e 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -928,9 +928,9 @@ start: ;
AT_BISON_CHECK([[input-redefined.y]], [[1]], [],
[[input-redefined.y:2.9-11: %define variable 'var' redefined
-input-redefined.y:1.9-11: previous definition
+input-redefined.y:1.9-11: previous definition
input-redefined.y:3.10-12: %define variable 'var' redefined
-input-redefined.y:2.9-11: previous definition
+input-redefined.y:2.9-11: previous definition
]])
AT_DATA([input-unused.y],
@@ -985,7 +985,7 @@ start: ;
]])
AT_BISON_CHECK([[-Dvar=cmd-d input-dg.y]], [[1]], [],
[[input-dg.y:1.9-11: %define variable 'var' redefined
-<command line>:2: previous definition
+<command line>:2: previous definition
]])
AT_DATA([[input-unused.y]],
--
1.7.10
- [PATCH 0/6] {maint} errors: output prefixing, Theophile Ranquet, 2012/09/26
- [PATCH 6/6] warnings: introduce -Wdeprecated in the usage info, Theophile Ranquet, 2012/09/26
- [PATCH 1/6] errors: indent "result type clash" error context, Theophile Ranquet, 2012/09/26
- [PATCH 3/6] errors: indent "%define var" redefinition context,
Theophile Ranquet <=
- [PATCH 4/6] errors: indent "invalid value for %define" context, Theophile Ranquet, 2012/09/26
- [PATCH 5/6] errors: prefix the output with "error: ", Theophile Ranquet, 2012/09/26
- [PATCH 2/6] errors: indent "symbol redeclaration" context, Theophile Ranquet, 2012/09/26
- Re: [PATCH 0/6] {maint} errors: output prefixing, Akim Demaille, 2012/09/26
- [PATCH 0/6] {maint} errors: output prefixing, Theophile Ranquet, 2012/09/27
- [PATCH 6/6] warnings: introduce Wdeprecated in the usage info, Theophile Ranquet, 2012/09/27
- [PATCH 4/6] errors: indent "invalid value for %define" context, Theophile Ranquet, 2012/09/27
- [PATCH 2/6] errors: indent "symbol redeclaration" context, Theophile Ranquet, 2012/09/27
- [PATCH 3/6] errors: indent "%define var" redefinition context, Theophile Ranquet, 2012/09/27
- [PATCH 1/6] errors: indent "result type clash" error context, Theophile Ranquet, 2012/09/27