Messages in this thread | | | Date | Sun, 1 Oct 2023 21:14:02 +0200 (CEST) | From | Julia Lawall <> | Subject | Re: [PATCH] comedi: Annotate struct comedi_lrange with __counted_by |
| |
Kees,
You can try the following.
julia
#spatch --all-includes
@r@ identifier i,j; type T; @@
struct i { ... T j[]; }
@s@ identifier r.i; constant ini; identifier j; initializer list [n] is2; position p; identifier x; @@
struct i@p x = { ..., .j = ini, ..., { is2 } } ;
@script:ocaml@ ini << s.ini; i << r.i; j << s.j; n << s.n; p << s.p; @@
try let ini = int_of_string ini in if n = ini then Printf.printf "%s:%d: struct %s: field %s is the counter for the flex array\n" (List.hd p).file (List.hd p).line i j with _-> () (* not an explicit integer *)
@s2@ identifier r.i; constant ini; initializer list [n] is; initializer list [n2] is2; position p; identifier x; @@
struct i@p x = { is, ini, ..., { is2 } };
@script:ocaml@ ini << s2.ini; i << r.i; n << s2.n; n2 << s2.n2; p << s2.p; @@
try let ini = int_of_string ini in if n2 = ini then Printf.printf "%s:%d: struct %s: field at offset %d is the counter for the flex array\n" (List.hd p).file (List.hd p).line i n with _-> () (* not an explicit integer *)
| |