This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Write dependency information (-M*) even if there are errors
- From: Jeff Law <law at redhat dot com>
- To: Boris Kolpackov <boris at codesynthesis dot com>, gcc-patches at gcc dot gnu dot org
- Date: Fri, 1 Sep 2017 10:46:02 -0600
- Subject: Re: [PATCH] Write dependency information (-M*) even if there are errors
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=law at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6D308C0587D4
- References: <boris.20170813172254@codesynthesis.com>
On 08/13/2017 09:25 AM, Boris Kolpackov wrote:
> Hi,
>
> I've been instructed to resend this patch from the gcc mailing list:
>
> Currently GCC does not write extracted header dependency information
> if there are errors. However, this can be useful when dealing with
> outdated generated headers that trigger errors which would have been
> resolved if we could update it. A concrete example in our case is a
> version check with #error.
>
> The included (trivial) patch changes this behavior. Note also that
> this is how Clang already behaves. I've tested the patch in build2
> and everything works well (i.e., no invalid dependency output in the
> face of various preprocessor errors such as #error, stray #else, etc).
>
> While I don't foresee any backwards-compatibility issues with such
> an unconditional change (after all, the compiler still exists with
> an error status), if there are concerns, I could re-do it via an
> option (e.g., -ME, analogous to -MG).
>
> Joseph Myers <joseph@codesourcery.com> writes:
>
>> I suppose a question for the present proposal would be making sure any
>> dependencies generated in this case do not include dependencies on files
>> that don't exist (so #include "some-misspelling.h" doesn't create any sort
>> of dependency on such a header).
> Good point. I've tested this and I believe everything is in order:
> unless -MG is specified, a non-existent header is treated as a fatal
> error so we don't even get to writing the dependency info. And if -MG
> is specified, then there is no error and we get the missing header in
> the dependency output, as requested.
>
> P.S. I have the paperwork necessary to contribute on file with FSF.
>
> Thanks,
> Boris
>
>
> deps-on-error.diff
>
>
> Index: gcc/c-family/ChangeLog
> ===================================================================
> --- gcc/c-family/ChangeLog (revision 250514)
> +++ gcc/c-family/ChangeLog (working copy)
> @@ -1,3 +1,8 @@
> +2017-08-06 Boris Kolpackov <boris@codesynthesis.com>
> +
> + * c-opts.c (c_common_finish): Write dependency information even if
> + there are errors.
Thanks. I've installed this on the trunk. Sorry for the delays.
jeff