From 51d0f328ba4dff5c9e8866a7bca24f45c578314d Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Mon, 19 Feb 2001 19:50:21 +0000 Subject: cppfiles.c (stack_include_file): Generate dependencies here, and manage include_count here too. * cppfiles.c (stack_include_file): Generate dependencies here, and manage include_count here too. (PRINT_THIS_DEP): Delete. (_cpp_execute_include): Do not generate dependencies here, apart from the case of a missing header. Do not manage include_count. (_cpp_read_file): Leave dependency generation to stack_include_file. From-SVN: r39899 --- gcc/ChangeLog | 11 +++++++++++ gcc/cppfiles.c | 42 +++++++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 19 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 28c7af6..f12c265 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2001-02-19 Neil Booth + + * cppfiles.c (stack_include_file): Generate dependencies + here, and manage include_count here too. + (PRINT_THIS_DEP): Delete. + (_cpp_execute_include): Do not generate dependencies here, + apart from the case of a missing header. Do not manage + include_count. + (_cpp_read_file): Leave dependency generation to + stack_include_file. + Mon Feb 19 10:17:47 2001 Jeffrey A Law (law@cygnus.com) * config.gcc (hppa*64*-*-hpux11*): Add MASK_GAS to diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 1c41445..49b7958 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -268,6 +268,20 @@ stack_include_file (pfile, inc) { size_t len = 0; cpp_buffer *fp; + int sysp, deps_sysp; + + /* We'll try removing deps_sysp after the release of 3.0. */ + deps_sysp = pfile->system_include_depth != 0; + sysp = ((pfile->buffer && pfile->buffer->sysp) + || (inc->foundhere && inc->foundhere->sysp)); + + /* For -M, add the file to the dependencies on its first inclusion. */ + if (CPP_OPTION (pfile, print_deps) > deps_sysp && !inc->include_count) + deps_add_dep (pfile->deps, inc->name); + + /* We don't want multiple include guard advice for the main file. */ + if (pfile->buffer) + inc->include_count++; /* Not in cache? */ if (! inc->buffer) @@ -280,8 +294,7 @@ stack_include_file (pfile, inc) fp = cpp_push_buffer (pfile, inc->buffer, len, BUF_FILE, inc->name); fp->inc = inc; fp->inc->refcnt++; - if (inc->foundhere) - fp->sysp = inc->foundhere->sysp; + fp->sysp = sysp; /* The ->actual_dir field is only used when ignore_srcdir is not in effect; see do_include */ @@ -566,7 +579,6 @@ report_missing_guard (n, b) return 0; } -#define PRINT_THIS_DEP(p, b) (CPP_PRINT_DEPS(p) > (b||p->system_include_depth)) void _cpp_execute_include (pfile, header, no_reinclude, include_next) cpp_reader *pfile; @@ -579,6 +591,7 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next) unsigned int angle_brackets = header->type == CPP_HEADER_NAME; struct include_file *inc; char *fname; + int print_dep; /* Help protect #include or similar from recursion. */ if (pfile->buffer_stack_depth >= CPP_STACK_MAX) @@ -636,20 +649,13 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next) } inc = find_include_file (pfile, fname, search_start); - if (inc) { - /* For -M, add the file to the dependencies on its first inclusion. */ - if (!inc->include_count && PRINT_THIS_DEP (pfile, angle_brackets)) - deps_add_dep (pfile->deps, inc->name); - inc->include_count++; - - /* Actually process the file. */ - stack_include_file (pfile, inc); - if (angle_brackets) pfile->system_include_depth++; + stack_include_file (pfile, inc); + if (! DO_NOT_REREAD (inc)) { if (no_reinclude) @@ -668,8 +674,10 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next) return; } - if (CPP_OPTION (pfile, print_deps_missing_files) - && PRINT_THIS_DEP (pfile, angle_brackets)) + /* We will try making the RHS pfile->buffer->sysp after 3.0. */ + print_dep = CPP_PRINT_DEPS(pfile) > (angle_brackets + || pfile->system_include_depth); + if (CPP_OPTION (pfile, print_deps_missing_files) && print_dep) { if (!angle_brackets || IS_ABSOLUTE_PATHNAME (fname)) deps_add_dep (pfile->deps, fname); @@ -704,8 +712,7 @@ _cpp_execute_include (pfile, header, no_reinclude, include_next) 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. */ - else if (CPP_PRINT_DEPS (pfile) - && ! PRINT_THIS_DEP (pfile, angle_brackets)) + else if (CPP_PRINT_DEPS (pfile) && ! print_dep) cpp_warning (pfile, "No include path in which to find %s", fname); else cpp_error_from_errno (pfile, fname); @@ -767,9 +774,6 @@ _cpp_read_file (pfile, fname) return 0; } - if (CPP_OPTION (pfile, print_deps)) - deps_add_dep (pfile->deps, f->name); - stack_include_file (pfile, f); return 1; } -- cgit v1.1