catch redefined functions

This commit is contained in:
Bill Currie 2004-02-11 01:53:17 +00:00
parent c3f41e3e69
commit 0fe4c2a600
2 changed files with 6 additions and 0 deletions

View file

@ -219,6 +219,10 @@ build_builtin_function (def_t *def, expr_t *bi_val)
error (bi_val, "%s is not a function", def->name);
return 0;
}
if (def->constant) {
error (bi_val, "%s redefined", def->name);
return 0;
}
if (bi_val->type != ex_integer && bi_val->type != ex_float) {
error (bi_val, "invalid constant for = #");

View file

@ -624,6 +624,8 @@ opt_comma
begin_function
: /*empty*/
{
if ($<def>0->constant)
error (0, "%s redefined", $<def>0->name);
$$ = current_func = new_function ($<def>0->name);
$$->def = $<def>0;
$$->refs = new_reloc ($$->def->ofs, rel_def_func);