Warnings on ignored returned values

Octavian Voicu octavian.voicu at gmail.com
Mon Mar 22 07:16:27 CDT 2010


Hello,

I'm trying to compile wine with --enable-maintainer-mode and I get
lots of errors like `ignoring return value of ‘xxx’, declared with
attribute warn_unused_result'. I would like to submit a few patches to
fix them.

I noticed there's a page on the wiki for this:
http://wiki.winehq.org/IgnoredReturnValues

On the other hand, there are no indications on the policy of handling
them. Sometimes we just don't care about the return value, but I
haven't found a way to tell this to the compiler other than actually
using the return value. In other cases, errors might be relevant.

For example, for the code:

if (newdir) chdir(newdir);

would the following be an acceptable fix?

if (newdir) if (chdir(newdir) == -1) /* ignore error */ ;

Should I use WARNs to print the error, in cases where it might be relevant?

Thanks,
Octavian



More information about the wine-devel mailing list