[Cocci] Re: problems with typecasts

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu Mar 5 13:46:30 CET 2009


Hi,

sorry for posting an immediate followup, but I had some progress on
removing redundancies from the semantic patch. However, it seems I
misread the SmPL grammar somewhere because I now get an error from spatch:
Fatal error: exception Failure("minus: parse error:
 = File "writeb.cocci", line 21, column 0,  charpos = 197
    around = '|', whole content = |
")

Problematic semantic patch follows:
@@
expression a;
typedef uint8_t;
volatile uint8_t *b;
@@
- *b = a;
+ writeb(a, b);
@@
expression a;
volatile uint8_t *b;
@@
- a = *b;
+ a = readb(b);
@@
type T;
T b;
expression a;
@@
(
 writeb(a,
|
 a = readb(
)
-(T)
 b);
@@
expression a, b;
@@
(
 writeb(a,
|
 a = readb(
)
-(
 b
-)
 );

This happens with coccinelle 0.1.5. I can try other versions if that helps.

Regards,
Carl-Daniel

On 05.03.2009 12:59, Carl-Daniel Hailfinger wrote:
> Currently, the following semantic patch is used:
> @@
> expression a;
> typedef uint8_t;
> volatile uint8_t *b;
> @@
>
> - *b = a;
> + writeb(a, b);
>
> @@
> expression a;
> volatile uint8_t *b;
> @@
>
> - a = *b;
> + a = readb(b);
>
> @@
> type T;
> T b;
> expression a;
> @@
>  writeb(a,
> -(T)
>  b);
>
> @@
> type T;
> T b;
> expression a;
> @@
>  a = readb(
> -(T)
>  b);
>
> @@
> expression a, b;
> @@
>  writeb(a,
> -(
>  b
> -)
>  );
> @@
> expression a, b;
> @@
>  a = readb(
> -(
>  b
> -)
>  );
>
>   



More information about the Cocci mailing list