Re: [PATCH] Fix some sparse warnings

2013-07-21 Thread Ramsay Jones
Jeff King wrote: On Thu, Jul 18, 2013 at 09:25:50PM +0100, Ramsay Jones wrote: Sparse issues some Using plain integer as NULL pointer warnings. Each warning relates to the use of an '{0}' initialiser expression in the declaration of an 'struct object_info'. The first field of this structure

Re: [PATCH] Fix some sparse warnings

2013-07-21 Thread Junio C Hamano
Jonathan Nieder jrnie...@gmail.com writes: How about something like the following? diff --git i/cache.h w/cache.h index f2915509..ba028b75 100644 --- i/cache.h +++ w/cache.h @@ -1124,6 +1124,7 @@ struct object_info { } packed; } u; }; +#define OBJECT_INFO_INIT {

Re: [PATCH] Fix some sparse warnings

2013-07-18 Thread Ramsay Jones
Jeff King wrote: On Tue, Jul 16, 2013 at 07:57:20AM +0200, Johannes Sixt wrote: Am 7/15/2013 19:31, schrieb Ramsay Jones: Sparse issues three Using plain integer as NULL pointer warnings. Each warning relates to the use of an '{0}' initialiser expression in the declaration of an 'struct

Re: [PATCH] Fix some sparse warnings

2013-07-17 Thread Stefan Beller
On 07/16/2013 10:53 PM, Philip Oakley wrote: Does anyone run the new static checker called 'Stack' that precisely identifies unstable code? [though the paper's conclusion says 'All Stack source code will be publicly available.' which suggests it's not yet available] So I started using the

Re: [PATCH] Fix some sparse warnings

2013-07-17 Thread Stefan Beller
On 07/18/2013 12:08 AM, Stefan Beller wrote: So I started using the clang code analyzer on git. One of the first warnings actually is this: So in case somebody else would also like to play around with the clang static code analyzer: # get clang: cd good location git clone

Re: [PATCH] Fix some sparse warnings

2013-07-17 Thread Junio C Hamano
Stefan Beller stefanbel...@googlemail.com writes: And the parse_object_buffer looks like this with respect to the eaten variable: struct object *parse_object_buffer(...) { int eaten = 0; if (something) return NULL;

Re: [PATCH] Fix some sparse warnings

2013-07-16 Thread Jeff King
On Tue, Jul 16, 2013 at 07:57:20AM +0200, Johannes Sixt wrote: Am 7/15/2013 19:31, schrieb Ramsay Jones: Sparse issues three Using plain integer as NULL pointer warnings. Each warning relates to the use of an '{0}' initialiser expression in the declaration of an 'struct object_info'. I

Re: [PATCH] Fix some sparse warnings

2013-07-16 Thread Philip Oakley
From: Jeff King p...@peff.net Sent: Tuesday, July 16, 2013 7:21 AM On Tue, Jul 16, 2013 at 07:57:20AM +0200, Johannes Sixt wrote: Am 7/15/2013 19:31, schrieb Ramsay Jones: Sparse issues three Using plain integer as NULL pointer warnings. Each warning relates to the use of an '{0}'

Re: [PATCH] Fix some sparse warnings

2013-07-16 Thread Stefan Beller
On 07/16/2013 10:53 PM, Philip Oakley wrote: From: Jeff King p...@peff.net Sent: Tuesday, July 16, 2013 7:21 AM On Tue, Jul 16, 2013 at 07:57:20AM +0200, Johannes Sixt wrote: Am 7/15/2013 19:31, schrieb Ramsay Jones: Sparse issues three Using plain integer as NULL pointer warnings. Each

Re: [PATCH] Fix some sparse warnings

2013-07-16 Thread Philip Oakley
On 16/07/13 22:18, Stefan Beller wrote: On 07/16/2013 10:53 PM, Philip Oakley wrote: From: Jeff King p...@peff.net Sent: Tuesday, July 16, 2013 7:21 AM On Tue, Jul 16, 2013 at 07:57:20AM +0200, Johannes Sixt wrote: Am 7/15/2013 19:31, schrieb Ramsay Jones: Sparse issues three Using plain

Re: [PATCH] Fix some sparse warnings

2013-07-16 Thread Johannes Sixt
I question the value of this warning. Initialization with '= {0}' is a well-established idiom, and sparse should know about it. Thanks everyone for your feedback. But I really wanted to call only the warning in the case of the '= {0}' idiom into question, not about 0 vs. NULL in general. --

[PATCH] Fix some sparse warnings

2013-07-15 Thread Ramsay Jones
Sparse issues three Using plain integer as NULL pointer warnings. Each warning relates to the use of an '{0}' initialiser expression in the declaration of an 'struct object_info'. The first field of this structure has pointer type. Thus, in order to suppress these warnings, we replace the

Re: [PATCH] Fix some sparse warnings

2013-07-15 Thread Johannes Sixt
Am 7/15/2013 19:31, schrieb Ramsay Jones: Sparse issues three Using plain integer as NULL pointer warnings. Each warning relates to the use of an '{0}' initialiser expression in the declaration of an 'struct object_info'. I question the value of this warning. Initialization with '= {0}' is a