* Re: Coccinelle: semantic patch for missing of_node_put [not found] <201905171432571474636@zte.com.cn> @ 2019-05-18 14:43 ` Markus Elfring 2019-06-04 5:08 ` Markus Elfring 1 sibling, 0 replies; 6+ messages in thread From: Markus Elfring @ 2019-05-18 14:43 UTC (permalink / raw) To: Wen Yang, Coccinelle, linux-doc Cc: linux-kernel, Gilles Muller, Julia Lawall, Masahiro Yamada, Michal Marek, Nicolas Palix > $ spatch --tokens-c drivers/of/base.c 2>&1 | grep "Tag3 " | grep "of_node_put() on it when done." | awk -F " - " '{print $1}' | grep -o "of_[[:print:]]*" This command example points some details out for further software development considerations. 1. I find it questionable that relevant data are provided by the output channel “stderr” so far. https://github.com/coccinelle/coccinelle/blob/66a1118e04a6aaf1acdae89623313c8e05158a8d/docs/manual/spatch_options.tex#L165 2. The OCaml code “"Tag" ^ string_of_int t ^” occurs in three source files. * It is commented out in one file. https://github.com/coccinelle/coccinelle/blob/761cf6a1fbbf3173896ff61f0ea7e4a83a5b2a57/commons/common.ml#L305 * These places refer to the source file “dumper.ml 1.2” by Richard W. M. Jones. Thus it seems that this code is relevant at the moment. https://github.com/coccinelle/coccinelle/blob/175de16bc7e535b6a89a62b81a673b0d0cd7075c/commons/ocamlextra/dumper.ml#L1 3. How will the software documentation evolve here? 4. Safe data processing can be performed only if the involved structures will remain clear for a while. Is the situation partly unclear? Should the information after which function calls the function “of_node_put” should be called be determined from any other documentation format? 5. A programming language like “awk” has got the potential to extract useful data (also without calling the tool “grep” additionally). Regards, Markus ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Coccinelle: semantic patch for missing of_node_put [not found] <201905171432571474636@zte.com.cn> 2019-05-18 14:43 ` Coccinelle: semantic patch for missing of_node_put Markus Elfring @ 2019-06-04 5:08 ` Markus Elfring 2019-06-05 18:23 ` Coccinelle: Searching for “when done” in function comments Markus Elfring 1 sibling, 1 reply; 6+ messages in thread From: Markus Elfring @ 2019-06-04 5:08 UTC (permalink / raw) To: Wen Yang, Julia Lawall, linux-doc Cc: cocci, linux-kernel, Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Coccinelle: Searching for “when done” in function comments 2019-06-04 5:08 ` Markus Elfring @ 2019-06-05 18:23 ` Markus Elfring 0 siblings, 0 replies; 6+ messages in thread From: Markus Elfring @ 2019-06-05 18:23 UTC (permalink / raw) To: Wen Yang, Julia Lawall, linux-doc Cc: cocci, linux-kernel, Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix > Does such a source code analysis approach indicate any details > which should be improved for the affected software documentation? I have constructed another SmPL script variant. It can point out that the text “ when done” occurs in comment lines before 48 function implementations which are provided by 20 source files of the software “Linux next-20190605”. Will this source code analysis result trigger further development efforts around detection of unique wordings in these descriptions? Regards, Markus ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <201906041350002807147@zte.com.cn>]
* Re: Coccinelle: semantic patch for missing of_node_put [not found] <201906041350002807147@zte.com.cn> @ 2019-06-04 6:36 ` Markus Elfring 2019-06-04 11:28 ` Markus Elfring 1 sibling, 0 replies; 6+ messages in thread From: Markus Elfring @ 2019-06-04 6:36 UTC (permalink / raw) To: Wen Yang, Julia Lawall, linux-doc Cc: cocci, linux-kernel, Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix > We currently use the following Ocaml script to automatically > collect functions that need to be considered. > > @initialize:ocaml@ > @@ > > let relevant_str = "use of_node_put() on it when done" I suggest to reconsider this search pattern. The mentioned words are distributed over text lines in the discussed software documentation. Thus I imagine that an other documentation format would be safer and more helpful for the determination of a corresponding API system property. Regards, Markus ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Coccinelle: semantic patch for missing of_node_put [not found] <201906041350002807147@zte.com.cn> 2019-06-04 6:36 ` Coccinelle: semantic patch for missing of_node_put Markus Elfring @ 2019-06-04 11:28 ` Markus Elfring 1 sibling, 0 replies; 6+ messages in thread From: Markus Elfring @ 2019-06-04 11:28 UTC (permalink / raw) To: Wen Yang Cc: linux-doc, cocci, linux-kernel, Gilles.Muller, Masahiro Yamada, Michal Marek, Nicolas Palix, Julia Lawall > let add_function f c = > if not (List.mem f !relevant_functions) > then > begin > let s = String.concat " " > ( > (List.map String.lowercase_ascii > (List.filter > (function x -> > Str.string_match > (Str.regexp "[a-zA-Z_\\(\\)][-a-zA-Z0-9_\\(\\)]*$") > x 0) (Str.split (Str.regexp "[ .;\t\n]+") c)))) in I would interpret one of these function calls in the way that text splitting is performed here also for space characters after a concatenation was performed. > Printf.printf "comments: %s\n" s; > if contains s relevant_str > then > Printf.printf "Found relevant function: %s\n" f; > relevant_functions := f :: !relevant_functions; > end > > @r@ > identifier fn; > comments c; > type T = struct device_node *; > @@ > > T@c fn(...) { > ... > } > > @script:ocaml@ > f << r.fn; > c << r.c; > @@ > > let (cb,cm,ca) = List.hd c in > let c = String.concat " " cb in > add_function f c Can an other data processing variant be more reasonable? Regards, Markus ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <201906041655048641633@zte.com.cn>]
* Re: Coccinelle: semantic patch for missing of_node_put [not found] <201906041655048641633@zte.com.cn> @ 2019-06-04 9:08 ` Markus Elfring 0 siblings, 0 replies; 6+ messages in thread From: Markus Elfring @ 2019-06-04 9:08 UTC (permalink / raw) To: Wen Yang, linux-doc Cc: Julia Lawall, cocci, linux-kernel, Gilles Muller, Masahiro Yamada, Michal Marek, Nicolas Palix >> Thus I imagine that an other documentation format would be safer >> and more helpful for the determination of a corresponding API >> system property. > > Our script will remove '* ','\ n','\t' and so on from the comments in the function header > and then merge them into one line, * Would you like to keep this adjustment approach (for a while)? * Will other data structures become nicer for the discussed data extraction? > so we can exactly match the target string 'use of_node_put() on it when done ' Thanks for this clarification. Regards, Markus ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-06-05 18:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <201905171432571474636@zte.com.cn>
2019-05-18 14:43 ` Coccinelle: semantic patch for missing of_node_put Markus Elfring
2019-06-04 5:08 ` Markus Elfring
2019-06-05 18:23 ` Coccinelle: Searching for “when done” in function comments Markus Elfring
[not found] <201906041350002807147@zte.com.cn>
2019-06-04 6:36 ` Coccinelle: semantic patch for missing of_node_put Markus Elfring
2019-06-04 11:28 ` Markus Elfring
[not found] <201906041655048641633@zte.com.cn>
2019-06-04 9:08 ` Markus Elfring
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox