This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Separate preprocess and compile: hack or feature?
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jonathan Wakely <jwakely dot gcc at gmail dot com>, 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 13:08:42 +0200
- Subject: Re: Separate preprocess and compile: hack or feature?
- Authentication-results: sourceware.org; auth=none
- References: <boris.20170511111208@codesynthesis.com> <CAH6eHdS5n+Vi=97W0D8YddH3-QcqA8=b4XseUqUXgTFCPGJnWg@mail.gmail.com> <20170511104336.GJ1809@tucnak>
On Thu, May 11, 2017 at 12:43 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> 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.
For the very same reason -g3 debuginfo is also not what you expect
(all macros are gone).
Richard.
> Jakub