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

Re: read-cache-v5.c: compiler warnings

From
Thomas Gummerer <t.gummerer@gmail.com>
Date
Aug 20, 2012, 08:29 UTC
Message-ID
<20120820082854.GA10909@tommy-fedora>
In-Reply-To
<50313AEC.1060700@ramsay1.demon.co.uk>
On 08/19, Ramsay Jones wrote:
Show 15 quoted lines
> Hi Thomas,
> 
> Just an FYI; two out of the three gcc compilers I use (Linux, cygwin
> but not MingW), issue the following warnings:
> 
>         CC read-cache-v5.o
>     read-cache-v5.c: In function `write_index_v5':
>     read-cache-v5.c:1011: warning: 'dir' might be used uninitialized in this function
>     read-cache-v5.c:1012: warning: 'search' might be used uninitialized in this function
>     read-cache-v5.c:1012: warning: 'found' might be used uninitialized in this function
> 
> [commit d2537158 ("Write index-v5", 16-08-2012)]
> 
> Normally I would take a look and offer a patch, but I haven't found time
> to do so in the last 10 days. So, I'm just giving you a heads up ... ;-P

Thanks for noticing. This warnings only seem to be issued by older versions of gcc, which is probably why two compilers give the warnings while one doesn't.

The variables can never be uninitialized, because they are guarded by ifs and older versions don't seem to recognize that. I'll fix them in a re-roll though (or a separate patch if that's preferred), just waiting for some feedback for v4 of my series.

Show 6 quoted lines
> 
> HTH
> 
> ATB,
> Ramsay Jones
> 
Thomas
Previous: Ramsay JonesNext: Ramsay Jones
Message 2 of 3 in “read-cache-v5.c: compiler warnings”
  1. Ramsay JonesAug 19, 2012
  2. Thomas GummererAug 20, 2012
  3. Ramsay JonesAug 21, 2012

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.