This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH to -MD specs
- From: Neil Booth <neil at daikokuya dot co dot uk>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 6 Sep 2002 16:34:58 +0100
- Subject: Re: PATCH to -MD specs
- References: <wvlznuv6w2z.fsf@prospero.cambridge.redhat.com>
Jason Merrill wrote:-
> Currently, if you compile something with
>
> gcc -MD -c foo.c -o foo.o
>
> and hit ^C while cc1 is running, gcc will delete the .d file, but not the
> .o file (if it already exists). A subsequent make would see the
> preexisting foo.o, but not any dependencies, and decide that foo.o is up to
> date. Oops.
>
> This patch causes us to delete the output file as well, if we are compiling
> with -MD. It also moves the handling of the default rule target into the
> specs, as I don't see any other way to add that string to the command line
> so I can wrap a %W{} around it.
Ugh, these specs are spiralling out of control. Adding an -MQ like this
changes the behaviour if
1) -MQ or -MT is specified, or
2) SUNPRO_DEPENDENCIES or DEPENDENCIES_OUTPUT is used
right? 2) is probably not so important, but 1) is I think.
> This patch also removes stray spaces in the -MD/-MMD rules, and fixes
> do_spec_1 so that a trailing space is not necessary to terminate the %b.d
> argument so that %W can see it. I assume there's some reason that
> handle_braces doesn't already terminate a pending argument; if not, we
> could do it there instead.
I'll take your word for it 8-)
> ! %{!E:%{!M:%{!MM:%{MD|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}\
> %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\
> --- 671,680 ----
> "%{C:%{!E:%eGNU C does not support -C without using -E}}\
> %{CC:%{!E:%eGNU C does not support -CC without using -E}}\
> %{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*} %{P} %I\
> ! %{MD:-MD %W{!o:%b.d}%W{o*:%.d%*}}\
> ! %{MMD:-MMD %W{!o:%b.d}%W{o*:%.d%*}}\
> %{M} %{MM} %W{MF*} %{MG} %{MP} %{MQ*} %{MT*}\
> ! %{!E:%{!M:%{!MM:%{MD|MMD:-MQ %W{!o:%b%O}%W{o*:%*}}}}}\
What's the reason you can't just make it
%{!E:%{!M:%{!MM:%{MD|MMD:%{o*:%W{-MQ %*}}}}}}\
This doesn't change semantics, at least. Does it miss a case?
Neil.