@@ -695,7 +695,7 @@ const char *type_difference(struct ctype *c1, struct ctype *c2,
if (!t1 || !t2)
return "different types";
- if (t1->type == SYM_NODE || t1->type == SYM_ENUM) {
+ if (t1->type == SYM_NODE) {
t1 = base1;
move1 = 1;
if (!t1)
@@ -703,7 +703,7 @@ const char *type_difference(struct ctype *c1, struct ctype *c2,
continue;
}
- if (t2->type == SYM_NODE || t2->type == SYM_ENUM) {
+ if (t2->type == SYM_NODE) {
t2 = base2;
move2 = 1;
if (!t2)
@@ -724,6 +724,7 @@ const char *type_difference(struct ctype *c1, struct ctype *c2,
return "bad types";
case SYM_RESTRICT:
return "different base types";
+ case SYM_ENUM:
case SYM_UNION:
case SYM_STRUCT:
/* allow definition of incomplete structs and unions */
@@ -56,7 +56,6 @@ static struct ops ops_ko = {
/*
* check-name: typediff-enum
- * check-known-to-fail
*
* check-error-start
typediff-enum.c:5:5: error: symbol 'v' redeclared with different type (originally declared at typediff-enum.c:4) - different base types
Currently, type_difference() doesn't make a distinction between enums & ints with the result being that sparse is not only way too permissive regarding the typing of enums but simply wrong. Fix this in type_difference() by: *) stop to strip SYM_ENUM as it is (and must be) done with SYM_NODE. *) be as strict with SYM_ENUMs as with SYM_STRUCTs & SYM_UNIONs. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- evaluate.c | 5 +++-- validation/typediff-enum.c | 1 - 2 files changed, 3 insertions(+), 3 deletions(-)