better error reporting for redefines

This commit is contained in:
Bill Currie 2007-05-13 09:02:51 +00:00 committed by Jeff Teunissen
parent a521a78adb
commit 680bc22697
2 changed files with 5 additions and 2 deletions

View file

@ -105,7 +105,11 @@ check_for_name (type_t *type, const char *name, scope_t *scope,
if (def) {
if (storage != st_none && scope == def->scope)
if (type && def->type != type) {
expr_t *e = new_expr ();
e->line = def->line;
e->file = def->file;
error (0, "Type mismatch on redeclaration of %s", name);
error (e, "previous declaration");
}
if (storage == st_none || def->scope == scope)
return def;

View file

@ -189,8 +189,7 @@ get_function (const char *name, type_t *type, int overload, int create)
e->file = func->file;
warning (0, "creating overloaded function %s without @overload",
full_name);
warning (e, "(previous function is %s)",
func->full_name);
warning (e, "(previous function is %s)", func->full_name);
}
overload = 1;
}