This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Print -imacros and -include'd headers if print_deps (take 3)


Hi!

Ok, 3rd version of the same thing, I added -M -include description under -M
because I think it makes more sense there than under -include.
Ok to commit?

2001-01-24  Jakub Jelinek  <jakub@redhat.com>

	* cppfiles.c (_cpp_read_file): Add to dependencies if requested.
	* cppinit.c (cpp_start_read): Remove deps_add_dep call.
	* tradcpp.c (main): Likewise.
	* cpp.texi (-M, -MM): Document -M -include behaviour.

--- gcc/cppfiles.c.jj	Wed Jan 17 13:35:52 2001
+++ gcc/cppfiles.c	Tue Jan 23 20:40:38 2001
@@ -765,6 +765,9 @@ _cpp_read_file (pfile, fname)
       return 0;
     }
 
+  if (CPP_OPTION (pfile, print_deps))
+    deps_add_dep (pfile->deps, f->name);
+
   stack_include_file (pfile, f);
   return 1;
 }
--- gcc/cppinit.c.jj	Mon Jan 22 13:58:05 2001
+++ gcc/cppinit.c	Tue Jan 23 20:41:52 2001
@@ -911,13 +911,8 @@ cpp_start_read (pfile, fname)
     CPP_OPTION (pfile, out_fname) = "";
 
   if (CPP_OPTION (pfile, print_deps))
-    {
-      /* Set the default target (if there is none already), and
-	 the dependency on the main file.  */
-      deps_add_default_target (pfile->deps, CPP_OPTION (pfile, in_fname));
-
-      deps_add_dep (pfile->deps, CPP_OPTION (pfile, in_fname));
-    }
+    /* Set the default target (if there is none already).  */
+    deps_add_default_target (pfile->deps, CPP_OPTION (pfile, in_fname));
 
   /* Open the main input file.  This must be done early, so we have a
      buffer to stand on.  */
--- gcc/tradcpp.c.jj	Fri Jan 12 11:35:40 2001
+++ gcc/tradcpp.c	Tue Jan 23 19:25:08 2001
@@ -848,6 +848,11 @@ main (argc, argv)
 	    perror_with_name (pend[i].arg);
 	    return FATAL_EXIT_CODE;
 	  }
+
+	/* For -M, add this file to the dependencies.  */
+	if (print_deps)
+	  deps_add_dep (deps, pend[i].arg);
+
 	finclude (fd, pend[i].arg, &outbuf);
       }
   indepth--;
--- gcc/cpp.texi.jj	Tue Jan 23 14:47:49 2001
+++ gcc/cpp.texi	Tue Jan 23 20:44:46 2001
@@ -3453,14 +3453,16 @@ Instead of outputting the result of prep
 suitable for @code{make} describing the dependencies of the main source
 file.  The preprocessor outputs one @code{make} rule containing the
 object file name for that source file, a colon, and the names of all the
-included files.  If there are many included files then the rule is split
-into several lines using @samp{\}-newline.
+included files, including those coming from @samp{-include} or
+@samp{-imacros} command line options.  If there are many included files
+then the rule is split into several lines using @samp{\}-newline.
 
 @item -MM
 @findex -MM
 Like @samp{-M}, but mention only the files included with @samp{#include
-"@var{file}"}.  System header files included with @samp{#include
-<@var{file}>} are omitted.
+"@var{file}"} or with @samp{-include} or @samp{-imacros} command line
+options.  System header files included with @samp{#include <@var{file}>}
+are omitted.
 
 @item -MF @var{file}
 @findex -MF

	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]