[unix-pc.general] gnu-cpp + /bin/cc = headache

alex@umbc3.UMD.EDU (Alex S. Crain) (10/28/88)

	With all these binaries running about, I wanted to make sure that
everyone knew this.

	gnu-cpp irritates a bug in the stock C compiler, causing -g to
produce bogus line #/file name information in the symbol table. The problem
is that gnu-cpp can emit #line directives on consecutive lines, which confuses
the C compiler.

	This bug has no effect on the exectable code, only on the debugging 
information. The fix is simple enough, although if you have gcc its sort of
pointless. Simply chage the printf() statements in the cccp.c file from

	fprintf(outfile,"# line %d, \"%s\"\n", ... )

to

	fprintf(outfile,\n# line %d, \"%s\"\n", ... )
			^
			add a blank line between #line directives.

Note that this is purely from memory, so the exact syntax may differ. There 
are 2 or three instances of this in the cccp.c file.

-- 
					:alex.
					Systems Programmer
nerwin!alex@umbc3.umd.edu		UMBC
alex@umbc3.umd.edu

lenny@icus.islp.ny.us (Lenny Tropiano) (10/30/88)

In article <1301@umbc3.UMD.EDU> alex@umbc3.UMD.EDU (Alex S. Crain) writes:
...
|>
|>	fprintf(outfile,"# line %d, \"%s\"\n", ... )
|>
|>to
|>
|>	fprintf(outfile,\n# line %d, \"%s\"\n", ... )
|>			^
|>			add a blank line between #line directives.
|>
|>Note that this is purely from memory, so the exact syntax may differ. There 
|>are 2 or three instances of this in the cccp.c file.
|>


	fprintf(outfile,"\n# line %d, \"%s\"\n", ... )
			^ make sure you put this quote in. :-)

-Lenny
-- 
Lenny Tropiano             ICUS Software Systems         [w] +1 (516) 582-5525
lenny@icus.islp.ny.us      Telex; 154232428 ICUS         [h] +1 (516) 968-8576
{talcott,decuac,boulder,hombre,pacbell,sbcs}!icus!lenny  attmail!icus!lenny
        ICUS Software Systems -- PO Box 1; Islip Terrace, NY  11752