<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - warn_unused_result noise"
href="https://bugs.freedesktop.org/show_bug.cgi?id=58727#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - warn_unused_result noise"
href="https://bugs.freedesktop.org/show_bug.cgi?id=58727">bug 58727</a>
from <span class="vcard"><a class="email" href="mailto:nravi.n@samsung.com" title="Ravi Nanjundappa <nravi.n@samsung.com>"> <span class="fn">Ravi Nanjundappa</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=58727#c3">comment #3</a>)
<span class="quote">> Oh god those gnu-idiots!
>
> I tried it and in fact the multi-line workaround is the only thing that
> works. Or a wrapper function. Compile the following with -Wall:
>
> int fn () __attribute__ ((warn_unused_result));
>
> int used(int i) { return i; }
>
> int main(int argc, const char** argv)
> {
> int a, b;
> fn(); /* produces error! */
> (void)fn(); /* produces error! This used to work!*/
> a = fn(); /* produces warning that a is unused */
> b = fn(); (void)b; /* this works */
> used(fn()); /* this also works */
> return 0;
> }
> </span >
Agreed. But in the wrapper function approach, we will have to change the
declarations of all the cairo functions, for which the return values are really
not used anywhere.
<span class="quote">>
> On 05/06/2014 07:20 AM, <a href="mailto:bugzilla-daemon@freedesktop.org">bugzilla-daemon@freedesktop.org</a> wrote:
> > *<a href="show_bug.cgi?id=58727#c2">Comment # 2</a> <<a class="bz_bug_link
bz_status_NEW "
title="NEW --- - warn_unused_result noise"
href="show_bug.cgi?id=58727#c2">https://bugs.freedesktop.org/show_bug.cgi?id=58727#c2</a>> on
> > <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - warn_unused_result noise"
href="show_bug.cgi?id=58727">bug 58727</a> <<a class="bz_bug_link
bz_status_NEW "
title="NEW --- - warn_unused_result noise"
href="show_bug.cgi?id=58727">https://bugs.freedesktop.org/show_bug.cgi?id=58727</a>> from
> > Daniel Macks <<a href="mailto:dmacks@netspace.org">mailto:dmacks@netspace.org</a>> *
> >
> > I'm not a machine with compilers right now to test, but you cast the
> > function-call to void rather than assigning to a temp-variable? Instead of:
> >
> > int unused;
> > unused=some_function_with_attribute_wur(foo);
> > (void) unused;
> >
> > Just:
> >
> > (void) some_function_with_attribute_wur(foo);
> >
> > ------------------------------------------------------------------------
> > You are receiving this mail because:
> >
> > * You are watching the QA Contact of the bug.
> ></span ></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>