path[q - p] = '\0';
}
- add_path (path, chain, chain == SYSTEM);
+ add_path (path, chain, chain == SYSTEM, false);
}
}
if (!strncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
{
char *str = concat (iprefix, p->fname + len, NULL);
- add_path (str, SYSTEM, p->cxx_aware);
+ add_path (str, SYSTEM, p->cxx_aware, false);
}
}
}
else
str = update_path (p->fname, p->component);
- add_path (str, SYSTEM, p->cxx_aware);
+ add_path (str, SYSTEM, p->cxx_aware, false);
}
}
}
if (errno != ENOENT)
cpp_errno (pfile, CPP_DL_ERROR, cur->name);
else
- reason = REASON_NOENT;
+ {
+ /* If -Wmissing-include-dirs is given, warn. */
+ cpp_options *opts = cpp_get_options (pfile);
+ if (opts->warn_missing_include_dirs && cur->user_supplied_p)
+ cpp_errno (pfile, CPP_DL_WARNING, cur->name);
+ reason = REASON_NOENT;
+ }
}
else if (!S_ISDIR (st.st_mode))
cpp_error_with_line (pfile, CPP_DL_ERROR, 0, 0,
/* Add PATH to the include chain CHAIN. PATH must be malloc-ed and
NUL-terminated. */
void
-add_path (char *path, int chain, int cxx_aware)
+add_path (char *path, int chain, int cxx_aware, bool user_supplied_p)
{
cpp_dir *p;
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Convert all backslashes to slashes. The native CRT stat()
+ function does not recognise a directory that ends in a backslash
+ (unless it is a drive root dir, such "c:\"). Forward slashes,
+ trailing or otherwise, cause no problems for stat(). */
+ char* c;
+ for (c = path; *c; c++)
+ if (*c == '\\') *c = '/';
+#endif
+
p = xmalloc (sizeof (cpp_dir));
p->next = NULL;
p->name = path;
else
p->sysp = 0;
p->construct = 0;
+ p->user_supplied_p = user_supplied_p;
- if (tails[chain])
- tails[chain]->next = p;
- else
- heads[chain] = p;
- tails[chain] = p;
+ add_cpp_dir_path (p, chain);
}
/* Exported function to handle include chain merging, duplicate