Re: [Cocci] spatch for trivial pointer comparison style?

2014-11-14 Thread Julia Lawall
On Fri, 14 Nov 2014, Joe Perches wrote: > On Fri, 2014-11-14 at 10:18 +0100, Julia Lawall wrote: > > On Thu, 13 Nov 2014, Joe Perches wrote: > [] > > > Yes, I agree with some of the things Al Viro said > > > there, but isn't 'type t; t *p;' a subset of > > > "expression *e"? > > > No. How would

Re: [Cocci] spatch for trivial pointer comparison style?

2014-11-14 Thread Joe Perches
On Fri, 2014-11-14 at 10:18 +0100, Julia Lawall wrote: > On Thu, 13 Nov 2014, Joe Perches wrote: [] > > Yes, I agree with some of the things Al Viro said > > there, but isn't 'type t; t *p;' a subset of > > "expression *e"? > No. How would you expect it to be different. [] > type t means that

Re: [Cocci] spatch for trivial pointer comparison style?

2014-11-14 Thread Julia Lawall
On Fri, 14 Nov 2014, SF Markus Elfring wrote: > > I don't think that the change is desirable in all cases. There are > > functions like kmalloc where NULL means failure and !p seems like the > > reasonable choice. But there maybe other cases where NULL is somehow > > a meaningful value. > > How

Re: [Cocci] spatch for trivial pointer comparison style?

2014-11-14 Thread SF Markus Elfring
> I don't think that the change is desirable in all cases. There are > functions like kmalloc where NULL means failure and !p seems like the > reasonable choice. But there maybe other cases where NULL is somehow > a meaningful value. How do you think about to adjust checks for null pointers not

Re: [Cocci] spatch for trivial pointer comparison style?

2014-11-14 Thread Julia Lawall
On Thu, 13 Nov 2014, Joe Perches wrote: > On Fri, 2014-11-14 at 07:06 +0100, Julia Lawall wrote: > > On Thu, 13 Nov 2014, Joe Perches wrote: > > > > > I added a checkpatch entry for this. > > > Maybe some cocci test like this would be useful? > > > > > > @@ > > > type t; > > > t *p; > > > @@ > >

Re: [Cocci] spatch for trivial pointer comparison style?

2014-11-13 Thread Joe Perches
On Fri, 2014-11-14 at 07:06 +0100, Julia Lawall wrote: > On Thu, 13 Nov 2014, Joe Perches wrote: > > > I added a checkpatch entry for this. > > Maybe some cocci test like this would be useful? > > > > @@ > > type t; > > t *p; > > @@ > > - p == NULL > > + !p > > > > @@ > > type t; > > t *p; >

Re: [Cocci] spatch for trivial pointer comparison style?

2014-11-13 Thread Julia Lawall
On Thu, 13 Nov 2014, Joe Perches wrote: > I added a checkpatch entry for this. > Maybe some cocci test like this would be useful? > > @@ > type t; > t *p; > @@ > - p == NULL > + !p > > @@ > type t; > t *p; > @@ > - p != NULL > + p > > @@ > type t; > t *p; > @@ > - NULL == p