aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2002-08-14 22:34:50 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-08-14 22:34:50 +0000
commit182d89a3e9e9477e6fd7fae846e2033ee6e287cd (patch)
treef37dd03c8db5ac792b317d8bbddee04999fd0d43
parent8bfb14674d5dccd6a1cdd71051dfac643901c4d4 (diff)
downloadgcc-182d89a3e9e9477e6fd7fae846e2033ee6e287cd.zip
gcc-182d89a3e9e9477e6fd7fae846e2033ee6e287cd.tar.gz
gcc-182d89a3e9e9477e6fd7fae846e2033ee6e287cd.tar.bz2
re PR preprocessor/7358 (Changes to Sun's make Dependencies)
PR preprocessor/7358 * c-opts.c (check_deps_environment_vars): Ignore main file for SUNPRO_DEPENDENCIES. * cppfiles.c (stack_include_file): Ignore main file if appropriate. * cpplib.h (struct cpp_options): New member in deps. * doc/cppenv.texi: Update. From-SVN: r56333
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/c-opts.c8
-rw-r--r--gcc/cppfiles.c7
-rw-r--r--gcc/cpplib.h3
-rw-r--r--gcc/doc/cppenv.texi3
5 files changed, 26 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a411d93..2142ccd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2002-08-15 Neil Booth <neil@daikokuya.co.uk>
+
+ PR preprocessor/7358
+ * c-opts.c (check_deps_environment_vars): Ignore main file
+ for SUNPRO_DEPENDENCIES.
+ * cppfiles.c (stack_include_file): Ignore main file if
+ appropriate.
+ * cpplib.h (struct cpp_options): New member in deps.
+ * doc/cppenv.texi: Update.
+
2002-08-14 Neil Booth <neil@daikokuya.co.uk>
PR preprocessor/7526
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 0b98308..36f11f0 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -1467,7 +1467,8 @@ c_common_finish ()
DEPS_TARGET", where OUTPUT_FILE is the file to write deps info to
and DEPS_TARGET is the target to mention in the deps. They also
result in dependency information being appended to the output file
- rather than overwriting it. */
+ rather than overwriting it, and like Sun's compiler
+ SUNPRO_DEPENDENCIES suppresses the dependency on the main file. */
static void
check_deps_environment_vars ()
{
@@ -1480,7 +1481,10 @@ check_deps_environment_vars ()
{
GET_ENVIRONMENT (spec, "SUNPRO_DEPENDENCIES");
if (spec)
- cpp_opts->deps.style = DEPS_SYSTEM;
+ {
+ cpp_opts->deps.style = DEPS_SYSTEM;
+ cpp_opts->deps.ignore_main_file = true;
+ }
}
if (spec)
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index 63e6f75..892583e 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -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. */
+ /* Add the file to the dependencies on its first inclusion. */
if (CPP_OPTION (pfile, deps.style) > !!sysp && !inc->include_count)
- deps_add_dep (pfile->deps, inc->name);
+ {
+ if (pfile->buffer || CPP_OPTION (pfile, deps.ignore_main_file) == 0)
+ deps_add_dep (pfile->deps, inc->name);
+ }
/* Not in cache? */
if (! inc->buffer)
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index 3640d44..3d2cac7 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -387,6 +387,9 @@ struct cpp_options
/* Generate phony targets for each dependency apart from the first
one. */
bool phony_targets;
+
+ /* If true, no dependency is generated on the main file. */
+ bool ignore_main_file;
} deps;
/* Target-specific features set by the front end or client. */
diff --git a/gcc/doc/cppenv.texi b/gcc/doc/cppenv.texi
index a233313..7a913f1 100644
--- a/gcc/doc/cppenv.texi
+++ b/gcc/doc/cppenv.texi
@@ -72,7 +72,8 @@ with an optional @option{-MT} switch too.
@cindex dependencies for make as output
This variable is the same as @env{DEPENDENCIES_OUTPUT} (see above),
except that system header files are not ignored, so it implies
-@option{-M} rather than @option{-MM}.
+@option{-M} rather than @option{-MM}. However, the dependence on the
+main input file is omitted.
@ifset cppmanual
@xref{Invocation}.
@end ifset