Separate preprocess and compile: hack or feature?
Boris Kolpackov
boris@codesynthesis.com
Thu May 11 12:16:00 GMT 2017
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
More information about the Gcc
mailing list