[Python-Dev] warn_unused_result warnings

Benjamin Peterson benjamin at python.org
Fri Apr 1 03:28:42 CEST 2011


2011/3/31 Victor Stinner <victor.stinner at haypocalc.com>:
> Le 01/04/2011 01:11, Benjamin Peterson a écrit :
>>
>> I'm rather sick of seeing this warnings on all compiles, so I propose
>> we enable the -Wno-unused-results option. I judge that most of the
>> cases where this occurs are error reporting functions, where not much
>> with return code can be done.
>
> Can't we try to fix the warnings instead of turning them off? Or is it
> possible to only turn off these warnings on a specific function?

It strikes me as excessively ugly. (see below)

>
> Modules/faulthandler.c emits a lot of such compiler warning, but there is
> nothing interesting to do on write() error. I tried to turn off the warning
> on an instruction using (void)write(...), but gcc doesn't understand that I
> don't care of write() result here.

You have actually have an assignment, like x = write().


-- 
Regards,
Benjamin


More information about the Python-Dev mailing list