[cairo-bugs] [Bug 58727] warn_unused_result noise

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue May 13 12:24:05 PDT 2014


--- Comment #8 from Bill Spitzak <spitzak at gmail.com> ---
On 05/12/2014 11:28 PM, bugzilla-daemon at freedesktop.org wrote:
> *Comment # 7 <https://bugs.freedesktop.org/show_bug.cgi?id=58727#c7> on
> bug 58727 <https://bugs.freedesktop.org/show_bug.cgi?id=58727> from Ravi
> Nanjundappa <mailto:nravi.n at samsung.com> *
> (In reply tocomment #6  <show_bug.cgi?id=58727#c6>)
>> I think the complaint is about strtol(), which is being used apparently
>> to find the other end of the numeric value (returned in the char** arg)
>> while the number is ignored, thus causing this error.
>> It does seem that nobody is going to "accidentally" ignore the result of
>> strtol. The warning really should be on functions returning things you
>> *must* do something with, for instance malloc() where if you don't free
>> the returned value you have a memory leak.
>> And they really should restore the (void)fn() work-around, which is
>> readable.
> In some of the cases (for ex: _cairo_polygon_add_external_edge()), the return
> values of the callee are used by the caller (for ex: ln. no. 63 and 177 in
> cairo-path-fill.c file), while in other cases it is ignored for some reasons.
> The warnings are thrown in these scenarios. In such a case, I fell like we can
> use the approach provided by Sergey Shandar, @
> http://stackoverflow.com/questions/3614691/casting-to-void-doesnt-remove-warn-unused-result-error
> Bill,
> Could you please share your opinion on this?

My tests just confirm that the ridiculous workaround described in the 
link (of using a temporary and casting *that* to void) is required by 
gcc, instead of the more sensible workaround of casting the function 
call to void.

I have no opinion on whether removing the warn-unused-result attribute 
from that function, or adding the workaround, or figuring out if the 
code should in fact should be paying attention to the result.

You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20140513/861d3203/attachment.html>

More information about the cairo-bugs mailing list