git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Michael WookeyNext: Alex Riesen
Message 8 of 9 in “fast-import.c: Silence build warning”
  1. fast-import.c: Silence build warningMichael Wookey, Aug 31, 2009
  2. Sverre RabbelierAug 31, 2009
  3. Alex RiesenAug 31, 2009
  4. Sverre RabbelierAug 31, 2009
  5. Michael WookeyAug 31, 2009
  6. Junio C HamanoAug 31, 2009
  7. Michael WookeyAug 31, 2009
  8. Stephen BoydSep 1, 2009
  9. Alex RiesenSep 1, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.