AT_BANNER([[Conflicts.]])
-
-## ------------------------ ##
-## Token declaration order. ##
-## ------------------------ ##
+## ------------------------- ##
+## Token declaration order. ##
+## ------------------------- ##
# This test checks that token are declared left to right when in a precedence
# statement.
}
]])
-AT_BISON_CHECK([-o input.c input.y], [], [],
-[[input.y:24.13: warning: useless precedence for R [-Wother]
-input.y:24.15: warning: useless precedence for S [-Wother]
-input.y:24.17: warning: useless precedence for T [-Wother]
-input.y:24.19: warning: useless precedence for U [-Wother]
-input.y:25.13: warning: useless precedence for V [-Wother]
-input.y:25.15: warning: useless precedence for W [-Wother]
-]])
+AT_BISON_CHECK([-o input.c input.y])
AT_COMPILE([input])
AT_PARSER_CHECK([./input])
AT_CLEANUP
+## ------------------------------- ##
+## Useless associativity warning. ##
+## ------------------------------- ##
+
+AT_SETUP([Useless associativity warning])
+
+AT_DATA([[input.y]],
+[[%nonassoc "="
+%left "+"
+%left "*"
+%precedence "("
+%%
+stmt:
+ exp
+| "var" "=" exp
+;
+
+exp:
+ exp "+" exp
+| exp "*" "num"
+| "(" exp ")"
+| "num"
+;
+]])
+
+AT_BISON_CHECK([-Wprecedence input.y], 0, [],
+[[input.y:1.11-13: warning: useless precedence and associativity for "=" [-Wprecedence]
+input.y:3.7-9: warning: useless associativity for "*", use %precedence [-Wprecedence]
+input.y:4.13-15: warning: useless precedence for "(" [-Wprecedence]
+]])
+
+AT_CLEANUP
+
+
## ---------------------------- ##
## Useless precedence warning. ##
## ---------------------------- ##
;
]])
-AT_BISON_CHECK([-fcaret -o input.c input.y], 0, [],
-[[input.y:2.13: warning: useless precedence for Z [-Wother]
+AT_BISON_CHECK([-Wprecedence -fcaret -o input.c input.y], 0, [],
+[[input.y:2.13: warning: useless precedence for Z [-Wprecedence]
%precedence Z
^
+input.y:5.7: warning: useless precedence and associativity for W [-Wprecedence]
+ %left W
+ ^
+input.y:6.8: warning: useless precedence and associativity for V [-Wprecedence]
+ %right V
+ ^
+input.y:7.11: warning: useless precedence and associativity for U [-Wprecedence]
+ %nonassoc U
+ ^
]])
AT_CLEANUP
;
]])
-AT_BISON_CHECK([-o input.c input.y], 0, [],
+AT_BISON_CHECK([-Wall -o input.c input.y], 0, [],
[[input.y: warning: 4 shift/reduce conflicts [-Wconflicts-sr]
+input.y:1.7-9: warning: useless precedence and associativity for '+' [-Wprecedence]
+input.y:2.7-9: warning: useless precedence and associativity for '*' [-Wprecedence]
]])
AT_CLEANUP