On Fri, 4 Dec 2015, SF Markus Elfring wrote:

> > virtual context
> >
> > @ is_tty @
> > identifier fops;
> > @@
> > struct tty_operations fops = {
> > };
> >
> > @ tty_has_cleanup depends on is_tty @
> > identifier is_tty.fops;
> > identifier fn;
> > @@
> > struct tty_operations fops = {
> >         .cleanup = fn,
> > };
> >
> > @ depends on is_tty && !tty_has_cleanup && context @
> > identifier is_tty.fops;
> > @@
> > * struct tty_operations fops = {
> > };
>
> How do you think about a SmPL approach like the following?
>
>
> virtual show_context_diff
>
> @contains_member_functions@
> identifier var;
> struct operations =~ "^(?x)
> (?:
>    \w+_operations
> |
>    (?:
> # Alternation placeholder
>    )
> )$";
> @@
>  operations var = { ... };
>
> @contains_cleanup_function
>  contains_member_functions@
> expression assign;
> identifier release =~ "^(?x)
> (?:
>    cleanup
> |
>    (?:
> # Another alternation placeholder
>    )
> )$",
>            contains_member_functions.var;
> type contains_member_functions.operations;
> @@
>  operations var = { ...,
>                     .cleanup = (assign),
>                     ...
>                   };
>
> @show_member_functions
>  depends on show_context_diff
>             && contains_member_functions
>             && !contains_cleanup_function@
> identifier contains_member_functions.var;
> struct contains_member_functions.operations;
> @@
> *operations var = { ... };
>
>
> Would this SmPL script variant need any further fine-tuning
> (or other software extensions)?

I have no idea what the above does.  The previous proposed variants were
completely fine.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to