aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppfiles.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2001-01-04 18:26:12 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2001-01-04 18:26:12 +0100
commitc3843cea61f838af76b6a77ea5b38f9026c9bb8f (patch)
treea5ea1c92dfd04317ba19d5e37d7d49c0b97ac469 /gcc/cppfiles.c
parentf4d578da666c948839a56e141071b0ee9c50f555 (diff)
downloadgcc-c3843cea61f838af76b6a77ea5b38f9026c9bb8f.zip
gcc-c3843cea61f838af76b6a77ea5b38f9026c9bb8f.tar.gz
gcc-c3843cea61f838af76b6a77ea5b38f9026c9bb8f.tar.bz2
tradcpp.c (deps_file, [...]): New variables.
* tradcpp.c (deps_file, print_deps_missing_files): New variables. (main): Handle -MG, -MD, -MMD. Bail out if -MG is given without -M or -MM. (do_include): Handle missing headers like cpp0. * cppfiles.c (_cpp_execute_include): Don't prefix absolute header paths with first include pathname. Don't strcat to uninitialized string. From-SVN: r38683
Diffstat (limited to 'gcc/cppfiles.c')
-rw-r--r--gcc/cppfiles.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index ddf2e80..b0678d7 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -648,12 +648,14 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next)
if (CPP_OPTION (pfile, print_deps_missing_files)
&& PRINT_THIS_DEP (pfile, angle_brackets))
{
- if (!angle_brackets)
+ if (!angle_brackets || *fname == '/')
deps_add_dep (pfile->deps, fname);
else
{
char *p;
struct file_name_list *ptr;
+ int len = strlen (ptr->name);
+
/* If requested as a system header, assume it belongs in
the first system header directory. */
if (CPP_OPTION (pfile, bracket_include))
@@ -661,14 +663,13 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next)
else
ptr = CPP_OPTION (pfile, quote_include);
- p = (char *) alloca (strlen (ptr->name)
- + strlen (fname) + 2);
- if (*ptr->name != '\0')
+ p = (char *) alloca (len + strlen (fname) + 2);
+ if (len)
{
- strcpy (p, ptr->name);
- strcat (p, "/");
+ memcpy (p, ptr->name, len);
+ p[len++] = '/';
}
- strcat (p, fname);
+ strcpy (p + len, fname);
_cpp_simplify_pathname (p);
deps_add_dep (pfile->deps, p);
}