Skip to content

Commit cbfd5e1

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Reviewed-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4db34cc commit cbfd5e1

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

builtin/cat-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int batch_one_object(const char *obj_name, int print_contents)
193193
unsigned char sha1[20];
194194
enum object_type type = 0;
195195
unsigned long size;
196-
void *contents = contents;
196+
void *contents;
197197

198198
if (!obj_name)
199199
return 1;

fast-import.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,7 @@ static void note_change_n(struct branch *b, unsigned char *old_fanout)
24342434
{
24352435
const char *p = command_buf.buf + 2;
24362436
static struct strbuf uq = STRBUF_INIT;
2437-
struct object_entry *oe = oe;
2437+
struct object_entry *oe;
24382438
struct branch *s;
24392439
unsigned char sha1[20], commit_sha1[20];
24402440
char path[60];

0 commit comments

Comments
 (0)