[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: type clash on default action: <NONE> != <>
From: |
Paul Eggert |
Subject: |
Re: type clash on default action: <NONE> != <> |
Date: |
Sat, 30 Nov 2002 01:58:38 -0800 (PST) |
> From: <address@hidden>
> Date: Mon, 25 Nov 2002 13:05:57 +0100 (CET)
> I have the following problem with bison-1.75 and also 1.75c when
> compiling mysql-4.0 sources on Linux i386:
>
> make[2]: Entering directory `/usr/scratch/mysql-4.0/sql'
> /usr/local/bin/bison -y -d sql_yacc.yy && mv y.tab.c sql_yacc.cc
> sql_yacc.yy:666.7-672.21: type clash on default action: <NONE> != <>
Do you know the story behind those <NONE> declarations in the MySQL
grammar? You can fix the problem by removing the two "%type
<NONE>..." declarations. I don't know why those declarations are
needed.
That being said, it appears to me that Bison is being too strict about
type clashes. I can construct a grammar that contains lots of type
clashes, but which ignores the corresponding values, and POSIX seems
to allow such a grammar. So I have installed the following patch,
which should downgrade those error messages to warnings.
2002-11-30 Paul Eggert <address@hidden>
Type clashes now generate warnings, not errors, since it
appears that POSIX may allow some grammars with type clashes.
* src/reader.c (grammar_current_rule_check): Warn about
type clashes instead of complaining.
* tests/input.at (Type Clashes): Expect warnings, not complaints.
Index: src/reader.c
===================================================================
RCS file: /cvsroot/bison/bison/src/reader.c,v
retrieving revision 1.225
diff -p -u -r1.225 reader.c
--- src/reader.c 29 Nov 2002 05:59:59 -0000 1.225
+++ src/reader.c 30 Nov 2002 09:48:54 -0000
@@ -260,14 +260,14 @@ grammar_current_rule_check (void)
{
const char *rhs_type = first_rhs->type_name ? first_rhs->type_name : "";
if (!STRUNIQ_EQ (lhs_type, rhs_type))
- complain_at (current_rule->location,
- _("type clash on default action: <%s> != <%s>"),
- lhs_type, rhs_type);
+ warn_at (current_rule->location,
+ _("type clash on default action: <%s> != <%s>"),
+ lhs_type, rhs_type);
}
/* Warn if there is no default for $$ but we need one. */
else
- complain_at (current_rule->location,
- _("empty rule for typed nonterminal, and no action"));
+ warn_at (current_rule->location,
+ _("empty rule for typed nonterminal, and no action"));
}
Index: tests/input.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/input.at,v
retrieving revision 1.21
diff -p -u -r1.21 input.at
--- tests/input.at 14 Nov 2002 22:53:47 -0000 1.21
+++ tests/input.at 30 Nov 2002 09:48:54 -0000
@@ -73,10 +73,10 @@ exp: foo {} foo
;
]])
-AT_CHECK([bison input.y], [1], [],
-[[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
+AT_CHECK([bison input.y], [], [],
+[[input.y:4.4-15: warning: type clash on default action: <bar> != <>
+input.y:5.4-8: warning: type clash on default action: <bar> != <>
+input.y:6.4: warning: empty rule for typed nonterminal, and no action
]])
AT_CLEANUP