Re: [PATCH] HID: roccat: Drop cast

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, 26 Jun 2014, Joe Perches wrote:

> On Fri, 2014-06-27 at 07:29 +0200, Julia Lawall wrote:
> > On Thu, 26 Jun 2014, Joe Perches wrote:
> > > The cast of a const void * to a void * was odd.
> > > 
> > > Maybe a mechanism to verify appropriateness of
> > > loss of constness for any pointer might be useful.
> > 
> > I tried the following, but didn't find anything interesting:
> > 
> > @disable drop_cast@
> > type T;
> > const T e;
> > @@
> > 
> > * (T)e
> 
> What code does this match?
> Do you have an example match?
> 
> This doesn't find a cast of a void type like:
> 
> void func(const void * const p)
> {
> 	char *p2 = p;
> 
> 	p2[0] = 1;
> }

Is this a real example?  Because gcc complains about this sort of problem.  
I made a semantic patch that detects this, but since gcc does the same 
thing, it doesn't seem very interesting.  Coccinelle gives a few false 
positives due to lack of type information.

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux