Re: [PATCH] fast-import.c: Silence build warning
- From
Stephen Boyd <bebarino@gmail.com>
- Date
- Sep 1, 2009, 04:06 UTC
- Message-ID
- <4A9C9DB4.8070702@gmail.com>
- In-Reply-To
- <d2e97e800908311655t553d6c4bo6ed45fe37819c1d8@mail.gmail.com>
Michael Wookey wrote:
Show 9 quoted lines
> 2009/9/1 Junio C Hamano <gitster@pobox.com>: >> Isn't this typically done by casting the expression to (void)? > > I originally tried that - the compiler still complains. > >> 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