Re: [PATCH] fast-import.c: Silence build warning
From: Stephen Boyd <hidden>
Date: 2016-06-15 22:47:20
Michael Wookey wrote:
2009/9/1 Junio C Hamano [off-list ref]:quoted
Isn't this typically done by casting the expression to (void)?I originally tried that - the compiler still complains.quoted
Otherwise a clever compiler has every right to complain "the variable unused is assigned but never used.I get no other warnings, so does that make gcc less than clever? ;-)
I noticed this warning recently too when I upgraded my box and a flurry of fwrite() unused warnings came up. Looks like ubuntu patches that issue[1] by arguing it's a valid programming style to fwrite/fflush/ferror. Perhaps this programming style could follow a similar reasoning? It gets better though. Commit c55fae4 (fast-import.c: stricter strtoul check, silence compiler warning, 2008-12-21) made this change already. Then commit eb3a9dd (Remove unused function scope local variables, 2009-03-07) came by and removed it. Unless the definition of strtoul drops the attribute I fear we'll keep going back and forth. -- Footnotes -- [1] https://lists.ubuntu.com/archives/ubuntu-devel/2009-March/027832.html