Patchwork [google] Work around build system bug in handling of -MD (issue3981053)

login
register
mail settings
Submitter Diego Novillo
Date Feb. 2, 2011, 2:41 p.m.
Message ID <90e6ba6e8cd214e717049b4da60b@google.com>
Download mbox | patch
Permalink /patch/81459/
State New
Headers show

Comments

Diego Novillo - Feb. 2, 2011, 2:41 p.m.
Reviewers: gcc-patches_gcc.gnu.org, simonb_google.com,

Description:

Google's build system has always assumed that -MD always produces
output.  This is an outstanding bug that for now is easier to work
around with this hack.

Tested on x86_64.  Committed on google/integration.


2011-02-02  Diego Novillo  <dnovillo@google.com>

	* c-family/c-opts.c (c_common_finish): Emit deps even if
	the file has syntax errors.

Patch

diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index befd644..e116921 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -1093,7 +1093,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 ())
+  /* FIXME.  We are emitting the deps file even if there were errors.
+     This is a temporary workaround to avoid confusing Google's build
+     system.  It assumes that deps files are always emitted even
+     in the presence of errors.  */
+  if (cpp_opts->deps.style != DEPS_NONE /*&& !seen_error ()*/)
      {
        /* If -M or -MM was seen without -MF, default output to the
  	 output stream.  */


Please review this at http://codereview.appspot.com/3981053/

Affected files:
   M gcc/c-family/c-opts.c


Index: gcc/c-family/c-opts.c
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index  
befd64498a4bc87400a8d5e4d2001512f6ac2154..e11692116fecac0842809d820049bd6c08f81e4e  
100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -1093,7 +1093,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 ())
+  /* FIXME.  We are emitting the deps file even if there were errors.
+     This is a temporary workaround to avoid confusing Google's build
+     system.  It assumes that deps files are always emitted even
+     in the presence of errors.  */
+  if (cpp_opts->deps.style != DEPS_NONE /*&& !seen_error ()*/)
      {
        /* If -M or -MM was seen without -MF, default output to the
  	 output stream.  */