> If you pull Coccinelle from github, you will be able to write the following.
I am curious how the support will evolve further for scripted SmPL constraints.
> The second scriptcan use ocaml or python as you like.
How do you think about to clarify the following SmPL rule variant?
@addition@
km;
comments tag : script:ocaml ()
{
let (_, _, ca) = List.hd tag in
match ca with
[] -> false
| _ -> let xa = String.concat "" ca in
if Str.string_match (Str.regexp "kmap compat: \(KM_USER[01]\)") xa 2
then km := make_ident (Str.matched_group 1 xa); true
else false
};
expression context;
identifier fn;
@@
fn(...)@tag
{
<+...
(kmap_atomic
|kunmap_atomic
)(context
+, km
)
...+>
}
int foo()
/* kmap compat: KM_USER0 */
{
void *addr = kmap_atomic(page);
// ...
kunmap_atomic(addr);
}
Can such a data processing approach ever work in the shown direction?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci