c-opts.c (c_common_finish): Write dependency information even if there are errors.
authorBoris Kolpackov <boris@codesynthesis.com>
Fri, 1 Sep 2017 16:45:33 +0000 (16:45 +0000)
committerJeff Law <law@gcc.gnu.org>
Fri, 1 Sep 2017 16:45:33 +0000 (10:45 -0600)
* c-opts.c (c_common_finish): Write dependency information even if
there are errors.

From-SVN: r251605

gcc/c-family/ChangeLog
gcc/c-family/c-opts.c

index e1a051f95ee2a2e0258bafbd1b5b568d47a70486..33cb1871699e71d04ae537b571477db4fcec3bd0 100644 (file)
@@ -1,3 +1,8 @@
+2017-09-01  Boris Kolpackov <boris@codesynthesis.com>
+
+       * c-opts.c (c_common_finish): Write dependency information even if
+       there are errors.
+
 2017-09-01  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/81887
index 0b13a188c1b380a2fcbb2711947f3165e81b0853..9e7f0a361ca0b485b0a2be5e26586f844e07829d 100644 (file)
@@ -1145,8 +1145,11 @@ c_common_finish (void)
 {
   FILE *deps_stream = NULL;
 
-  /* Don't write the deps file if there are errors.  */
-  if (cpp_opts->deps.style != DEPS_NONE && !seen_error ())
+  /* Note that we write the dependencies even if there are errors. This is
+     useful for handling outdated generated headers that now trigger errors
+     (for example, with #error) which would be resolved by re-generating
+     them. In a sense, this complements -MG.  */
+  if (cpp_opts->deps.style != DEPS_NONE)
     {
       /* If -M or -MM was seen without -MF, default output to the
         output stream.  */