mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-07 18:01:30 +00:00
[qfcc] Treat parameter shadowing as an error
This applies only to the top-level scope of the function. I'm not sure if it's right for traditional quakec code, but that can be adjusted easily enough.
This commit is contained in:
parent
bc2204d446
commit
a2b5ebde65
1 changed files with 4 additions and 0 deletions
|
@ -536,6 +536,10 @@ initialize_def (symbol_t *sym, expr_t *init, defspace_t *space,
|
|||
symbol_t *check = symtab_lookup (symtab, sym->name);
|
||||
reloc_t *relocs = 0;
|
||||
|
||||
if (check && symtab->parent && check->table == symtab->parent->parent
|
||||
&& symtab->parent->parent->type == stab_param) {
|
||||
error (0, "%s shadows a parameter", sym->name);
|
||||
}
|
||||
if (check && check->table == symtab) {
|
||||
if (check->sy_type != sy_var || !type_same (check->type, sym->type)) {
|
||||
error (0, "%s redefined", sym->name);
|
||||
|
|
Loading…
Reference in a new issue