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: Boris Kolpackov <boris at codesynthesis dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Jonathan Wakely <jwakely dot gcc at gmail dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 11 May 2017 14:16:36 +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>
Hi Jakub,
Jakub Jelinek <jakub@redhat.com> writes:
> 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.
Uh, thanks, that's very helpful.
One use case for removing comments is detecting and ignoring comments-only
changes (via a checksum). But that's relatively minor. We could probably
re-process the result ourselves and strip the comments for that (will have
to recognize comments for the C++ module import detection anyway).
Also, preserving comments helps with some VC issues (e.g., a/**/b).
> Tried to explain that to the ccache people, but they aren't listening.
I am, on the hand, all ears ;-).
Thanks,
Boris