Re: [PATCH 2/2] cat-file: Fix an gcc -Wuninitialized warning

2013-03-28 Thread Jonathan Nieder
Jeff King wrote: > When we can make the code more readable _and_ help the compiler, I think > it is a no-brainer. Yep. :) -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordom

Re: [PATCH 2/2] cat-file: Fix an gcc -Wuninitialized warning

2013-03-28 Thread Jeff King
On Thu, Mar 28, 2013 at 06:48:43PM +, Ramsay Jones wrote: > > I'm OK with this, if it's the direction we want to go. But I thought the > > discussion kind of ended as "we do not care about these warnings on > > ancient versions of gcc; those people should use -Wno-error=uninitialized". > > Hm

Re: [PATCH 2/2] cat-file: Fix an gcc -Wuninitialized warning

2013-03-28 Thread Ramsay Jones
Jeff King wrote: > On Tue, Mar 26, 2013 at 07:20:11PM +, Ramsay Jones wrote: > >> After commit cbfd5e1c ("drop some obsolete "x = x" compiler warning >> hacks", 21-03-2013) removed a gcc specific hack, older versions of >> gcc now issue an "'contents' might be used uninitialized" warning. >> I

Re: [PATCH 2/2] cat-file: Fix an gcc -Wuninitialized warning

2013-03-26 Thread Jeff King
On Tue, Mar 26, 2013 at 03:35:39PM -0400, Jeff King wrote: > I note that we do not actually check that contents != NULL after calling > read_sha1_file, either (nor that sha1_object_info does not return an > error). I suspect cat-file could segfault under the right conditions. Oh nevermind, we do.

Re: [PATCH 2/2] cat-file: Fix an gcc -Wuninitialized warning

2013-03-26 Thread Jeff King
On Tue, Mar 26, 2013 at 07:20:11PM +, Ramsay Jones wrote: > After commit cbfd5e1c ("drop some obsolete "x = x" compiler warning > hacks", 21-03-2013) removed a gcc specific hack, older versions of > gcc now issue an "'contents' might be used uninitialized" warning. > In order to suppress the w

[PATCH 2/2] cat-file: Fix an gcc -Wuninitialized warning

2013-03-26 Thread Ramsay Jones
After commit cbfd5e1c ("drop some obsolete "x = x" compiler warning hacks", 21-03-2013) removed a gcc specific hack, older versions of gcc now issue an "'contents' might be used uninitialized" warning. In order to suppress the warning, we simply initialize the variable to NULL in it's declaration.