bison-patches
[Top][All Lists]
Advanced

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

Re: type-clash diagnostic wording consistency


From: Paul Eggert
Subject: Re: type-clash diagnostic wording consistency
Date: Sun, 3 Nov 2002 22:09:34 -0800 (PST)

> Cc: address@hidden
> From: Akim Demaille <address@hidden>
> Date: 03 Nov 2002 17:54:17 +0100
> User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)
> 
> 
> | reader.c generates these two diagnostics:
> |   type clash (`T1' `T2') on default action
> |   result type clash on merge function F: `T1' vs. `T2'
> | 
> | It's better if we use consistent wording, so I changed the wording of
> | the latter to:
> | 
> |   result type clash (`T1' `T2') on merge function F
> 
> honestly, I prefer the other one

OK, but while we're changing diagnostics I think it's better to use
<> to quote types, since that's how they're written down in Yacc.
So I installed this further patch.

2002-11-03  Paul Eggert  <address@hidden>

        * src/reader.c (get_merge_function, grammar_current_rule_check):
        Use consistent diagnostics for reporting type name clashes.
        Quote the types with <>, for consistency with Yacc.
        * tests/input.at (Type Clashes): Adjust to diagnostic changes.

Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.215
diff -p -u -r1.215 reader.c
--- src/reader.c        3 Nov 2002 07:49:40 -0000       1.215
+++ src/reader.c        4 Nov 2002 06:03:10 -0000
@@ -137,8 +137,8 @@ get_merge_function (const char* name, co
       merge_functions = head.next;
     }
   else if (strcmp (type, syms->next->type) != 0)
-    warn_at (loc, _("result type clash (`%s' `%s') on merge function %s"),
-            type, syms->next->type, name);
+    warn_at (loc, _("result type clash on merge function %s: <%s> != <%s>"),
+            name, type, syms->next->type);
   return n;
 }
 
@@ -264,7 +264,7 @@ grammar_current_rule_check (void)
       const char *rhs_type = first_rhs->type_name ? first_rhs->type_name : "";
       if (strcmp (lhs_type, rhs_type))
        complain_at (current_rule->location,
-                    _("type clash (`%s' `%s') on default action"),
+                    _("type clash on default action: <%s> != <%s>"),
                     lhs_type, rhs_type);
     }
   /* Warn if there is no default for $$ but we need one.  */
Index: tests/input.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/input.at,v
retrieving revision 1.13
diff -p -u -r1.13 input.at
--- tests/input.at      3 Nov 2002 08:42:56 -0000       1.13
+++ tests/input.at      4 Nov 2002 06:03:10 -0000
@@ -74,8 +74,8 @@ exp: foo {} foo
 ]])
 
 AT_CHECK([bison input.y], [1], [],
-[[input.y:4.4-15: type clash (`bar' `') on default action
-input.y:5.4-8: type clash (`bar' `') on default action
+[[input.y:4.4-15: type clash on default action: <bar> != <>
+input.y:5.4-8: type clash on default action: <bar> != <>
 input.y:6.4: empty rule for typed nonterminal, and no action
 ]])
 




reply via email to

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