drop some obsolete "x = x" compiler warning hacks
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>
Jeff King committed
Mar 21, 2013 at 07:10 UTC
cbfd5e1cbb539b82a34195efd0edde20d45a6439
2 files changed
+2
-2
builtin/cat-file.c
+1
-1
@@ -193,7 +193,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
193
unsigned char sha1[20];
194
enum object_type type = 0;
195
unsigned long size;
196
- void *contents = contents;
196
+ void *contents;
197
198
if (!obj_name)
199
return 1;
fast-import.c
+1
-1
@@ -2434,7 +2434,7 @@ static void note_change_n(struct branch *b, unsigned char *old_fanout)
2434
{
2435
const char *p = command_buf.buf + 2;
2436
static struct strbuf uq = STRBUF_INIT;
2437
- struct object_entry *oe = oe;
2437
+ struct object_entry *oe;
2438
struct branch *s;
2439
unsigned char sha1[20], commit_sha1[20];
2440
char path[60];