This is the mail archive of the
mailing list for the GCC project.
Re: Separate preprocess and compile: hack or feature?
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Boris Kolpackov <boris at codesynthesis dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 11 May 2017 11:06:13 +0100
- Subject: Re: Separate preprocess and compile: hack or feature?
- Authentication-results: sourceware.org; auth=none
- References: <email@example.com>
On 11 May 2017 at 10:13, Boris Kolpackov wrote:
> In the build system I am working on we are looking at always performing
> the preprocessing and then C/C++ compilation as two separate gcc/g++
> invocations. The main reason is support for distributed compilation but
> see here for other reasons.
> I realize that tools like ccache/distcc have been relying on this for
> a while (though see the 'direct' mode in ccache and 'pump' in distcc).
> However, some compilers apparently do not support this (for example,
> VC; see the above link for details).
Here's a nickel kid, get yourself a better compiler ;-)
> So I wonder, in the context of GCC, if this is just a hack that happens
> to work "for now" or if this is a feature that is expected to continue
> to work?
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
> 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.