jeff@warwick.UUCP (Jeff Smith) (03/13/86)
in addition, to compile programs with static constructors or destructors, like hello world, you need to change munch.c: the line return 1; should be changed to exit (1); in the function main. the default exit status of a process on sun-2 rel 2 is 0, not the return value of main. jeff@warwick.uucp ..mcvax!warwick!jeff
cmc@rlvd.UUCP (Chris Crampton) (03/14/86)
In article <224@ubu.warwick.UUCP> jeff@warwick.UUCP (Jeff Smith) writes: >... > >The following patch to lex.c fixes a bug to do with cfront's >action on preprocessor lines (discovered when I forgot to run >cpp first). Without the fix, cfront will faithfully transcribe >lines beginning with # for the preprocessor, except for the second >character, which will be turned into an 'i'. > >*** /usr/src/cmd/c++/src/lex.c Mon Nov 25 15:53:43 1985 >--- lex.c Thu Mar 6 15:49:48 1986 >*************** >*** 1001,1006 > break; > default: /* pass #rubbish through */ > pch('#'); > pch('i'); > while (get(c) != '\n') pch(c); > pch('\0'); > >--- 1001,1009 ----- > break; > default: /* pass #rubbish through */ > pch('#'); >+ #ifdef PCHFIX >+ pch(c); >+ #else !PCHFIX > pch('i'); > #endif PCHFIX > while (get(c) != '\n') pch(c); To get the intended effect for "#..." preprocessor lines, then a: start_txt(); is needed just before the ``pch('#');'' in the above fix for lex.c. The result of not putting this is that for every consecutive preprocessor line, a preprocessor line is output; only its the wrong one. In fact the first one is output repeatedly! -- ======================================================================= Chris M Crampton UK JANET: cmc@uk.ac.rl.vd Rutherford Appleton Labs, ARPA: cmc%rl.vd@ucl-cs.arpa Didcot, OXON, U.K. UUCP: ..!mcvax!ukc!rlvd!cmc +44 235 21900 ext. 6756
jon@cit-vax.Caltech.Edu (Jonathan P. Leech) (03/20/86)
Expires: Sender: Followup-To: Organization : California Institute of Technology Keywords: In article <229@ubu.warwick.UUCP> jeff@warwick.UUCP (Jeff Smith) writes: >in addition, to compile programs >with static constructors or destructors, like >hello world, you need to change munch.c: the line > return 1; >should be changed to > exit (1); >in the function main. > >the default exit status of a process on >sun-2 rel 2 is 0, not the return value of main. > >jeff@warwick.uucp >..mcvax!warwick!jeff This turns out to also be the case for Amdahl UTS (in contradiction to the April ANSI C draft and every other Unix system I've worked on.) In fact, crt0.s under UTS explicitly says 'exit with 0 status if main returns'. Sigh. Probably the distributed munch.c should be modified to call exit instead of return to account for as many (brain-damaged) environments as possible. -- Jon Leech (jon@csvax.caltech.edu || ...seismo!cit-vax!jon) __@/