> [coke - Sat Jan 24 19:32:16 2004]: > > It would be helpful if IMCC complained about duplicate ".local" labels, > so that the attached wouldn't compile, rather than dying at runtime. >
A naive pass at this is: oolong:~/research/parrot coke$ cvs diff imcc/symreg.c Index: imcc/symreg.c ========================================================= ========== RCS file: /cvs/public/parrot/imcc/symreg.c,v retrieving revision 1.55 diff -b -u -r1.55 symreg.c --- imcc/symreg.c 17 Jul 2004 08:07:27 -0000 1.55 +++ imcc/symreg.c 30 Oct 2004 04:45:21 -0000 @@ -287,6 +287,11 @@ ident->next = namespace->idents; namespace->idents = ident; } + if (_get_sym(cur_unit->hash,fullname)) { + fataly(1, sourcefile, line, + "duplicate .local or .sym: '%s'", + fullname); + } r = mk_symreg(fullname, t); r->type = VTIDENTIFIER; free(name); This causes a few tests to fail: t/library/dumper.t 13 3328 13 13 100.00% 1-13 t/library/parrotlib.t 1 256 6 1 16.67% 3 t/library/streams.t 12 3072 21 12 57.14% 2 4-5 8 10-12 14-17 20 t/pmc/iter.t 1 256 44 1 2.27% 11 /Some/ of these seem to be valid errors. But it also seems to not like having .subs with the same name as a .local inside that sub. Also, the errors message isn't reporting properly. Help?