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: [RFC PATCH] -grecord-gcc-switches (PR other/32998)


On Thu, Jul 21, 2011 at 08:06:49PM +0000, Joseph S. Myers wrote:
> On Wed, 13 Jul 2011, Jakub Jelinek wrote:
> 
> > Ideally we'd just include explicitly passed options from command line that
> > haven't been overridden by other command line options, and would sort them,
> > so that there are higher chances of DW_AT_producer strings being merged
> > (e.g. -O2 -ffast-math vs. -ffast-math -O2 are now different strings, and
> > similarly -O2 vs. -O3 -O2 vs. -O0 -O1 -Ofast -O2), but I'm not sure if it is
> > easily possible using current option handling framework.
> 
> I don't think there's enough structure for that, although prune_options 
> could always be enhanced to cover more cases of overridden options.

Perhaps we can emit it in the original order even with duplicates for now
and if we get better infrastructure later, reduce its size.

> > +	  default:
> > +	    if (save_decoded_options[j].orig_option_with_args_text[0] != '-')
> > +	      continue;
> 
> Should instead be ignoring OPT_SPECIAL_*.

It already ignores them above:
+      case OPT_SPECIAL_unknown:
+      case OPT_SPECIAL_ignore:
+      case OPT_SPECIAL_program_name:
+      case OPT_SPECIAL_input_file:

I just didn't want to crash if it wouldn't start with -.
I can make it a gcc_checking_assert instead.

> 
> > +	    switch (save_decoded_options[j].orig_option_with_args_text[1])
> > +	      {
> > +	      case 'M':
> > +	      case 'i':
> > +	      case 'W':
> 
> It would be better to check the canonical option text rather than the 
> original text.  Normally this wouldn't make any difference because the 
> driver will have passed canonical options to cc1, but if someone calls cc1 
> directly then I think aliases should still act the same as the options 
> they are aliases for in this regard.

So 

	gcc_checking_assert (save_decoded_options[j].canonical_option[0][0] == '-');
	switch (save_decoded_options[j].canonical_option[0][1])

instead?  The reason for checking the option text instead of code
was just because there are hundreds of -W options etc. and I didn't want to
list them all and create a maintanance nightmare.

> 
> > +		continue;
> > +	      case 'n':
> > +		if (save_decoded_options[j].orig_option_with_args_text[2]
> > +		    == 'o')
> > +		  continue;
> 
> When would a "-no" option ever get passed to cc1?

If -no can't make it to cc1, I'll drop it.  Is -fdump* checking that way
ok (with the orig_option_with_args_text -> canonical_option[0] change)?

	Jakub


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