OSDN Git Service

2002-09-10 Frank Ch. Eigler <fche@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / cppfiles.c
index 903e02d..892583e 100644 (file)
@@ -318,9 +318,12 @@ stack_include_file (pfile, inc)
   sysp = MAX ((pfile->map ? pfile->map->sysp : 0),
              (inc->foundhere ? inc->foundhere->sysp : 0));
 
-  /* For -M, add the file to the dependencies on its first inclusion.  */
-  if (CPP_OPTION (pfile, print_deps) > !!sysp && !inc->include_count)
-    deps_add_dep (pfile->deps, inc->name);
+  /* Add the file to the dependencies on its first inclusion.  */
+  if (CPP_OPTION (pfile, deps.style) > !!sysp && !inc->include_count)
+    {
+      if (pfile->buffer || CPP_OPTION (pfile, deps.ignore_main_file) == 0)
+       deps_add_dep (pfile->deps, inc->name);
+    }
 
   /* Not in cache?  */
   if (! inc->buffer)
@@ -663,9 +666,10 @@ handle_missing_header (pfile, fname, angle_brackets)
      const char *fname;
      int angle_brackets;
 {
-  int print_dep = CPP_PRINT_DEPS(pfile) > (angle_brackets || pfile->map->sysp);
-
-  if (CPP_OPTION (pfile, print_deps_missing_files) && print_dep)
+  bool print_dep
+    = CPP_OPTION (pfile, deps.style) > (angle_brackets || pfile->map->sysp);
+  if (CPP_OPTION (pfile, deps.missing_files) && print_dep)
     deps_add_dep (pfile->deps, fname);
   /* If -M was specified, then don't count this as an error, because
      we can still produce correct output.  Otherwise, we can't produce
@@ -673,7 +677,7 @@ handle_missing_header (pfile, fname, angle_brackets)
      the missing file, and we don't know what directory this missing
      file exists in.  */
   else
-    cpp_errno (pfile, CPP_PRINT_DEPS (pfile) && ! print_dep
+    cpp_errno (pfile, CPP_OPTION (pfile, deps.style) && ! print_dep
               ? DL_WARNING: DL_ERROR, fname);
 }
 
@@ -908,7 +912,6 @@ read_name_map (pfile, dirname)
   if (f)
     {
       int ch;
-      int dirlen = strlen (dirname);
 
       while ((ch = getc (f)) != EOF)
        {
@@ -931,10 +934,7 @@ read_name_map (pfile, dirname)
            ptr->map_to = to;
          else
            {
-             ptr->map_to = xmalloc (dirlen + strlen (to) + 2);
-             strcpy (ptr->map_to, dirname);
-             ptr->map_to[dirlen] = '/';
-             strcpy (ptr->map_to + dirlen + 1, to);
+             ptr->map_to = concat (dirname, "/", to, NULL);
              free (to);
            }