[C++] more useless stuff in expand_body

Mark Mitchell mark@codesourcery.com
Thu Sep 6 21:22:00 GMT 2007

Jan Hubicka wrote:
>> Jan Hubicka wrote:
>>> Hi,
>>> this is another apparently unnecesary bit in expand_body.  I think it is
>>> artefact from times TREE_USED was used to track down what to output.
>>> Bootstrapped/regtested i686-linux, OK?
>> This was to avoid -Wunused warning about variables in multiple clones.
>> For example, things like:
>>   struct S {
>>     S(int);
>>   };
>>   S::S(int i) {}
>> We only want *one* warning about "i" being unused, even if we generate
>> multiple clones of S::S.  Are you sure that can no longer occur?

> amd:~/trunk/build2/gcc # ./xgcc -B ./ -Wunused-parameter t.C -S
> t.C:5: warning: unused parameter 'i'
> with or without the patch.

Well, you'd have to look back at the patch that added that code to
figure out exactly what test case was required to trigger it.  I'd not
be surprised if you needed virtual functions, needed to actually use the
constructor, etc.

> The hunk above won't silence the warning, since the warning is done from
> cgraph_finalize_function that is done long time before expand_body hook
> is called.

If you're sure it doesn't do anything, then it's OK to remove it.

Mark Mitchell
(650) 331-3385 x713

More information about the Gcc-patches mailing list