* src/muscle-tab.c (muscle_percent_define_insert): Register a fixit
for duplicate removal.
* tests/input.at: Adjust expectations.
---
src/muscle-tab.c | 2 ++
tests/input.at | 13 +++----------
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/muscle-tab.c b/src/muscle-tab.c
index 9170c752..618e4d5f 100644
--- a/src/muscle-tab.c
+++ b/src/muscle-tab.c
@@ -24,6 +24,7 @@
#include "complain.h"
#include "files.h"
+#include "fixits.h"
#include "getargs.h"
#include "muscle-tab.h"
#include "quote.h"
@@ -532,6 +533,7 @@ muscle_percent_define_insert (char const *var, location
variable_loc,
i += SUB_INDENT;
location loc = muscle_percent_define_get_loc (variable);
complain_indent (&loc, complaint, &i, _("previous definition"));
+ fixits_register (&variable_loc, "");
warned = true;
}
diff --git a/tests/input.at b/tests/input.at
index f6b68d5e..40ba92bd 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -2539,6 +2539,7 @@ input.y:26.1-12: warning: deprecated directive:
'%token_table', use '%token-tabl
fix-it:"input.y":{26:1-26:13}:"%token-table"
input.y:27.1-14: error: %define variable 'parse.error' redefined
input.y:11.1-14: previous definition
+fix-it:"input.y":{27:1-27:15}:""
input.y:29.1-18: warning: deprecated directive: '%name-prefix "bar"', use
'%define api.prefix {bar}' [-Wdeprecated]
fix-it:"input.y":{29:1-29:19}:"%define api.prefix {bar}"
]])
@@ -2585,23 +2586,15 @@ AT_CHECK([cat input.y], [],
%output "foo"
%pure-parser
%token-table
-%error-verbose
+
%glr-parser
%define api.prefix {bar}
%%
exp : '0'
]])
-# Unfortunately so far we don't remove duplicate definitions,
-# so there are still warnings.
AT_BISON_CHECK([[-fcaret input.y]], [[1]], [],
-[[input.y:26.1-14: error: %define variable 'parse.error' redefined
- %error-verbose
- ^~~~~~~~~~~~~~
-input.y:11.1-27: previous definition
- %define parse.error verbose
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~
-input.y:28.1-24: error: %define variable 'api.prefix' redefined
+[[input.y:28.1-24: error: %define variable 'api.prefix' redefined
%define api.prefix {bar}
^~~~~~~~~~~~~~~~~~~~~~~~
input.y:19.1-24: previous definition
--
2.20.1