This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Preprocessed output in gcc 4.5.2


On 3/29/2011 4:52 PM, Jonathan Wakely wrote:
On 29 March 2011 21:38, Edward Diener wrote:
On 3/29/2011 4:18 PM, Jonathan Wakely wrote:

On 29 March 2011 21:10, Edward Diener wrote:

According the the docs an "-E" parameter should produce preprocessed output.

It does.


I add that to the beginning of the g++ or gcc command line but the progam
does not produce the output and insists on compiling. What do I have to
do
to get just preprocessed output in gcc ?

Are you still giving -c on the command line too? Use -E instead of that, not in addition to it, otherwise if -c comes later it will override the earlier -E option (which I am guessing is what's happening if you're putting -E at the beginning.)

Also be aware the preprocessed output will go into the file specified
by -o, so you might want to change "-c -o foo.o" to "-E -o foo.ii"

It gives me a bunch of errors, such as:


error: missing binary operator before token "("

That's an error from the preprocessor, so -E is probably working (i.e. it's not insisting on compiling) but it thinks the input is invalid so it doesn't produce output.

Whatever it is seeing which leads to an error is being produced by macros and not the input before macro processing. I know this because a change in another particular macro causes no errors to occur, but is not the correct processing for the program. However I can not see how the change of that other macro matters so I am trying to produce preprocessing output so I can see why it thinks the error is occuring. But it will not show me any output once it produce the error. I think that is very poor. It can at least show me what it is seeing, with previous macro expansion, that produces the error message.



but refuses to generate any output so that I can see what the preprocessor
is seeing when I give it the -E option. Absolutely infuriating !

The preprocessor obviously sees the unpreprocessed input.

Sure, but the unpreprocessed input is fine. It needs to show me what it is seeing, after previous macro expansion, that causes the error message, but will not do so.



Needless to say, using the Wave preprocessor in Boost shows no errors, but
since gcc is not producing the same thing I don't know why gcc thinks the
macros I am using is producing the errors it reports.

GCC is complaining about the macros themselves, not their results.

The macro as unpreprocessed input about which it is complaining is perfectly fine. I know this because of what I explained above.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]