This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH to -MD specs


Jason Merrill wrote:-

> 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.

Jason, I've found some time to have a quick look at this.  Your patch
is in three pieces, which I believe are independent:

1) Remove a stray space
2) Update MQ spec if MD
3) Some fiddling with 'W' handling

1) is fine.

I don't think 2) is the correct fix, since the issue at hand has nothing
to do with the MQ spec; you're just using that as a convenience to
get at the ".o" file name, right?  What we really need (apart from a
complete overhaul of specs 8-)) is a spec that just records a temporary
file name, but does nothing else, i.e. one that does the same as 'W'
but doesn't result in anything extra on the output command line,  correct?
The problem being that the assembler spec handles removing the .o files,
but that spec hasn't yet been invoked.  If you agree, I kludge something
up for this.

> 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 can't understand 3) from this description.  Could you elaborate?  Is
it related to 1)?

Neil.
 
> 2002-09-06  Jason Merrill  <jason@redhat.com>
> 
> 	* gcc.c (cpp_unique_options): If -MD or -MMD, also cause the rule
> 	target to be deleted on failure.
> 	(do_spec_1) [case 'W']: End any pending argument from the braces.
> 

> *** gcc.c.~1~	Mon Aug 12 19:48:24 2002
> --- gcc.c	Fri Sep  6 15:12:29 2002
> *************** static const char *cpp_unique_options =
> *** 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:%{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*:%*}}}}}\
>    %{!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\
> *************** do_spec_1 (spec, inswitch, soft_matched_
> *** 4702,4707 ****
> --- 4702,4719 ----
>   	      p = handle_braces (p + 1);
>   	      if (p == 0)
>   		return -1;
> + 	      /* End any pending argument.  */
> + 	      if (arg_going)
> + 		{
> + 		  obstack_1grow (&obstack, 0);
> + 		  string = obstack_finish (&obstack);
> + 		  if (this_is_library_file)
> + 		    string = find_file (string);
> + 		  store_arg (string, delete_this_arg, this_is_output_file);
> + 		  if (this_is_output_file)
> + 		    outfiles[input_file_number] = string;
> + 		  arg_going = 0;
> + 		}
>   	      /* If any args were output, mark the last one for deletion
>   		 on failure.  */
>   	      if (argbuf_index != cur_index)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]