[PATCH] Latest version of the -Wunused-but-set-{variable,parameter} patches (C++ part)

Jason Merrill jason@redhat.com
Fri Apr 16 18:08:00 GMT 2010


On 04/15/2010 04:14 PM, Dodji Seketeli wrote:
> On Thu, Apr 15, 2010 at 03:50:26PM -0400, Jason Merrill wrote:
>> If you leave the call in rvalue, can you avoid the *INCREMENT_EXPR
>> change?
>
> No, because e.g. in this example:
> void fn()
> {
>      int a = 0;
>      a++;
> }
> rvalue is never called. We reach mark_exp_read for the a++ expression
> through finish_expr_stmt.

Ah, it was the build_unary_op use that handled that.  Then that one 
should stay in, too, since that's the point that the use occurs.

>> My second paragraph above was requesting that uses as rvalue, lvalue
>> and type call different functions rather than all calling
>> mark_exp_read.
>
> Do you mean calling new functions that would be named e.g. rvalue_use,
> lvalue_use and that would act as a sort of hook?  Or rather calling
> existing functions that would route to mark_exp_read in the end?

Some of each.  I would think that all rvalue uses should already go 
through decay_conversion or rvalue -- and I don't think we really need 
both of those, or at least one should call the other.

Type and lvalue uses need new functions that would currently just call 
mark_exp_read, but could in future do other things as well, including 
wrap the expression somehow.

Jason



More information about the Gcc-patches mailing list