#line feature in C preprocessor

utzoo!decvax!harpo!esquire!cmcl2!philabs!sdcsvax!sdccsu3!sdcvax!trw-unix!sentry1!wartik utzoo!decvax!harpo!esquire!cmcl2!philabs!sdcsvax!sdccsu3!sdcvax!trw-unix!sentry1!wartik
Tue Feb 15 10:00:10 AEST 1983

I'm writing some programs using Berkeley Ingres and the EQUEL
preprocessor.  Now this EQUEL was written for version 6, and suffers
from some problems.  For instance, it doesn't insert the #line
directives, so error messages from the C compiler invariably refer to
the wrong line.  I didn't have time to fix EQUEL, so I inserted in each
of my ".q" files the line:

	#line 2 "<filename>.q"

at the beginning of the file.  My trouble is that these files all have
some #include lines following them, and the C preprocessor resets the
file name back to filename.c after an include file is processed!  I
have circumvented the problem once again by placing my #line directive
following all #includes, but what I would like is:

1)	To know if this filename-resetting is a bug or a feature.  By
	the way, has anybody ever produced documentation on the
	preprocessor?  I would greatly appreciate a copy.  Just out of
	curiosity, is the __FILE__ feature described anywhere on vanilla
	Unix other than in /usr/include/assert.h?

2)	If this is a bug, does anybody have the fixes?

3)      Best of all, does anybody have a version of EQUEL that has been
	modified to use the #line directive?  We're running VAXen here,
	so versions that understand their word sizes are preferred, but
	I'll take the source code for a version that works on an 11 if
	it's available.

				Thanks in advance,
					-- Steve Wartik

More information about the Comp.lang.c mailing list