diff --git a/tools/qfcc/source/function.c b/tools/qfcc/source/function.c index 098d0ae9e..3727b1c02 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -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 = #"); diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index 3c3ce1658..06b587891 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -624,6 +624,8 @@ opt_comma begin_function : /*empty*/ { + if ($0->constant) + error (0, "%s redefined", $0->name); $$ = current_func = new_function ($0->name); $$->def = $0; $$->refs = new_reloc ($$->def->ofs, rel_def_func);