[cairo-bugs] [Bug 58727] warn_unused_result noise

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon May 12 23:28:35 PDT 2014


https://bugs.freedesktop.org/show_bug.cgi?id=58727

--- Comment #7 from Ravi Nanjundappa <nravi.n at samsung.com> ---
(In reply to comment #6)
> 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?

> 
> On 05/07/2014 07:34 AM, bugzilla-daemon at freedesktop.org wrote:
> > *Comment # 5 <https://bugs.freedesktop.org/show_bug.cgi?id=58727#c5> on
> > bug 58727 <https://bugs.freedesktop.org/show_bug.cgi?id=58727> from
> > Daniel Macks <mailto:dmacks at netspace.org> *
> >
> > Thinking slightly more philosophically, do those functions really need to be
> > (warn_unused_result)? Or, if it's important not to ignore the result, why are
> > we ignoring the result?
> >
> > ------------------------------------------------------------------------
> > You are receiving this mail because:
> >
> >   * You are watching the QA Contact of the bug.
> >

-- 
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/1d9e7260/attachment.html>


More information about the cairo-bugs mailing list