<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#c3">Comment # 3</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:spitzak@gmail.com" title="Bill Spitzak <spitzak@gmail.com>"> <span class="fn">Bill Spitzak</span></a>
</span></b>
<pre>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;
}
On 05/06/2014 07:20 AM, <a href="mailto:bugzilla-daemon@freedesktop.org">bugzilla-daemon@freedesktop.org</a> wrote:
<span class="quote">> *<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>> *</span >
>
<span class="quote">> 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:</span >
>
<span class="quote">> int unused;
> unused=some_function_with_attribute_wur(foo);
> (void) unused;</span >
>
<span class="quote">> Just:</span >
>
<span class="quote">> (void) some_function_with_attribute_wur(foo);</span >
>
<span class="quote">> ------------------------------------------------------------------------
> You are receiving this mail because:</span >
>
<span class="quote">> * 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>