[PATCH] Add check_result attribute

Jason Merrill jason@redhat.com
Fri Sep 12 21:51:00 GMT 2003


On Fri, 12 Sep 2003 14:27:52 -0700, "Zack Weinberg" <zack@codesourcery.com> wrote:

>> +	    if (scope && SCOPE_STMT_BLOCK (scope))
>> +	      warning ("%H\
>> +ignoring return value of `%D', declared with attribute check_result",
>> +		       &expr_wfl_stack->location,
>> +		       BLOCK_ABSTRACT_ORIGIN (SCOPE_STMT_BLOCK (scope)));
>> +	    else
>> +	      warning ("%H\
>> +ignoring return value of function declared with attribute check_result",
>> +		       &expr_wfl_stack->location);
>
> These are awfully verbose.  Suggest just "return value of \"%D\" not used"
> in both cases

The purpose of the "declared..." bit is to tell the user that this warning
was requested in the declaration of the function, it's not just the
compiler trying to enforce some arbitrary coding style.

> -- and please make both of them include the name of the function whose
> result is being ignored.

The first one does, the second can't.

Jason



More information about the Gcc-patches mailing list