Hi,

On Fri, Jun 17, 2011 at 5:46 AM, Matthew Dempsky <[email protected]> wrote:
> So there's this isomorphism entry in standard.iso:
>
> <<<<<<<<
> Expression
> @ fld_to_ptr @
> type T;
> pure T E;
> pure T *E1;
> identifier fld;
> @@
>
> E.fld => E1->fld
>>>>>>>>>
>
> However, when I apply this patch:
>
> <<<<<<<<
> @@
> struct bar1 b;
> @@
> -       b.x = 7;
> +       b.x = 42;

It works as intented with

@@
struct bar1 b;
@@
        b.x =
-        7
+       42


>
> @@
> struct bar2 *b;
> @@
> -       b->x = 7;
> +       b->x = 42;
>>>>>>>>>
>
> to this source file:
>
> <<<<<<<<
> struct bar1 { int x; };
> struct bar2 { int x; };
>
> void foo()
> {
>  struct bar1 b1, *b1p = &b1;
>  struct bar2 b2, *b2p = &b2;
>
>  b1.x = 7;
>  b1p->x = 7;
>  b2.x = 7;
>  b2p->x = 7;
> }
>>>>>>>>>
>
> I get this output:
>
> <<<<<<<<
> --- beep.c      2011-06-16 20:05:36.043895682 -0700
> +++ /tmp/cocci-output-16053-12cb3c-beep.c       2011-06-16 20:17:07.143132324 
> -0700
> @@ -6,8 +6,8 @@ void foo()
>   struct bar1 b1, *b1p = &b1;
>   struct bar2 b2, *b2p = &b2;
>
> -  b1.x = 7;
> +  b1.x = 42;
>   b1p->x = 7;
>   b2.x = 7;
> -  b2p->x = 7;
> +  b2p->x = 42;
>  }
>>>>>>>>>
>
> I expect I'm missing something simple, but shouldn't at least three of
> the assignments change?
> _______________________________________________
> Cocci mailing list
> [email protected]
> http://lists.diku.dk/mailman/listinfo/cocci
> (Web access from inside DIKUs LAN only)
>



-- 
Nicolas Palix
http://sardes.inrialpes.fr/~npalix/
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to