Re: attribute warn_unused_result

From: Arjan van de Ven
Date: Tue Sep 07 2004 - 07:50:12 EST


On Tue, Sep 07, 2004 at 10:43:51PM +1000, Con Kolivas wrote:
> Arjan van de Ven wrote:
> >On Tue, 2004-09-07 at 14:23, Con Kolivas wrote:
> >
> >>Gcc3.4.1 has recently been complaining of a number of unused results
> >>from function with attribute warn_unused_result set. I'm not sure of how
> >>you want to tackle this so I'm avoiding posting patches. Should we
> >>remove the attribute (seems the likely option) or set some dummy
> >>variable (sounds stupid now that I ask it).
> >
> >
> >that attribute is supposed to only be set for functions you really ought
> >to check the result for.... so how about checking/using the result ?
>
> I understand the concept... these are functions that seem to work fine
> without using the return value... unless of course the original coders
> aren't yet aware of that fact then I'm sorry. Here's the list just with
> my config on 2.6.9-rc1-bk13:

> fs/binfmt_elf.c:273: warning: ignoring return value of `copy_to_user',
> declared with attribute warn_unused_result

you really are supposed to use the return value of copy_to_user and friends.

Attachment: pgp00000.pgp
Description: PGP signature