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: [RFA/driver] Handle switches with arguments in self specs


Daniel Jacobowitz <drow@false.org> writes:
> +
> +	  /* Deal with option arguments in separate argv elements.  */
> +	  if ((SWITCH_TAKES_ARG (c) > (p[1] != 0))
> +	      || WORD_SWITCH_TAKES_ARG (p))
> +	    {
> +	      int j = 0;
> +	      int n_args = WORD_SWITCH_TAKES_ARG (p);
> +
> +	      if (n_args == 0)
> +		{
> +		  /* Count only the option arguments in separate argv elements.  */
> +		  n_args = SWITCH_TAKES_ARG (c) - (p[1] != 0);
> +		}
> +	      if (i + n_args >= argbuf_index)
> +		fatal ("argument to '-%s' is missing", p);
> +	      switches[n_switches].args
> +		= XNEWVEC (const char *, n_args + 1);
> +	      while (j < n_args)
> +		switches[n_switches].args[j++] = argbuf[++i];
> +	      /* Null-terminate the vector.  */
> +	      switches[n_switches].args[j] = 0;
> +	    }
> +	  n_switches++;

Sorry for sticking my oar in, but this looks like a cut-&-paste from
process_command.  Maybe it would be worth splitting it out into a separate
function that can be shared by both.

Richard


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