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

Re: [PATCH v2] Detailed diagnosis when parsing an object name fails.

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Dec 7, 2009, 10:07 UTC
Message-ID
<vpqws0zcd1c.fsf@bauges.imag.fr>
In-Reply-To
<7vk4wz9rbt.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>
> The second round still had a few compilation warnings (turned to errors in
> my environment) so I fixed them up somewhat.

Thanks. For some reasons, I had CFLAGS=-g and I didn't see the warnings :-(

Show 5 quoted lines
> I stopped before getting a
> clean compile, though---you will still get:
>
>   sha1_name.c: In function 'get_sha1_with_mode_1':
>   sha1_name.c:956: error: 'object_name' may be used uninitialized in this function

This one is strange. I don't git it with gcc 4.4, even with -Wall -Werror. And indeed, object_name is initialized when !gently, which is precisely when we use it.

I did
-               char *object_name;
+               char *object_name = NULL;

to make sure the warning goes away on your machine, but I don't understand what's going on.

>  cache.h     |    4 ++--
>  sha1_name.c |    2 +-

Squashed into v3, together with initialisation of object_name, and two s/int/unsigned/ to please gcc -Wextra.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Junio C HamanoNext: Matthieu Moy
Message 7 of 9 in “Detailed diagnosis when parsing an object name fails.”
  1. Detailed diagnosis when parsing an object name fails.y@imag.fr, Dec 2, 2009
  2. Junio C HamanoDec 3, 2009
  3. Matthieu MoyDec 6, 2009
  4. Detailed diagnosis when parsing an object name fails.Matthieu Moy, Dec 6, 2009
  5. Junio C HamanoDec 7, 2009
  6. Junio C HamanoDec 7, 2009
  7. Matthieu MoyDec 7, 2009
  8. Detailed diagnosis when parsing an object name fails.Matthieu Moy, Dec 7, 2009
  9. Sverre RabbelierFeb 15, 2010

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.