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)
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
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);
}
if (f)
{
int ch;
- int dirlen = strlen (dirname);
while ((ch = getc (f)) != EOF)
{
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);
}