Re: [PATCH] Fix some sparse warnings

2013-07-21 Thread Junio C Hamano
Jonathan Nieder 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 { NULL, NULL

Re: [PATCH] Fix some sparse warnings

2013-07-21 Thread Jonathan Nieder
Hi, 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 has pointer type. Thus, in order to suppress these

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 >> thi

Re: [PATCH] Fix some sparse warnings

2013-07-18 Thread Jeff King
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 has pointer t

[PATCH] Fix some sparse warnings

2013-07-18 Thread Ramsay Jones
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 has pointer type. Thus, in order to suppress these warnings, we replace the initial

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

Re: [PATCH] Fix some sparse warnings

2013-07-17 Thread Junio C Hamano
Stefan Beller 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-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 git clone http://llvm.org/git/llvm.g

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 us

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 gen

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" 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 NU

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" > 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. >>> >

Re: [PATCH] Fix some sparse warnings

2013-07-16 Thread Philip Oakley
From: "Jeff King" 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}' initialiser expres

Re: [PATCH] Fix some sparse warnings

2013-07-15 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

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

[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 initia