diagnostics: use appropriate location for useless precedence/associativity

* src/symtab.c (symbol_precedence_set): Use prec_location, not
location (which is the first occurrence of the symbol, possibly just
%token).
Also, as redefinitions are not allowed, keep the first values, not
the subsequent ones.
* tests/conflicts.at, tests/existing.at, tests/regression.at: Adjust.
This commit is contained in:
Akim Demaille
2013-04-22 11:26:28 +02:00
parent 8782fe26cb
commit d8ce703102
4 changed files with 138 additions and 134 deletions

View File

@@ -378,8 +378,8 @@ exp: %empty;
]])
AT_BISON_CHECK([-v -Wall -o input.c input.y], 0, [],
[[input.y:1.29-32: warning: useless precedence and associativity for "||" [-Wprecedence]
input.y:2.29-32: warning: useless precedence and associativity for "<=" [-Wprecedence]
[[input.y:3.1-5: warning: useless precedence and associativity for "||" [-Wprecedence]
input.y:3.1-5: warning: useless precedence and associativity for "<=" [-Wprecedence]
]])
AT_CLEANUP
@@ -1145,15 +1145,15 @@ sr_conflict:
]AT_YYLEX_DEFINE([{ 1, 2, 3, 0 }])[
]AT_MAIN_DEFINE[
]])
AT_BISON_OPTION_POPDEFS
AT_BISON_CHECK([[-Wall -o input.c input.y]], [[0]],,
[[input.y:24.5-19: warning: rule useless in parser due to conflicts [-Wother]
input.y:28.5-19: warning: rule useless in parser due to conflicts [-Wother]
input.y:18.7-9: warning: useless precedence and associativity for TK1 [-Wprecedence]
input.y:18.1-5: warning: useless precedence and associativity for TK1 [-Wprecedence]
]])
AT_COMPILE([[input]])
AT_PARSER_CHECK([[./input]])
AT_BISON_OPTION_POPDEFS
AT_CLEANUP