bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another - Bison 1.35 works but Bison 1.50 Doesn't


From: Paul Eggert
Subject: Re: Another - Bison 1.35 works but Bison 1.50 Doesn't
Date: Sat, 12 Oct 2002 20:57:25 -0700 (PDT)

> From: "Jim Gifford" <address@hidden>
> Date: Sat, 12 Oct 2002 12:09:02 -0700
> 
> vcc.y:209.9-211.9: type clash (`' `vobj') on default action
> vcc.y:260.6-264.12: type clash (`' `str') on default action
> vcc.y:292.7-51: type clash (`' `str') on default action

Thanks for the bug report.  I installed the following patch to fix it.

2002-10-12  Paul Eggert  <address@hidden>

        * src/reader.c (grammar_current_rule_check):
        Don't worry about the default action if $$ is untyped.
        Prevents bogus warnings reported by Jim Gifford in
        <http://mail.gnu.org/pipermail/bug-bison/2002-October/001673.html>.

Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.210
diff -p -u -r1.210 reader.c
--- src/reader.c        5 Oct 2002 05:47:51 -0000       1.210
+++ src/reader.c        13 Oct 2002 03:46:02 -0000
@@ -246,18 +246,22 @@ static void
 grammar_current_rule_check (void)
 {
   symbol_t *lhs = current_rule->sym;
+  char const *lhs_type = lhs->type_name;
   symbol_t *first_rhs = current_rule->next->sym;
 
   /* If there is an action, then there is nothing we can do: the user
-     is allowed to shoot in her foot.  */
+     is allowed to shoot herself in the foot.  */
   if (current_rule->action)
     return;
 
-  /* If $$ is being set in default way, report if any type mismatch.
-     */
+  /* Don't worry about the default action if $$ is untyped, since $$'s
+     value can't be used.  */
+  if (! lhs_type)
+    return;
+
+  /* If $$ is being set in default way, report if any type mismatch.  */
   if (first_rhs)
     {
-      const char *lhs_type = lhs->type_name       ? lhs->type_name       : "";
       const char *rhs_type = first_rhs->type_name ? first_rhs->type_name : "";
       if (strcmp (lhs_type, rhs_type))
        complain_at (current_rule->location,
@@ -266,11 +270,8 @@ grammar_current_rule_check (void)
     }
   /* Warn if there is no default for $$ but we need one.  */
   else
-    {
-      if (lhs->type_name)
-       complain_at (current_rule->location,
-                    _("empty rule for typed nonterminal, and no action"));
-    }
+    complain_at (current_rule->location,
+                _("empty rule for typed nonterminal, and no action"));
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]