> Have a special rule for such functions and use position variables to
> prevent the rule that matches interesting parameter lists from matching
> functions that have satisfied this case:
I have adjusted your suggestion a little bit here.
@no_input@
identifier fun;
position pos;
@@
fun@pos(void) { ... }
@input depends on no_input@
identifier fun;
parameter list [count] pl;
position pos != no_input.pos;
@@
fun@pos(pl) { ... }
@script:python collection depends on input@
fun << input.fun;
count << input.count;
places << input.pos;
@@
store_positions(fun, count, places)
This pattern variant works as expected for a source code example that was
already mentioned before.
elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch.opt --sp-file
list_function_parameters2.cocci ../Probe/f-ptr-test1.c
init_defs_builtins: /usr/local/share/coccinelle/standard.h
HANDLING: ../Probe/f-ptr-test1.c
function|"parameter count"|"source file"|line|column
my_log|1|"../Probe/f-ptr-test1.c"|1|6
my_safe_log|1|"../Probe/f-ptr-test1.c"|6|5
my_addition|2|"../Probe/f-ptr-test1.c"|25|5
But I wonder about the processing for the following small source file.
void my_log(char const * format, ...)
{
/* Write something ... */
}
elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch.opt --sp-file
list_function_parameters2.cocci ../Probe/ellipsis-test1.c
init_defs_builtins: /usr/local/share/coccinelle/standard.h
HANDLING: ../Probe/ellipsis-test1.c
No result for this analysis!
I would appreciate your advices.
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci