This is the mail archive of the
mailing list for the GCC project.
Re: Separate preprocess and compile: hack or feature?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: Boris Kolpackov <boris at codesynthesis dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 11 May 2017 12:43:36 +0200
- Subject: Re: Separate preprocess and compile: hack or feature?
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AAB5F64469
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AAB5F64469
- References: <firstname.lastname@example.org> <CAH6eHdS5n+Vi=97W0D8YddH3-QcqA8=b4XseUqUXgTFCPGJnWg@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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
> > 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.