Do you want to put them in the when clauses?
If so, go ahead.
Do I make a mistake in the following example?
elfring@Sonne:~/Projekte/Coccinelle/Probe> P=../my_pattern.cocci && cat $P &&
echo '-----' && spatch -sp_file $P Cstdlib-test1.c -I /usr/include
@r@
identifier f;
@@
f(...);
@is_void@
identifier r.f;
@@
void f(...);
@is_assigned@
position p;
expression f, x, y;
statement S1, S2, S3, S4, S5;
@@
y@p = x(...);
... when != if (<+...y...+>) S1 else S2
when != f(...,(<+...y...+>),...)
when != for (...;<+...y...+>;...) S3
when != while (<+...y...+>) S4
when != do S5 while (<+...y...+>)
when != switch (<+...y...+>) { case ... : ... }
when != (<+...y...+>) ? ... : ...
@@
position p != is_assigned.p;
expression x, y;
@@
*y@p = x(...);
@depends on !is_void@
identifier r.f, g;
@@
g(...)
{<+...
* f(...);
...+>}
-----
init_defs_builtins: /usr/share/coccinelle/standard.h
331 335
Fatal error: exception Failure("minus: parse error:
= File "../my_pattern.cocci", line 21, column 5, charpos = 331
around = 'when', whole content = when != do S5 while (<+...y...+>)
")
There is no reason why a function would be more or less likely to do something
useful with the values.
I would like to distinguish function implementations from the feature if they
perform appropriate input parameter validation.
A few functions are well-known that they forward just an input parameter as
their return value.
How should the functions be filtered from the source code where additional
checks are needed before a call?
Does a SmPL when clause need any fine-tuning for such a constraint?
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)