[cfe-commits] [PATCH] Implement -MG
Peter Collingbourne
peter at pcc.me.uk
Tue Jul 12 12:35:56 PDT 2011
On Thu, Jun 30, 2011 at 11:40:26AM -0700, Chris Lattner wrote:
>
> On Jun 30, 2011, at 9:54 AM, Peter Collingbourne wrote:
>
> > Hi,
> >
> > This patch implements -MG (and fixes PR9613). OK to commit?
> >
> > One potential issue with this patch is that it introduces a
> > preprocessor flag whose purpose is to "manually" disable a fatal
> > diagnostic, since I couldn't see a way to do this within the existing
> > diagnostic system (Diagnostic::setDiagnosticMapping contains an assert
> > which explicitly forbids this).
>
> Cool, thanks for working on this. Instead of tackling it this way, how about switching err_cannot_open_file diagnostic to be a warning (which default maps to fatal) with no -W flag. Then the preprocessor could just remap this to ignore when in -MG mode.
>
> What do you think?
Yes, turning err_pp_file_not_found into a warning seems like the
right approach (I initially misunderstood the relationship between the
"kind" of diagnostic and the default mapping).
I'm not sure that the remapping should be done in -cc1 though, it feels
like a layering violation. Personally I feel the best place to make
the decision is in the driver, but I couldn't see an easy way to do
this while preserving existing behaviour, so I added the remapping at
an appropriate place in the frontend (lib/Frontend/DependencyFile.cpp)
with a FIXME.
Committed in r134996.
Thanks,
--
Peter
More information about the cfe-commits
mailing list