This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Remaining dependency work
- To: gcc-patches at gcc dot gnu dot org
- Subject: Remaining dependency work
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Date: Sun, 7 Jan 2001 18:12:59 +0000
- Cc: Zack Weinberg <zackw at Stanford dot EDU>
The dependencies stuff is nealy there now. Two things remain:
1) if -o foo.o is used on the command line, the target is not taken
correctly from the -o switch.
2) the .d file of -MD or -MMD is put in the current directory. My
question here is: should it use the path of any -o switch (this
is what Nathan did), or always use the path of the .c file?
This patch fixes 1), and renames init () more descriptively as Zack
suggested. Example:-
bash-2.04$ gcc -MM -MP /tmp/test.c -o /tmp/foo.o -c
/tmp/foo.o: /tmp/test.c /tmp/test.h
/tmp/test.h:
Does this look OK to you, Zack? (Another example of spec nastiness -
this alone adds four scans of all command line options when no -M
options are used. %{M*: blah} doesn't work because in the example
above it would repeat the target twice.)
Neil.
* cppinit.c (init): Rename init_library.
(cpp_create_reader): Update.
* gcc.c (cpp_options): If -o given, use it as the target of
any -M options.
Index: cppinit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppinit.c,v
retrieving revision 1.133
diff -u -p -r1.133 cppinit.c
--- cppinit.c 2001/01/07 15:17:05 1.133
+++ cppinit.c 2001/01/07 18:00:15
@@ -94,7 +94,7 @@ struct cpp_pending
static void print_help PARAMS ((void));
static void path_include PARAMS ((cpp_reader *,
char *, int));
-static void init PARAMS ((void));
+static void init_library PARAMS ((void));
static void init_builtins PARAMS ((cpp_reader *));
static void append_include_chain PARAMS ((cpp_reader *,
char *, int, int));
@@ -469,7 +469,7 @@ opt_comp (p1, p2)
do anything depending on the platform and compiler. */
static void
-init ()
+init_library ()
{
static int initialized = 0;
@@ -499,7 +499,7 @@ cpp_create_reader (lang)
cpp_reader *pfile;
/* Initialise this instance of the library if it hasn't been already. */
- init ();
+ init_library ();
pfile = (cpp_reader *) xcalloc (1, sizeof (cpp_reader));
Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.195
diff -u -p -r1.195 gcc.c
--- gcc.c 2001/01/07 15:17:06 1.195
+++ gcc.c 2001/01/07 18:00:30
@@ -587,6 +587,7 @@ static const char *cpp_options =
%{std*} %{nostdinc*}\
%{C} %{v} %{I*} %{P} %{$} %I\
%{M} %{MM} %{MD:-M -MF %b.d} %{MMD:-MM -MF %b.d} %{MF} %{MG} %{MP} %{MQ} %{MT}\
+ %{M|MD|MM|MMD:%{o*:-MQ %*}}\
%{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\
%{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
%c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\