Re: Coccinelle: semantic patch for missing of_node_put

From: Markus Elfring
Date: Tue Jun 04 2019 - 01:13:31 EST


> 2, A general method.
> We also try to get the list of functions to consider by writing a SmPL,
> but this method is not feasible at present, because it is not easy to parse the comment
> header information of these functions.

The situation was improved once more also for the Coccinelle software.
How do you think about to develop any more variants based on information
from a script (like the following) for the semantic patch language?

@initialize:python@
@@
import re, sys
filter = re.compile(" when done")

@find@
comments c;
identifier x;
type t;
@@
t@c x(...)
{ ... }

@script:python selection@
input << find.c;
@@
if filter.search(input[0].before, 2):
sys.stderr.write(input[0].before + "\n=====\n")
else:
cocci.include_match(False)

@display@
identifier find.x;
type find.t;
@@
*t x(...)
{ ... }


Does such a source code analysis approach indicate any details
which should be improved for the affected software documentation?

Regards,
Markus