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 <>
gcc 4.2 is conspicuously missing because no current Debian system even
has a backwards-compatibility package for it, making it harder to test.
And 4.3 was old enough for me to say "I do not care if you can run with
-Wall -Werror or not", let alone 4.2.

 builtin/cat-file.c | 2 +-
 fast-import.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index 00528dd..ad29000 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -193,7 +193,7 @@ static int batch_one_object(const char *obj_name, int 
        unsigned char sha1[20];
        enum object_type type = 0;
        unsigned long size;
-       void *contents = contents;
+       void *contents;
        if (!obj_name)
           return 1;
diff --git a/fast-import.c b/fast-import.c
index 583a439..e12a8b8 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -2434,7 +2434,7 @@ static void note_change_n(struct branch *b, unsigned char 
        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];

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to