warnings: introduce -Wprecedence
authorValentin Tolmer <nitnelave1@gmail.com>
Wed, 30 Jan 2013 10:30:15 +0000 (11:30 +0100)
committerAkim Demaille <akim@lrde.epita.fr>
Wed, 30 Jan 2013 20:39:08 +0000 (21:39 +0100)
The new warning category "precedence" flags useless precedence and
associativity.  -Wprecedence can now be used, it is disabled by default.
The warnings about precedence and associativity are grouped into one, and
the testsuite was corrected accordingly.

* src/complain.h (warnings): Introduce "precedence".
* src/complain.c (warnings_print_categories): Adjust.
* src/getargs.c (warnings_args, warning_types): Likewise.
* src/symtab.h, src/symtab.c (print_associativity_warnings): Remove.
* src/symtab.h (register_assoc): Correct arguments.
* src/symtab.c (print_precedence_warnings): Print both warnings together.
* doc/bison.texi (Bison options): Document the warnings and provide an
example.
* tests/conflicts.at, tests/existing.at, tests/local.at,
* tests/regression.at: Adapt the testsuite for the new category
(-Wprecedence instead of -Wother where appropriate).

12 files changed:
NEWS
doc/bison.texi
src/complain.c
src/complain.h
src/getargs.c
src/main.c
src/symtab.c
src/symtab.h
tests/conflicts.at
tests/existing.at
tests/local.at
tests/regression.at

diff --git a/NEWS b/NEWS
index 62f834b..be3669a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -198,13 +198,6 @@ GNU Bison NEWS
     bar.y: error: shift/reduce conflicts: 1 found, 0 expected
     bar.y: error: reduce/reduce conflicts: 2 found, 0 expected
 
-*** Useless precedence
-
-  Bison now warns about symbols with a declared precedence but no declared
-  associativity (i.e. declared with %precedence), and whose precedence is
-  never used.  In that case, the symbol can be safely declared with %token
-  instead, without modifying the parsing tables.
-
 ** Additional yylex/yyparse arguments
 
   The new directive %param declares additional arguments to both yylex and
@@ -303,6 +296,76 @@ GNU Bison NEWS
   when declaring associativity at the same time, with %left (or %right,
   %precedence, %nonassoc), B was inferior to A.
 
+** Useless precedence and associativity
+
+  When developping and maintaining a grammar, useless associativity and
+  precedence directives are common.  They can be a nuisance: new ambiguities
+  arising are sometimes masked because their conflicts are resolved due to
+  the extra precedence or associativity information.  Furthermore, it can
+  hinder the comprehension of a new grammar: one will wonder about the role
+  of a precedence, where in fact it is useless.  The following changes aim
+  at detecting and reporting these extra directives.
+
+*** Precedence warning category
+
+  A new category of warning, -Wprecedence, was introduced. It flags the
+  useless precedence and associativity directives.
+
+*** Useless associativity
+
+  Bison now warns about symbols with a declared associativity that is never
+  used to resolve conflicts.  In that case, using %precedence is sufficient;
+  the parsing tables will remain unchanged.  Solving these warnings may raise
+  useless precedence warnings, as the symbols no longer have associativity.
+  For example:
+
+    %left '+'
+    %left '*'
+    %%
+    exp:
+      "num"
+    | exp '+' "num"
+    | exp '*' exp
+    ;
+
+  will produce a
+
+    warning: useless associativity for '+', use %precedence [-Wprecedence]
+     %left '+'
+           ^^^
+
+*** Useless precedence
+
+  Bison now warns about symbols with a declared precedence and no declared
+  associativity (i.e., declared with %precedence), and whose precedence is
+  never used.  In that case, the symbol can be safely declared with %token
+  instead, without modifying the parsing tables.  For example:
+
+    %precedence '='
+    %%
+    exp: "var" '=' "num";
+
+  will produce a
+
+    warning: useless precedence for '=' [-Wprecedence]
+     %precedence '='
+                 ^^^
+
+*** Useless precedence and associativity
+
+  In case of both useless precedence and associativity, the issue is flagged
+  as follows:
+
+    %nonassoc '='
+    %%
+    exp: "var" '=' "num";
+
+  The warning is:
+
+    warning: useless precedence and associativity for '=' [-Wprecedence]
+     %nonassoc '='
+               ^^^
+
 * Noteworthy changes in release 2.7 (2012-12-12) [stable]
 
 ** Bug fixes
index d2d3da3..7a36f85 100644 (file)
@@ -9716,6 +9716,67 @@ no effect on the conflict report.
 Deprecated constructs whose support will be removed in future versions of
 Bison.
 
+@item precedence
+Useless precedence and associativity directives.  Disabled by default.
+
+Consider for instance the following grammar:
+
+@example
+@group
+%nonassoc "="
+%left "+"
+%left "*"
+%precedence "("
+@end group
+%%
+@group
+stmt:
+  exp
+| "var" "=" exp
+;
+@end group
+
+@group
+exp:
+  exp "+" exp
+| exp "*" "num"
+| "(" exp ")"
+| "num"
+;
+@end group
+@end example
+
+Bison reports:
+
+@c cannot leave the location and the [-Wprecedence] for lack of
+@c width in PDF.
+@example
+@group
+warning: useless precedence and associativity for "="
+ %nonassoc "="
+           ^^^
+@end group
+@group
+warning: useless associativity for "*", use %precedence
+ %left "*"
+       ^^^
+@end group
+@group
+warning: useless precedence for "("
+ %precedence "("
+             ^^^
+@end group
+@end example
+
+One would get the exact same parser with the following directives instead:
+
+@example
+@group
+%left "+"
+%precedence "*"
+@end group
+@end example
+
 @item other
 All warnings not categorized above.  These warnings are enabled by default.
 
index d43e623..c6e03d5 100644 (file)
@@ -50,6 +50,7 @@ warnings_print_categories (warnings warn_flags)
           "conflicts-sr",
           "conflicts-rr",
           "deprecated",
+          "precedence",
           "other"
         };
 
index 9404388..0110c6b 100644 (file)
@@ -36,7 +36,9 @@ typedef enum
     Wconflicts_sr     = 1 << 2,  /**< S/R conflicts.  */
     Wconflicts_rr     = 1 << 3,  /**< R/R conflicts.  */
     Wdeprecated       = 1 << 4,  /**< Obsolete constructs.  */
-    Wother            = 1 << 5,  /**< All other warnings.  */
+    Wprecedence       = 1 << 5,  /**< Useless precedence and associativity.  */
+
+    Wother            = 1 << 6,  /**< All other warnings.  */
 
     Werror            = 1 << 10, /** This bit is no longer used. */
 
index f6d61c3..97191ef 100644 (file)
@@ -252,6 +252,7 @@ static const char * const warnings_args[] =
   "conflicts-sr    - S/R conflicts",
   "conflicts-rr    - R/R conflicts",
   "deprecated      - obsolete constructs",
+  "precedence      - useless precedence and associativity",
   "other           - all other warnings",
   "all             - all of the above",
   "error           - warnings are errors",
@@ -266,6 +267,7 @@ static const int warnings_types[] =
   Wconflicts_sr,
   Wconflicts_rr,
   Wdeprecated,
+  Wprecedence,
   Wother,
   Wall,
   Werror
@@ -381,6 +383,7 @@ Warning categories include:\n\
   `conflicts-sr'      S/R conflicts (enabled by default)\n\
   `conflicts-rr'      R/R conflicts (enabled by default)\n\
   `deprecated'        obsolete constructs\n\
+  `precedence'        useless precedence and associativity\n\
   `other'             all other warnings (enabled by default)\n\
   `all'               all the warnings\n\
   `no-CATEGORY'       turn off warnings in CATEGORY\n\
index eb7dffa..22703d1 100644 (file)
@@ -146,8 +146,6 @@ main (int argc, char *argv[])
 
   print_precedence_warnings ();
 
-  print_assoc_warnings ();
-
   /* Output file names. */
   compute_output_file_names ();
 
index e48c11e..d3ad2fb 100644 (file)
@@ -1057,29 +1057,6 @@ register_precedence (graphid first, graphid snd)
 }
 
 
-/*--------------------------------------------------.
-| Print a warning for unused precedence relations.  |
-`--------------------------------------------------*/
-
-void
-print_precedence_warnings (void)
-{
-  int i;
-  if (!prec_nodes)
-    init_prec_nodes ();
-  for (i = 0; i < nsyms; ++i)
-    {
-      symbol *s = symbols[i];
-      if (s
-          && s->prec != 0
-          && !prec_nodes[i]->pred
-          && !prec_nodes[i]->succ
-          && s->assoc == precedence_assoc)
-        complain (&s->location, Wother,
-                  _("useless precedence for %s"), s->tag);
-    }
-}
-
 /*---------------------------------------.
 | Initialize association tracking table. |
 `---------------------------------------*/
@@ -1119,21 +1096,35 @@ register_assoc (graphid i, graphid j)
   used_assoc[j] = true;
 }
 
-/*------------------------------------------------------.
-| Print a warning for each unused symbol associativity. |
-`------------------------------------------------------*/
+/*--------------------------------------------------.
+| Print a warning for unused precedence relations.  |
+`--------------------------------------------------*/
 
 void
-print_assoc_warnings (void)
+print_precedence_warnings (void)
 {
-  graphid i;
+  int i;
+  if (!prec_nodes)
+    init_prec_nodes ();
   if (!used_assoc)
     init_assoc ();
   for (i = 0; i < nsyms; ++i)
     {
       symbol *s = symbols[i];
-      if (is_assoc_useless (s))
-        complain (&s->location, Wother,
-                  _("useless associativity for %s"), s->tag);
+      if (s
+          && s->prec != 0
+          && !prec_nodes[i]->pred
+          && !prec_nodes[i]->succ)
+        {
+          if (is_assoc_useless (s))
+            complain (&s->location, Wprecedence,
+                      _("useless precedence and associativity for %s"), s->tag);
+          else if (s->assoc == precedence_assoc)
+            complain (&s->location, Wprecedence,
+                      _("useless precedence for %s"), s->tag);
+        }
+      else if (is_assoc_useless (s))
+        complain (&s->location, Wprecedence,
+                  _("useless associativity for %s, use %%precedence"), s->tag);
     }
 }
index 33374fb..f585fd7 100644 (file)
@@ -266,7 +266,8 @@ struct symgraph
 
 void register_precedence (graphid first, graphid snd);
 
-/** Print a warning for each symbol whose precedence is useless. */
+/** Print a warning for each symbol whose precedence and/or associativity
+ * is useless. */
 
 void print_precedence_warnings (void);
 
@@ -274,9 +275,7 @@ void print_precedence_warnings (void);
 | Symbol associativity  |
 `----------------------*/
 
-void register_assoc (int i, int j);
-
-void print_assoc_warnings (void);
+void register_assoc (graphid i, graphid j);
 
 /*-----------------.
 | Semantic types.  |
index 92e4ae8..b7ba84b 100644 (file)
 
 AT_BANNER([[Conflicts.]])
 
-## ------------------------------ ##
-## Useless associativity warning. ##
-## ------------------------------ ##
+## ------------------------------- ##
+## Useless associativity warning.  ##
+## ------------------------------- ##
 
 AT_SETUP([Useless associativity warning])
 
 AT_DATA([[input.y]],
-[[%token T
-%left A B
-%right C
-%nonassoc D
-%precedence E
-
+[[%nonassoc "="
+%left "+"
+%left "*"
+%precedence "("
 %%
-e: T A T
- | T B T
- | T C T
- | T D T
- | T E T
+stmt:
+  exp
+| "var" "=" exp
+;
+
+exp:
+  exp "+" exp
+| exp "*" "num"
+| "(" exp ")"
+| "num"
 ;
 ]])
 
-AT_BISON_CHECK([input.y], 0, [],
-[[input.y:5.13: warning: useless precedence for E [-Wother]
-input.y:2.7: warning: useless associativity for A [-Wother]
-input.y:2.9: warning: useless associativity for B [-Wother]
-input.y:3.8: warning: useless associativity for C [-Wother]
-input.y:4.11: warning: useless associativity for D [-Wother]
+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
 
 
-## ------------------------ ##
-## Token declaration order. ##
-## ------------------------ ##
+## ------------------------- ##
+## Token declaration order.  ##
+## ------------------------- ##
 
 # This test checks that token are declared left to right when in a precedence
 # statement.
@@ -110,27 +111,7 @@ int main (void)
 }
 ]])
 
-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]
-input.y:18.8: warning: useless associativity for E [-Wother]
-input.y:18.10: warning: useless associativity for F [-Wother]
-input.y:18.12: warning: useless associativity for G [-Wother]
-input.y:19.8: warning: useless associativity for H [-Wother]
-input.y:19.10: warning: useless associativity for I [-Wother]
-input.y:20.8: warning: useless associativity for J [-Wother]
-input.y:21.8: warning: useless associativity for K [-Wother]
-input.y:22.8: warning: useless associativity for L [-Wother]
-input.y:22.10: warning: useless associativity for M [-Wother]
-input.y:22.12: warning: useless associativity for N [-Wother]
-input.y:23.11: warning: useless associativity for O [-Wother]
-input.y:23.13: warning: useless associativity for P [-Wother]
-input.y:23.15: warning: useless associativity for Q [-Wother]
-]])
+AT_BISON_CHECK([-o input.c input.y])
 AT_COMPILE([input])
 
 AT_PARSER_CHECK([./input])
@@ -174,17 +155,17 @@ f: B
 ;
 ]])
 
-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 associativity for W [-Wother]
+input.y:5.7: warning: useless precedence and associativity for W [-Wprecedence]
  %left W
        ^
-input.y:6.8: warning: useless associativity for V [-Wother]
+input.y:6.8: warning: useless precedence and associativity for V [-Wprecedence]
  %right V
         ^
-input.y:7.11: warning: useless associativity for U [-Wother]
+input.y:7.11: warning: useless precedence and associativity for U [-Wprecedence]
  %nonassoc U
            ^
 ]])
@@ -1196,10 +1177,10 @@ e:   e '+' e
    ;
 ]])
 
-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 associativity for '+' [-Wother]
-input.y:2.7-9: warning: useless associativity for '*' [-Wother]
+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
 
index 6118e7d..215993c 100644 (file)
@@ -428,43 +428,43 @@ dnl don't like even `print $!4;'.
 dnl BISON-STDERR
 [AT_COND_CASE([[canonical LR]],
 [[input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr]
-input.y:19.8-16: warning: useless associativity for FUNC_CALL [-Wother]
-input.y:21.8-14: warning: useless associativity for YNUMBER [-Wother]
-input.y:21.16-22: warning: useless associativity for YSTRING [-Wother]
-input.y:22.14-22: warning: useless associativity for APPEND_OP [-Wother]
-input.y:23.8-15: warning: useless associativity for ASSIGNOP [-Wother]
-input.y:23.33-41: warning: useless associativity for CONCAT_OP [-Wother]
-input.y:27.8-18: warning: useless associativity for LEX_GETLINE [-Wother]
-input.y:28.8-13: warning: useless associativity for LEX_IN [-Wother]
-input.y:29.23-31: warning: useless associativity for INCREMENT [-Wother]
-input.y:29.33-41: warning: useless associativity for DECREMENT [-Wother]
-input.y:30.8-18: warning: useless associativity for LEX_BUILTIN [-Wother]
-input.y:30.20-29: warning: useless associativity for LEX_LENGTH [-Wother]
-input.y:40.11-13: warning: useless associativity for ',' [-Wother]
-input.y:47.8-10: warning: useless associativity for '!' [-Wother]
-input.y:47.12-16: warning: useless associativity for UNARY [-Wother]
-input.y:50.7-9: warning: useless associativity for '$' [-Wother]
-input.y:51.7-9: warning: useless associativity for '(' [-Wother]
-input.y:51.11-13: warning: useless associativity for ')' [-Wother]]],
+input.y:19.8-16: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
+input.y:21.8-14: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
+input.y:21.16-22: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
+input.y:22.14-22: warning: useless precedence and associativity for APPEND_OP [-Wprecedence]
+input.y:23.8-15: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence]
+input.y:23.33-41: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence]
+input.y:27.8-18: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence]
+input.y:28.8-13: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence]
+input.y:29.23-31: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence]
+input.y:29.33-41: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence]
+input.y:30.8-18: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence]
+input.y:30.20-29: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence]
+input.y:40.11-13: warning: useless precedence and associativity for ',' [-Wprecedence]
+input.y:47.8-10: warning: useless associativity for '!', use %precedence [-Wprecedence]
+input.y:47.12-16: warning: useless associativity for UNARY, use %precedence [-Wprecedence]
+input.y:50.7-9: warning: useless associativity for '$', use %precedence [-Wprecedence]
+input.y:51.7-9: warning: useless associativity for '(', use %precedence [-Wprecedence]
+input.y:51.11-13: warning: useless precedence and associativity for ')' [-Wprecedence]]],
 [[input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr]
-input.y:19.8-16: warning: useless associativity for FUNC_CALL [-Wother]
-input.y:21.8-14: warning: useless associativity for YNUMBER [-Wother]
-input.y:21.16-22: warning: useless associativity for YSTRING [-Wother]
-input.y:22.14-22: warning: useless associativity for APPEND_OP [-Wother]
-input.y:23.8-15: warning: useless associativity for ASSIGNOP [-Wother]
-input.y:23.33-41: warning: useless associativity for CONCAT_OP [-Wother]
-input.y:27.8-18: warning: useless associativity for LEX_GETLINE [-Wother]
-input.y:28.8-13: warning: useless associativity for LEX_IN [-Wother]
-input.y:29.23-31: warning: useless associativity for INCREMENT [-Wother]
-input.y:29.33-41: warning: useless associativity for DECREMENT [-Wother]
-input.y:30.8-18: warning: useless associativity for LEX_BUILTIN [-Wother]
-input.y:30.20-29: warning: useless associativity for LEX_LENGTH [-Wother]
-input.y:40.11-13: warning: useless associativity for ',' [-Wother]
-input.y:47.8-10: warning: useless associativity for '!' [-Wother]
-input.y:47.12-16: warning: useless associativity for UNARY [-Wother]
-input.y:50.7-9: warning: useless associativity for '$' [-Wother]
-input.y:51.7-9: warning: useless associativity for '(' [-Wother]
-input.y:51.11-13: warning: useless associativity for ')' [-Wother]]])[
+input.y:19.8-16: warning: useless associativity for FUNC_CALL, use %precedence [-Wprecedence]
+input.y:21.8-14: warning: useless associativity for YNUMBER, use %precedence [-Wprecedence]
+input.y:21.16-22: warning: useless associativity for YSTRING, use %precedence [-Wprecedence]
+input.y:22.14-22: warning: useless precedence and associativity for APPEND_OP [-Wprecedence]
+input.y:23.8-15: warning: useless associativity for ASSIGNOP, use %precedence [-Wprecedence]
+input.y:23.33-41: warning: useless associativity for CONCAT_OP, use %precedence [-Wprecedence]
+input.y:27.8-18: warning: useless precedence and associativity for LEX_GETLINE [-Wprecedence]
+input.y:28.8-13: warning: useless associativity for LEX_IN, use %precedence [-Wprecedence]
+input.y:29.23-31: warning: useless associativity for INCREMENT, use %precedence [-Wprecedence]
+input.y:29.33-41: warning: useless associativity for DECREMENT, use %precedence [-Wprecedence]
+input.y:30.8-18: warning: useless associativity for LEX_BUILTIN, use %precedence [-Wprecedence]
+input.y:30.20-29: warning: useless associativity for LEX_LENGTH, use %precedence [-Wprecedence]
+input.y:40.11-13: warning: useless precedence and associativity for ',' [-Wprecedence]
+input.y:47.8-10: warning: useless associativity for '!', use %precedence [-Wprecedence]
+input.y:47.12-16: warning: useless associativity for UNARY, use %precedence [-Wprecedence]
+input.y:50.7-9: warning: useless associativity for '$', use %precedence [-Wprecedence]
+input.y:51.7-9: warning: useless associativity for '(', use %precedence [-Wprecedence]
+input.y:51.11-13: warning: useless precedence and associativity for ')' [-Wprecedence]]])[
 ]],
 
 dnl LAST-STATE
@@ -1406,20 +1406,20 @@ dnl BISON-STDERR
 [AT_COND_CASE([[canonical LR]],
 [[input.y: warning: 1876 shift/reduce conflicts [-Wconflicts-sr]
 input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr]
-input.y:32.9-12: warning: useless associativity for HQUA [-Wother]
-input.y:53.8-14: warning: useless associativity for HASSIGN [-Wother]
-input.y:54.9-15: warning: useless associativity for HORELSE [-Wother]
-input.y:55.9-16: warning: useless associativity for HANDTHEN [-Wother]
-input.y:61.9-12: warning: useless associativity for HNOT [-Wother]
-input.y:68.7-11: warning: useless associativity for UNEAR [-Wother]]],
+input.y:32.9-12: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
+input.y:53.8-14: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
+input.y:54.9-15: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]
+input.y:55.9-16: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence]
+input.y:61.9-12: warning: useless associativity for HNOT, use %precedence [-Wprecedence]
+input.y:68.7-11: warning: useless associativity for UNEAR, use %precedence [-Wprecedence]]],
 [[input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr]
 input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr]
-input.y:32.9-12: warning: useless associativity for HQUA [-Wother]
-input.y:53.8-14: warning: useless associativity for HASSIGN [-Wother]
-input.y:54.9-15: warning: useless associativity for HORELSE [-Wother]
-input.y:55.9-16: warning: useless associativity for HANDTHEN [-Wother]
-input.y:61.9-12: warning: useless associativity for HNOT [-Wother]
-input.y:68.7-11: warning: useless associativity for UNEAR [-Wother]]])[
+input.y:32.9-12: warning: useless associativity for HQUA, use %precedence [-Wprecedence]
+input.y:53.8-14: warning: useless associativity for HASSIGN, use %precedence [-Wprecedence]
+input.y:54.9-15: warning: useless associativity for HORELSE, use %precedence [-Wprecedence]
+input.y:55.9-16: warning: useless associativity for HANDTHEN, use %precedence [-Wprecedence]
+input.y:61.9-12: warning: useless associativity for HNOT, use %precedence [-Wprecedence]
+input.y:68.7-11: warning: useless associativity for UNEAR, use %precedence [-Wprecedence]]])[
 ]],
 
 dnl LAST-STATE
@@ -2002,87 +2002,87 @@ dnl without being followed by "of".)
 
 dnl BISON-STDERR
 [[input.y:471.11-48: warning: rule useless in parser due to conflicts: path: ORDINAL LAST object_type relative_path [-Wother]
-input.y:19.8-12: warning: useless associativity for LABEL [-Wother]
-input.y:20.8-15: warning: useless associativity for VARIABLE [-Wother]
-input.y:21.8-13: warning: useless associativity for NUMBER [-Wother]
-input.y:22.8-11: warning: useless associativity for TEXT [-Wother]
-input.y:25.8-14: warning: useless associativity for ORDINAL [-Wother]
-input.y:30.8-11: warning: useless associativity for LAST [-Wother]
-input.y:31.8-9: warning: useless associativity for UP [-Wother]
-input.y:32.8-11: warning: useless associativity for DOWN [-Wother]
-input.y:35.8-10: warning: useless associativity for BOX [-Wother]
-input.y:36.8-13: warning: useless associativity for CIRCLE [-Wother]
-input.y:37.8-14: warning: useless associativity for ELLIPSE [-Wother]
-input.y:38.8-10: warning: useless associativity for ARC [-Wother]
-input.y:39.8-11: warning: useless associativity for LINE [-Wother]
-input.y:40.8-12: warning: useless associativity for ARROW [-Wother]
-input.y:42.8-13: warning: useless associativity for SPLINE [-Wother]
-input.y:43.8-13: warning: useless associativity for HEIGHT [-Wother]
-input.y:44.8-13: warning: useless associativity for RADIUS [-Wother]
-input.y:45.8-12: warning: useless associativity for WIDTH [-Wother]
-input.y:46.8-15: warning: useless associativity for DIAMETER [-Wother]
-input.y:47.8-11: warning: useless associativity for FROM [-Wother]
-input.y:48.8-9: warning: useless associativity for TO [-Wother]
-input.y:49.8-9: warning: useless associativity for AT [-Wother]
-input.y:53.8-12: warning: useless associativity for SOLID [-Wother]
-input.y:54.8-13: warning: useless associativity for DOTTED [-Wother]
-input.y:55.8-13: warning: useless associativity for DASHED [-Wother]
-input.y:56.8-11: warning: useless associativity for CHOP [-Wother]
-input.y:59.8-12: warning: useless associativity for LJUST [-Wother]
-input.y:60.8-12: warning: useless associativity for RJUST [-Wother]
-input.y:61.8-12: warning: useless associativity for ABOVE [-Wother]
-input.y:62.8-12: warning: useless associativity for BELOW [-Wother]
-input.y:63.8-9: warning: useless associativity for OF [-Wother]
-input.y:66.8-14: warning: useless associativity for BETWEEN [-Wother]
-input.y:67.8-10: warning: useless associativity for AND [-Wother]
-input.y:68.8-11: warning: useless associativity for HERE [-Wother]
-input.y:69.8-12: warning: useless associativity for DOT_N [-Wother]
-input.y:70.8-12: warning: useless associativity for DOT_E [-Wother]
-input.y:71.8-12: warning: useless associativity for DOT_W [-Wother]
-input.y:72.8-12: warning: useless associativity for DOT_S [-Wother]
-input.y:73.8-13: warning: useless associativity for DOT_NE [-Wother]
-input.y:74.8-13: warning: useless associativity for DOT_SE [-Wother]
-input.y:75.8-13: warning: useless associativity for DOT_NW [-Wother]
-input.y:76.8-13: warning: useless associativity for DOT_SW [-Wother]
-input.y:77.8-12: warning: useless associativity for DOT_C [-Wother]
-input.y:78.8-16: warning: useless associativity for DOT_START [-Wother]
-input.y:79.8-14: warning: useless associativity for DOT_END [-Wother]
-input.y:85.8-10: warning: useless associativity for SIN [-Wother]
-input.y:86.8-10: warning: useless associativity for COS [-Wother]
-input.y:87.8-12: warning: useless associativity for ATAN2 [-Wother]
-input.y:88.8-10: warning: useless associativity for LOG [-Wother]
-input.y:89.8-10: warning: useless associativity for EXP [-Wother]
-input.y:90.8-11: warning: useless associativity for SQRT [-Wother]
-input.y:91.8-12: warning: useless associativity for K_MAX [-Wother]
-input.y:92.8-12: warning: useless associativity for K_MIN [-Wother]
-input.y:93.8-10: warning: useless associativity for INT [-Wother]
-input.y:94.8-11: warning: useless associativity for RAND [-Wother]
-input.y:95.8-12: warning: useless associativity for SRAND [-Wother]
-input.y:98.8-10: warning: useless associativity for TOP [-Wother]
-input.y:99.8-13: warning: useless associativity for BOTTOM [-Wother]
-input.y:100.8-12: warning: useless associativity for UPPER [-Wother]
-input.y:101.8-12: warning: useless associativity for LOWER [-Wother]
-input.y:116.8-18: warning: useless associativity for LEFT_CORNER [-Wother]
-input.y:117.8-19: warning: useless associativity for RIGHT_CORNER [-Wother]
-input.y:118.8-12: warning: useless associativity for NORTH [-Wother]
-input.y:119.8-12: warning: useless associativity for SOUTH [-Wother]
-input.y:120.8-11: warning: useless associativity for EAST [-Wother]
-input.y:121.8-11: warning: useless associativity for WEST [-Wother]
-input.y:122.8-13: warning: useless associativity for CENTER [-Wother]
-input.y:123.8-10: warning: useless associativity for END [-Wother]
-input.y:124.8-12: warning: useless associativity for START [-Wother]
-input.y:127.8-11: warning: useless associativity for PLOT [-Wother]
-input.y:128.8-16: warning: useless associativity for THICKNESS [-Wother]
-input.y:129.8-11: warning: useless associativity for FILL [-Wother]
-input.y:130.8-14: warning: useless associativity for COLORED [-Wother]
-input.y:131.8-15: warning: useless associativity for OUTLINED [-Wother]
-input.y:134.8-14: warning: useless associativity for SPRINTF [-Wother]
-input.y:137.7-9: warning: useless associativity for '.' [-Wother]
-input.y:156.23-25: warning: useless associativity for '(' [-Wother]
-input.y:157.20-22: warning: useless associativity for '`' [-Wother]
-input.y:159.48-50: warning: useless associativity for '@<:@' [-Wother]
-input.y:170.7-9: warning: useless associativity for ',' [-Wother]
-input.y:181.8-10: warning: useless associativity for '!' [-Wother]
+input.y:19.8-12: warning: useless associativity for LABEL, use %precedence [-Wprecedence]
+input.y:20.8-15: warning: useless associativity for VARIABLE, use %precedence [-Wprecedence]
+input.y:21.8-13: warning: useless associativity for NUMBER, use %precedence [-Wprecedence]
+input.y:22.8-11: warning: useless associativity for TEXT, use %precedence [-Wprecedence]
+input.y:25.8-14: warning: useless associativity for ORDINAL, use %precedence [-Wprecedence]
+input.y:30.8-11: warning: useless associativity for LAST, use %precedence [-Wprecedence]
+input.y:31.8-9: warning: useless associativity for UP, use %precedence [-Wprecedence]
+input.y:32.8-11: warning: useless associativity for DOWN, use %precedence [-Wprecedence]
+input.y:35.8-10: warning: useless associativity for BOX, use %precedence [-Wprecedence]
+input.y:36.8-13: warning: useless associativity for CIRCLE, use %precedence [-Wprecedence]
+input.y:37.8-14: warning: useless associativity for ELLIPSE, use %precedence [-Wprecedence]
+input.y:38.8-10: warning: useless associativity for ARC, use %precedence [-Wprecedence]
+input.y:39.8-11: warning: useless associativity for LINE, use %precedence [-Wprecedence]
+input.y:40.8-12: warning: useless associativity for ARROW, use %precedence [-Wprecedence]
+input.y:42.8-13: warning: useless associativity for SPLINE, use %precedence [-Wprecedence]
+input.y:43.8-13: warning: useless associativity for HEIGHT, use %precedence [-Wprecedence]
+input.y:44.8-13: warning: useless associativity for RADIUS, use %precedence [-Wprecedence]
+input.y:45.8-12: warning: useless associativity for WIDTH, use %precedence [-Wprecedence]
+input.y:46.8-15: warning: useless associativity for DIAMETER, use %precedence [-Wprecedence]
+input.y:47.8-11: warning: useless associativity for FROM, use %precedence [-Wprecedence]
+input.y:48.8-9: warning: useless associativity for TO, use %precedence [-Wprecedence]
+input.y:49.8-9: warning: useless associativity for AT, use %precedence [-Wprecedence]
+input.y:53.8-12: warning: useless precedence and associativity for SOLID [-Wprecedence]
+input.y:54.8-13: warning: useless associativity for DOTTED, use %precedence [-Wprecedence]
+input.y:55.8-13: warning: useless associativity for DASHED, use %precedence [-Wprecedence]
+input.y:56.8-11: warning: useless associativity for CHOP, use %precedence [-Wprecedence]
+input.y:59.8-12: warning: useless precedence and associativity for LJUST [-Wprecedence]
+input.y:60.8-12: warning: useless precedence and associativity for RJUST [-Wprecedence]
+input.y:61.8-12: warning: useless precedence and associativity for ABOVE [-Wprecedence]
+input.y:62.8-12: warning: useless precedence and associativity for BELOW [-Wprecedence]
+input.y:63.8-9: warning: useless associativity for OF, use %precedence [-Wprecedence]
+input.y:66.8-14: warning: useless associativity for BETWEEN, use %precedence [-Wprecedence]
+input.y:67.8-10: warning: useless associativity for AND, use %precedence [-Wprecedence]
+input.y:68.8-11: warning: useless associativity for HERE, use %precedence [-Wprecedence]
+input.y:69.8-12: warning: useless associativity for DOT_N, use %precedence [-Wprecedence]
+input.y:70.8-12: warning: useless associativity for DOT_E, use %precedence [-Wprecedence]
+input.y:71.8-12: warning: useless associativity for DOT_W, use %precedence [-Wprecedence]
+input.y:72.8-12: warning: useless associativity for DOT_S, use %precedence [-Wprecedence]
+input.y:73.8-13: warning: useless associativity for DOT_NE, use %precedence [-Wprecedence]
+input.y:74.8-13: warning: useless associativity for DOT_SE, use %precedence [-Wprecedence]
+input.y:75.8-13: warning: useless associativity for DOT_NW, use %precedence [-Wprecedence]
+input.y:76.8-13: warning: useless associativity for DOT_SW, use %precedence [-Wprecedence]
+input.y:77.8-12: warning: useless associativity for DOT_C, use %precedence [-Wprecedence]
+input.y:78.8-16: warning: useless associativity for DOT_START, use %precedence [-Wprecedence]
+input.y:79.8-14: warning: useless associativity for DOT_END, use %precedence [-Wprecedence]
+input.y:85.8-10: warning: useless associativity for SIN, use %precedence [-Wprecedence]
+input.y:86.8-10: warning: useless associativity for COS, use %precedence [-Wprecedence]
+input.y:87.8-12: warning: useless associativity for ATAN2, use %precedence [-Wprecedence]
+input.y:88.8-10: warning: useless associativity for LOG, use %precedence [-Wprecedence]
+input.y:89.8-10: warning: useless associativity for EXP, use %precedence [-Wprecedence]
+input.y:90.8-11: warning: useless associativity for SQRT, use %precedence [-Wprecedence]
+input.y:91.8-12: warning: useless associativity for K_MAX, use %precedence [-Wprecedence]
+input.y:92.8-12: warning: useless associativity for K_MIN, use %precedence [-Wprecedence]
+input.y:93.8-10: warning: useless associativity for INT, use %precedence [-Wprecedence]
+input.y:94.8-11: warning: useless associativity for RAND, use %precedence [-Wprecedence]
+input.y:95.8-12: warning: useless associativity for SRAND, use %precedence [-Wprecedence]
+input.y:98.8-10: warning: useless associativity for TOP, use %precedence [-Wprecedence]
+input.y:99.8-13: warning: useless associativity for BOTTOM, use %precedence [-Wprecedence]
+input.y:100.8-12: warning: useless associativity for UPPER, use %precedence [-Wprecedence]
+input.y:101.8-12: warning: useless associativity for LOWER, use %precedence [-Wprecedence]
+input.y:116.8-18: warning: useless associativity for LEFT_CORNER, use %precedence [-Wprecedence]
+input.y:117.8-19: warning: useless associativity for RIGHT_CORNER, use %precedence [-Wprecedence]
+input.y:118.8-12: warning: useless associativity for NORTH, use %precedence [-Wprecedence]
+input.y:119.8-12: warning: useless associativity for SOUTH, use %precedence [-Wprecedence]
+input.y:120.8-11: warning: useless associativity for EAST, use %precedence [-Wprecedence]
+input.y:121.8-11: warning: useless associativity for WEST, use %precedence [-Wprecedence]
+input.y:122.8-13: warning: useless associativity for CENTER, use %precedence [-Wprecedence]
+input.y:123.8-10: warning: useless associativity for END, use %precedence [-Wprecedence]
+input.y:124.8-12: warning: useless associativity for START, use %precedence [-Wprecedence]
+input.y:127.8-11: warning: useless associativity for PLOT, use %precedence [-Wprecedence]
+input.y:128.8-16: warning: useless associativity for THICKNESS, use %precedence [-Wprecedence]
+input.y:129.8-11: warning: useless associativity for FILL, use %precedence [-Wprecedence]
+input.y:130.8-14: warning: useless precedence and associativity for COLORED [-Wprecedence]
+input.y:131.8-15: warning: useless precedence and associativity for OUTLINED [-Wprecedence]
+input.y:134.8-14: warning: useless associativity for SPRINTF, use %precedence [-Wprecedence]
+input.y:137.7-9: warning: useless associativity for '.', use %precedence [-Wprecedence]
+input.y:156.23-25: warning: useless associativity for '(', use %precedence [-Wprecedence]
+input.y:157.20-22: warning: useless associativity for '`', use %precedence [-Wprecedence]
+input.y:159.48-50: warning: useless associativity for '@<:@', use %precedence [-Wprecedence]
+input.y:170.7-9: warning: useless associativity for ',', use %precedence [-Wprecedence]
+input.y:181.8-10: warning: useless associativity for '!', use %precedence [-Wprecedence]
 ]],
 
 dnl LAST-STATE
index 32a9899..c1aedf3 100644 (file)
@@ -962,7 +962,7 @@ yylex (void)
 
 m4_if(m4_index(m4_quote($3), [no-xml]), -1,
       [AT_BISON_CHECK],
-      [AT_BISON_CHECK_NO_XML])([[--report=all --defines -o input.c input.y]],
+      [AT_BISON_CHECK_NO_XML])([[-Wall --report=all --defines -o input.c input.y]],
                                [0], [], m4_dquote($7))
 
 m4_if(m4_index(m4_quote($3), [last-state]), -1,
index 7a5ed3e..374ac69 100644 (file)
@@ -377,9 +377,9 @@ exp: ;
 %%
 ]])
 
-AT_BISON_CHECK([-v -o input.c input.y], 0, [],
-[[input.y:1.29-32: warning: useless associativity for "||" [-Wother]
-input.y:2.29-32: warning: useless associativity for "<=" [-Wother]
+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]
 ]])
 
 AT_CLEANUP
@@ -1147,10 +1147,10 @@ sr_conflict:
 ]])
 AT_BISON_OPTION_POPDEFS
 
-AT_BISON_CHECK([[-o input.c input.y]], [[0]],,
+AT_BISON_CHECK([[-Wall -o input.c input.y]], [[0]],,
 [[input.y:24.5-19: warning: rule useless in parser due to conflicts: start: start [-Wother]
 input.y:28.5-19: warning: rule useless in parser due to conflicts: sr_conflict: TK2 "tok alias" [-Wother]
-input.y:18.7-9: warning: useless associativity for TK1 [-Wother]
+input.y:18.7-9: warning: useless precedence and associativity for TK1 [-Wprecedence]
 ]])
 AT_COMPILE([[input]])
 AT_PARSER_CHECK([[./input]])