OSDN Git Service

(do_include): For missing header file, if -M, don't
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Apr 1993 19:32:37 +0000 (19:32 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Apr 1993 19:32:37 +0000 (19:32 +0000)
output dependencies, and warning not error if no dependency is
needed.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@4033 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cccp.c

index 02a2704..bcc583e 100644 (file)
@@ -3984,34 +3984,18 @@ get_filename:
 
     strncpy (fname, fbeg, flen);
     fname[flen] = 0;
-    if (search_start)
+    /* If -M was specified, and this header file won't be added to the
+       dependency list, then don't count this as an error, because we can
+       still produce correct output.  Otherwise, we can't produce correct
+       output, because there may be dependencies we need inside the missing
+       file, and we don't know what directory this missing file exists in.  */
+    if (print_deps
+       && (print_deps <= (angle_brackets || (system_include_depth > 0))))
+      warning ("No include path in which to find %s", fname);
+    else if (search_start)
       error_from_errno (fname);
     else
       error ("No include path in which to find %s", fname);
-    
-    /* For -M, add this file to the dependencies.  */
-    if (print_deps > (angle_brackets || (system_include_depth > 0))) {
-      /* Break the line before this.  */
-      deps_output ("", 0);
-
-      /* If it was requested as a system header file,
-        then assume it belongs in the first place to look for such.  */
-      if (angle_brackets) {
-       for (searchptr = search_start; searchptr; searchptr = searchptr->next) {
-         if (searchptr->fname) {
-           if (searchptr->fname[0] == 0)
-             continue;
-           deps_output (searchptr->fname, 0);
-           deps_output ("/", 0);
-           break;
-         }
-       }
-      }
-      /* Otherwise, omit the directory, as if the file existed
-        in the directory with the source.  */
-      deps_output (fbeg, flen);
-      deps_output (" ", 0);
-    }
   } else {
     struct stat stat_f;