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/