Preprocessing oddity breaks binutils

Andreas Schwab schwab@issan.cs.uni-dortmund.de
Thu Jul 1 00:00:00 GMT 1999


Zack Weinberg <zack@rabi.columbia.edu> writes:

|> On Wed, 02 Jun 1999 12:04:06 -0400, Dave Brolley wrote:
|> >I agree that this is probably a long standing quirk bug in the
|> >preprocessor which is arguably a bug. Does anyone know of any source which
|> >relies on the current behaviour?
|> 
|> FYI, cpplib uses the test.h in the subdirectory.  I agree with Mark that
|> this is the right thing - #line should not affect the search path.

But #line changes the file name.

The standard says that the place where to search is implementation
defined.  The cpp manual says: "It searches for a file named FILE first in
the current directory, [...].  The current directory is the directory of
the current input file."

About the #line directive the standard says:

       [#4] A preprocessing directive of the form

         # line digit-sequence "s-char-sequence-opt" new-line

       sets the presumed line  number  similarly  and  changes  the
       presumed  name  of the source file to be the contents of the
       character string literal.

Thus the current behaviour of cpp is more in the spirit of the standard,
and IMHO cpplib is wrong.

Andreas.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org


More information about the Binutils mailing list