chris@mimsy.UUCP (Chris Torek) (10/07/89)
In article <20041@mimsy.UUCP> I posted a fix to pcc, but I forgot to use `-c', and no one else's lines will match mine. So, here it is again, this time made with context. (I will cancel the previous article, but some of you will have already read it.) RCS file: RCS/pftn.c,v retrieving revision 1.3 retrieving revision 1.4 diff -c2 -r1.3 -r1.4 *** /tmp/,RCSt1000933 Sat Oct 7 10:53:12 1989 --- /tmp/,RCSt2000933 Sat Oct 7 10:53:16 1989 *************** *** 218,224 **** case MOE: ! if( scl == class ){ ! if( p->offset!= strucoff++ ) break; psave( idp ); } break; --- 218,225 ---- case MOE: ! if( scl == class && p->offset == strucoff ){ ! strucoff++; psave( idp ); + return; } break; -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris
chris@mimsy.UUCP (Chris Torek) (10/14/89)
In article <20046@mimsy.UUCP> I posted a fix to pcc for enum this { that = 3 }; main() { enum this { that = 3 }; printf("I expect 3; I got %d\n", that); return (0); } which produces I expect 3; I got 4 from many Unix C compilers. Unfortunately, that fix accepted `benign' redefinitions such as enum color { red, blue, peach }; enum fruit { apple, pear, peach }; which are (according to the draft ANSI C standard) illegal. Here is a different (shorter!) fix, which seems to work, and rejects such redefinitions, while allowing local redefinitions (which persist until a close brace). I do not know why the psave() was there before---it seems to have to do with debugger information and/or disambiguation among nonunique structure member names---but taking it out completely seems to do the trick. [/usr/src/lib/mip/pftn.c] RCS file: RCS/pftn.c,v retrieving revision 1.3 retrieving revision 1.6 diff -c2 -r1.3 -r1.6 *** /tmp/,RCSt1000933 Sat Oct 14 02:39:42 1989 --- pftn.c Sat Oct 14 02:39:42 1989 *************** *** 218,224 **** case MOE: - if( scl == class ){ - if( p->offset!= strucoff++ ) break; - psave( idp ); - } break; --- 218,221 ---- -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris