From: Stephen Boyd Date: Tue, 01 Sep 2009 04:06:12 GMT Subject: Re: [PATCH] fast-import.c: Silence build warning Message-ID: <4A9C9DB4.8070702@gmail.com> In-Reply-To: Michael Wookey wrote: > 2009/9/1 Junio C Hamano : >> 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