Re: [PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

2013-03-22 Thread Jeff King
On Thu, Mar 21, 2013 at 11:44:02AM -0400, Jeff King wrote: > > I am for dropping "= x" and leaving it uninitialized at the > > declaration site, or explicitly initializing it to some > > reasonable starting value (e.g. NULL if it is a pointer) and > > adding a comment to say that t

Re: [PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

2013-03-21 Thread Jonathan Nieder
Jeff King wrote: > Two patches to follow. > > [5/4]: fast-import: clarify "inline" logic in file_change_m This one is clearly a bug / missing feature in gcc's control flow analysis, but your workaround looks reasonable. > [6/4]: run-command: always set failed_errno in start_command Very san

Re: [PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

2013-03-21 Thread Jeff King
On Thu, Mar 21, 2013 at 08:19:43AM -0700, Junio C Hamano wrote: > > $ git grep '#define uninitialized_var' include/ > > include/linux/compiler-gcc.h:#define uninitialized_var(x) x = x > > include/linux/compiler-intel.h:#define uninitialized_var(x) x > > > > but they recently had a disc

Re: [PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

2013-03-21 Thread Junio C Hamano
Junio C Hamano writes: > Jeff King writes: > >> Git code was my introduction to it, too, and I was led to believe it was >> idiomatic, so I can't speak further on that. I think it was Junio who >> introduced me to it, so maybe he can shed more light on the history. > > I think we picked the conv

Re: [PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

2013-03-21 Thread Junio C Hamano
Jeff King writes: > Git code was my introduction to it, too, and I was led to believe it was > idiomatic, so I can't speak further on that. I think it was Junio who > introduced me to it, so maybe he can shed more light on the history. I think we picked the convention up from the kernel folks.

Re: [PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

2013-03-21 Thread Joachim Schmitz
Joachim Schmitz wrote: Johannes Sixt wrote: Am 3/21/2013 12:03, schrieb Jeff King: I was fooling around with clang and noticed that it complains about the "int x = x" construct under -Wall. That is IMHO a deficiency in clang, since the idiom has a well-defined use in silencing -Wuninitialized w

Re: [PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

2013-03-21 Thread Joachim Schmitz
Johannes Sixt wrote: Am 3/21/2013 12:03, schrieb Jeff King: I was fooling around with clang and noticed that it complains about the "int x = x" construct under -Wall. That is IMHO a deficiency in clang, since the idiom has a well-defined use in silencing -Wuninitialized warnings. IMO, that's a

Re: [PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

2013-03-21 Thread Jeff King
On Thu, Mar 21, 2013 at 12:45:37PM +0100, Johannes Sixt wrote: > Am 3/21/2013 12:03, schrieb Jeff King: > > I was fooling around with clang and noticed that it complains about the > > "int x = x" construct under -Wall. That is IMHO a deficiency in clang, > > since the idiom has a well-defined use

Re: [PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

2013-03-21 Thread Johannes Sixt
Am 3/21/2013 12:03, schrieb Jeff King: > I was fooling around with clang and noticed that it complains about the > "int x = x" construct under -Wall. That is IMHO a deficiency in clang, > since the idiom has a well-defined use in silencing -Wuninitialized > warnings. IMO, that's a myth. The constr

[PATCH 0/4] drop some "int x = x" hacks to silence gcc warnings

2013-03-21 Thread Jeff King
I was fooling around with clang and noticed that it complains about the "int x = x" construct under -Wall. That is IMHO a deficiency in clang, since the idiom has a well-defined use in silencing -Wuninitialized warnings. But I've also always been nervous about the idiom, because it's easy to get th