preprocessor/2706: #defines expanded when -fpreprocessed given
Zack Weinberg
zackw@Stanford.EDU
Wed May 2 17:06:00 GMT 2001
The following reply was made to PR preprocessor/2706; it has been noted by GNATS.
From: "Zack Weinberg" <zackw@Stanford.EDU>
To: Nathan Sidwell <nathan@codesourcery.com>
Cc: Neil Booth <neil@daikokuya.demon.co.uk>, gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/2706: #defines expanded when -fpreprocessed given
Date: Wed, 2 May 2001 17:00:33 -0700
On Wed, May 02, 2001 at 05:00:15PM +0100, Nathan Sidwell wrote:
>
> > It might be better to emit a diagnostic from cpplib, along the lines
> > of "'#define' not honored in already-preprocessed source", and discard
> > the pseudo-directive. The diagnostics we give right now are rather
> > unhelpful. Thoughts?
> That was the kind of error I expected. What triggered this was cc1plus
> silently swallowing a #include.
I looked into providing this. In order for you to get the nice error
both with and without -save-temps, it needs to come from c-lex.c.
Unfortunately, cpplib does not export enough information to do this
reliably. I need to know when a token is the first one on a line, and
I need to be able to discard a line, both from the context of cpplib's
user. cpplib throws away the information about tokens being first on
a line deep inside its inner loop. The routine to skip the rest of a
line is private; if I simply export it it doesn't work properly
(caller gets an EOF as the next token processed).
I propose we live with the unfriendly error messages for now, until
cpplib can be adjusted to give c-lex what it needs. I'm testing a
slightly-revised patch right now on the 3.0 branch.
zw
More information about the Gcc-prs
mailing list