* Fix PR preprocessor/7358 re SUNPRO_DEPENDENCIES
@ 2002-08-14 15:04 Neil Booth
0 siblings, 0 replies; only message in thread
From: Neil Booth @ 2002-08-14 15:04 UTC (permalink / raw)
To: gcc-patches; +Cc: Andrew Pickin, andrew.walton
SUNPRO_DEPENDENCIES is a little odd, in that it is not supposed
to output the dependence on the main file. [This is the way
it works in Sun's compiler from which we copied the environment
variable.]
It seems this subtlety was lost during the breakout of mkdeps.c
about 2.5 years ago. I'm not sure whether DEPENDENCIES_OUTPUT
is a gcc-native environment variable (anyone?). It's behaviour
has tracked SUNPRO_DEPENDENCIES because they share code.
If it is GCC-specific, I'm inclined to leave it with the new
behaviour of including the dependence on the main file.
But I'm reverting the behaviour of S_D to be compatible with
Sun's compiler. Apparently this behaviour is useful when
temporary files are involved.
Neil.
* 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.
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.13
diff -u -p -r1.13 c-opts.c
--- c-opts.c 14 Aug 2002 17:19:28 -0000 1.13
+++ c-opts.c 14 Aug 2002 21:48:14 -0000
@@ -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)
Index: cppfiles.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppfiles.c,v
retrieving revision 1.153
diff -u -p -r1.153 cppfiles.c
--- cppfiles.c 12 Aug 2002 22:44:29 -0000 1.153
+++ cppfiles.c 14 Aug 2002 21:48:14 -0000
@@ -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)
Index: cpplib.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpplib.h,v
retrieving revision 1.233
diff -u -p -r1.233 cpplib.h
--- cpplib.h 12 Aug 2002 22:44:30 -0000 1.233
+++ cpplib.h 14 Aug 2002 21:48:15 -0000
@@ -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. */
Index: doc/cppenv.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/cppenv.texi,v
retrieving revision 1.3
diff -u -p -r1.3 cppenv.texi
--- doc/cppenv.texi 26 Mar 2002 03:25:05 -0000 1.3
+++ doc/cppenv.texi 14 Aug 2002 21:48:15 -0000
@@ -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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-08-14 22:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-14 15:04 Fix PR preprocessor/7358 re SUNPRO_DEPENDENCIES Neil Booth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).