On Sun, Jun 29, 2014 at 8:25 PM, Joe Perches wrote:
> I think I've seen code in the kernel like
> char *p2 = (void *)p;
> where p is const and p2 is dereferenced and set.
I can imagine there's code like that.
Still hoping for gcc to gain an option to warn about all casts, except in heade
On Sun, 2014-06-29 at 18:34 +0200, Julia Lawall wrote:
> On Thu, 26 Jun 2014, Joe Perches wrote:
> > void func(const void * const p)
> > {
> > char *p2 = p;
> >
> > p2[0] = 1;
> > }
>
> Is this a real example?
No, it's not.
I think I've seen code in the kernel like
char *p2 = (v
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 m
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 mi
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
On Thu, 26 Jun 2014, Joe Perches wrote:
> On Thu, 2014-06-26 at 22:58 +0530, Himangi Saraogi wrote:
> > This patch removes the cast on data of type void* as it is not needed.
>
> Hi Himangi
>
> The cast of a const void * to a void * was odd.
>
> Maybe a mechanism to verify appropriateness of
On Thu, 26 Jun 2014, Himangi Saraogi wrote:
> This patch removes the cast on data of type void* as it is not needed.
> The following Coccinelle semantic patch was used for making the change:
>
> @r@
> expression x;
> void* e;
> type T;
> identifier f;
> @@
>
> (
> *((T *)e)
> |
> ((T *)x)[..
On Thu, 2014-06-26 at 22:58 +0530, Himangi Saraogi wrote:
> This patch removes the cast on data of type void* as it is not needed.
Hi Himangi
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.
--
To
This patch removes the cast on data of type void* as it is not needed.
The following Coccinelle semantic patch was used for making the change:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T *)x)->f
|
- (T *)
e
)
Signed-off-by: Himangi Saraogi
Acked
9 matches
Mail list logo