drop some obsolete "x = x" compiler warning hacks
authorJeff King <peff@peff.net>
Thu, 21 Mar 2013 11:10:28 +0000 (07:10 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 21 Mar 2013 21:06:38 +0000 (14:06 -0700)
In cases where the setting and access of a variable are
protected by the same conditional flag, older versions of
gcc would generate a "might be used unitialized" warning. We
silence the warning by initializing the variable to itself,
a hack that gcc recognizes.

Modern versions of gcc are smart enough to get this right,
going back to at least version 4.3.5. gcc 4.1 does get it
wrong in both cases, but is sufficiently old that we
probably don't need to care about it anymore.

Signed-off-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/cat-file.c
fast-import.c
index 00528ddc389212f045a7718ba55a26d723927f06..ad290007363120062b044ecb47cf976dbe118384 100644 (file)
@@ -193,7 +193,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
        unsigned char sha1[20];
        enum object_type type = 0;
        unsigned long size;
-       void *contents = contents;
+       void *contents;
 
        if (!obj_name)
           return 1;
index 583a439dbac4191c8792a29825a13eb28a07031e..e12a8b88ee842dac49a38d640817395cb3b98b28 100644 (file)
@@ -2434,7 +2434,7 @@ static void note_change_n(struct branch *b, unsigned char *old_fanout)
 {
        const char *p = command_buf.buf + 2;
        static struct strbuf uq = STRBUF_INIT;
-       struct object_entry *oe = oe;
+       struct object_entry *oe;
        struct branch *s;
        unsigned char sha1[20], commit_sha1[20];
        char path[60];