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: Separate preprocess and compile: hack or feature?


On Thu, May 11, 2017 at 11:06:13AM +0100, Jonathan Wakely wrote:
> It's absolutely a supported feature. Why else do you think the manual
> would discuss so many options for preprocessing, and options for
> compiling preprocessed code?
> https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html seems quite
> explicit.
> 
> > Also, has anyone seen/heard of any real-world issues with compiling
> > preprocessed source code?
> 
> There are very occasional bugs where compiling the original source
> code behaves slightly differently, e.g. regarding what is considered a
> system header, but it usually only affects warnings or errors, not
> code generation. And nothing that would mean separate preprocessing
> and compilation shouldn't be relied on.

Especially in recent GCC versions the amount of differences for warnings and
errors keeps dramatically increasing, with separate preprocessing simply
too much information is lost (macro contexts, lint style comments, exact
locations, system header issues, ...).

So it is far better to not use -E, but instead -E -fdirectives-only
for the preprocessing step, which will get you also single file with all the
includes in it, but macros, comments etc. are still in there.

Tried to explain that to the ccache people, but they aren't listening.

	Jakub


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