This is the mail archive of the gcc@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: Problem with PFE approach [Was: Faster compilation speed]


On Friday, August 16, 2002, at 01:31 PM, Timothy J. Wood wrote:



So, another point in favor of discarding the concept of 'statically precompilation' based on a problem I just ran into with PFE under 10.2...

I'm emulating some of the Win32 API for porting games to Mac OS X. Win32 has a macro like this:

#ifndef INITGUID
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID FAR name
#else

#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
EXTERN_C const GUID name \
= { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#endif // INITGUID

If this gets stuck in a PFE and the PFE is applied as a prefix header (the only way it can be done right now), then the file being compiled cannot make its own decision about whether INITGUID should be defined or not.

Clearly there are ways around this, but the current approach makes the compiler produce different output based on whether PFE is on or not. I consider this a bug.
It is not.

gcc3 -include my_prefix_header.h .... my_source.c
and
gcc3 --load-pch my_pfe ... my_source.c

will give you same results. In both cases work around is same. A file needs to undef, as I explained in previous email.

You can only put stuff into prefix header, which you are including in ALL sources (where --load-pch is used). You can not put stuff in prefix header that which you will not include for a particular source file.


This would not be a problem with an automatic precompiler that remembered facts and didn't use the prefix header hack.
It is a different model. All models which follows prefix header mechanism, will behave same as PFE.

-Devang


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