On Sun, 13 Mar 2011, ygrek wrote:

> On Fri, 11 Mar 2011 23:29:52 +0100 (CET)
> Julia Lawall <[email protected]> wrote:
> 
> > > Indeed, generating isomorphisms should be easy. But another thing that I 
> > > don't like is the need to
> > > write 'using "caml.iso"' in every rule :(
> > 
> > You can put it on the command line: -iso_file caml.iso
> 
> If I read the manual correctly it will replace standard isomorphisms..

Yes, good point.

> > No, I don't think so.  You can just make pattern for what you don't want 
> > and another for what you do want:
> 
> Yes, that works, thank you.
>  
> One more question, can I tell spatch to always expand certain macros? Or 
> teach it any other way
> that 
>  CAMLlocal1(v);
> is equivalent to
>  value v;
> cause otherwise it sometimes assumes (I guess) that v is a global variable 
> and wrecks havoc when it matches
> the name of local variable in another function.. I tried specifying it via 
> Declaration or Statement isomorphism
> but failed.

Create a file called macros.h and put in it

#define CAMLlocal1(v) value v

> Another minor question :
> 
> @@
> expression N, VAL;
> expression alloc.tuple;
> @@
> (
> - Field(tuple, N) = VAL
> + Store_field(tuple, N, VAL)
> |
> - Store_double_field(tuple, N, VAL)
> + Store_field(tuple, N, VAL)
> )
> 
> The above patch is accepted, while next one is not - is this expected? 
> (probably not as exception is not caught)

Yes, it is expected.  + code has to attach to something, and it can't 
attach to the ) of a disjunction.

julia

> @@
> expression N, VAL;
> expression alloc.tuple;
> @@
> (
> - Field(tuple, N) = VAL
> |
> - Store_double_field(tuple, N, VAL)
> )
> + Store_field(tuple, N, VAL)
> 
> Backtrace with OCAMLRUNPARAM=b :
> 
> Fatal error: exception Failure("75: no available token to attach to")
> Raised at file "pervasives.ml", line 22, characters 22-33
> Called from file "list.ml", line 69, characters 12-15
> Called from file "insert_plus.ml", line 1089, characters 2-32
> Called from file "parse_cocci.ml", line 1936, characters 13-59
> Called from file "list.ml", line 57, characters 20-23
> Called from file "list.ml", line 57, characters 32-39
> Called from file "list.ml", line 57, characters 32-39
> Called from file "list.ml", line 57, characters 32-39
> Called from file "list.ml", line 57, characters 32-39
> Called from file "list.ml", line 57, characters 32-39
> Called from file "parse_cocci.ml", line 1861, characters 4-1023
> Called from file "cocci.ml", line 96, characters 34-68
> Called from file "common.ml", line 1292, characters 12-16
> Called from file "cocci.ml", line 1755, characters 6-34
> Called from file "main.ml", line 940, characters 7-54
> Called from file "main.ml", line 938, characters 10-1023
> Called from file "main.ml", line 1082, characters 4-1023
> Called from file "main.ml", line 1169, characters 6-13
> Called from file "main.ml", line 1183, characters 4-36
> Called from file "common.ml", line 1115, characters 45-48
> Called from file "common.ml", line 173, characters 14-18
> Re-raised at file "common.ml", line 178, characters 10-11
> Called from file "common.ml", line 3586, characters 6-9
> Called from file "main.ml", line 1182, characters 2-118
> 
> -- 
>  ygrek
>  http://ygrek.org.ua/
> 
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to