On 11 May 2017 at 10:13, Boris Kolpackov wrote:
> Hi,
>
> 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[1] 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 ;-)

http://dilbert.com/strip/1995-06-24

> 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
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.

Reply via email to