Re: [Cocci] accessing comments

2019-05-26 Thread Markus Elfring
>> Will data structures become helpful where less than three attributes >> would be provided because a special source code element would be selected? > > Stop the pointless micro optimization. This has no impact on anything. We got different programming views which influence another approach to

Re: [Cocci] accessing comments

2019-05-26 Thread Markus Elfring
> You can attach a comment metavariable to any token in the semantic patch. > some of these are metavariables. Metavariables (except identifier > metavariables) often match more than one token in the C code. Can this case distinction trigger corresponding software design adjustments? How often

Re: [Cocci] accessing comments

2019-05-26 Thread Markus Elfring
> You can attach a comment metavariable to any token in the semantic patch. > some of these are metavariables. Metavariables (except identifier > metavariables) often match more than one token in the C code. Can this case distinction trigger corresponding software design adjustments? How often

Re: [Cocci] accessing comments

2019-05-26 Thread Markus Elfring
>> How many different pointers will refer to empty strings here? > > None. If there is no comment, it will be the empty list. How many different pointers can occur for these empty items? > The before, within and after comments are lists of strings. Will data structures become helpful where

Re: [Cocci] accessing comments

2019-05-26 Thread Markus Elfring
> Parameter lists are irrelevant. That is just an example. We have got a different understanding for the desired comment handling there at the moment. > As long as the SmPL token matches more than one token, Would we like to distinguish and clarify this case any further? > it is possible

[Cocci] Using a match result from an OCaml rule as a SmPL dependency

2019-05-25 Thread Markus Elfring
Hello, The OCaml programming language supports also the evaluation of regular expressions. * Can the corresponding match (or search failure) be stored in a variable so that it can be directly used for a dependency specification in a subsequent SmPL rule? * Is SmPL variable inheritance

Re: [Cocci] accessing comments

2019-05-25 Thread Markus Elfring
> There is one in an argument list that is within a statement. Can it be that such a comment would belong to the function call operator (open or closing parenthesis) instead of the identifier “foo”? Regards, Markus ___ Cocci mailing list

Re: [Cocci] accessing comments

2019-05-25 Thread Markus Elfring
>> How does your software decide which comment should be treated >> as simple text before or after an item? > > It takes all of the comments before (up to the preceding non comment > token if any) within and after (up to the following non comment token > if any). I find that this information can

Re: [Cocci] accessing comments

2019-05-25 Thread Markus Elfring
>> “… >> let (c1b,c1m,c1a) = List.hd c1 in >> …” >> >> >> Can this programming approach result in undesirable data duplication? > > There is no data duplication. The involved data structures are unclear at the moment. > Learn about pointers. How many different pointers will refer to empty

Re: [Cocci] accessing comments

2019-05-25 Thread Markus Elfring
> There is one in an argument list that is within a statement. This would only matter for the second call of the function “foo” in the example function “main”, wouldn't it? https://github.com/coccinelle/coccinelle/blob/210ce894d2dd1572fff9e1c98ae443e6df14f4c7/demos/comments.c#L2 How does your

Re: [Cocci] accessing comments

2019-05-25 Thread Markus Elfring
>> * Now I wonder why this display is presented in three variations. > > Before within and after I find this software behaviour hard to understand at the moment when the shown metavariables were split into three parts already by the call of the OCaml function “List.hd”. Which comment would be

Re: [Cocci] accessing comments

2019-05-25 Thread Markus Elfring
> You get a list of strings, with one comment per string. It seems that this metavariable provides structured information which can be split according to your OCaml code in the SmPL script. “… let (c1b,c1m,c1a) = List.hd c1 in …” Can this programming approach result in undesirable data

Re: [Cocci] Changing include parameters for compilation of OCaml code from SmPL scripts

2019-05-25 Thread Markus Elfring
>> ocamlc.opt -c /tmp/ocaml_cocci_bbc38d.cmo -g -I >> /home/elfring/Projekte/Coccinelle/20160205/ocaml -I /usr/lib64/ocaml >> /tmp/ocaml_cocci_bbc38d.ml How can it be achieved to replace the shown reference to a directory of the (standard) library for the system OCaml compiler?

Re: [Cocci] "depends on" per file

2019-05-24 Thread Markus Elfring
> @ replace_simple_positive @ How do you think about to move this rule to a separate SmPL script? Do any other subsequent rules depend on it? Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci

Re: [Cocci] Checking configuration challenges around OCaml usage for SmPL

2019-05-24 Thread Markus Elfring
ocamlc.opt -c /tmp/ocaml_cocci_bbc38d.cmo -g -I /home/elfring/Projekte/Coccinelle/20160205/ocaml -I /usr/lib64/ocaml /tmp/ocaml_cocci_bbc38d.ml >> >> Do you know where the include parameters are determined for such a call >> of the OCaml compiler in your source code? > > I had no

Re: [Cocci] Checking configuration challenges around OCaml usage for SmPL

2019-05-24 Thread Markus Elfring
ocamlc.opt -c /tmp/ocaml_cocci_bbc38d.cmo -g -I /home/elfring/Projekte/Coccinelle/20160205/ocaml -I /usr/lib64/ocaml /tmp/ocaml_cocci_bbc38d.ml >> >> Do you know where the include parameters are determined for such a call >> of the OCaml compiler in your source code? > > I had no

Re: [Cocci] Checking configuration challenges around OCaml usage for SmPL

2019-05-24 Thread Markus Elfring
>> ocamlc.opt -c /tmp/ocaml_cocci_bbc38d.cmo -g -I >> /home/elfring/Projekte/Coccinelle/20160205/ocaml -I /usr/lib64/ocaml >> /tmp/ocaml_cocci_bbc38d.ml Do you know where the include parameters are determined for such a call of the OCaml compiler in your source code? Regards, Markus

Re: [Cocci] Checking configuration challenges around OCaml usage for SmPL

2019-05-24 Thread Markus Elfring
>> Why is the program “ocamlc.opt” looking for the file >> “/usr/lib64/ocaml/list.cmi” >> instead of using the selected variant >> “~/.opam/4.07.1/lib/ocaml/stdlib__list.cmi”? > > OK, I don't know. Either Thierry knows or there is some problem with the > setup of your system. Which test

Re: [Cocci] Checking configuration challenges around OCaml usage for SmPL

2019-05-24 Thread Markus Elfring
>> How will the following software situation be resolved? > > make distclean > ./autogen > ./configure > make These commands were executed also on my system yesterday. > There is no dependency on any particular system compiler version. Why is the program “ocamlc.opt” looking for the file

Re: [Cocci] Checking configuration challenges around OCaml usage for SmPL

2019-05-24 Thread Markus Elfring
> You can do whatever you want in the ocaml code. How will the following software situation be resolved? elfring@Sonne:~/Projekte/Coccinelle/20160205> COCCINELLE_HOME=$(pwd) /usr/local/bin/opam config exec --switch 4.07.1 ./spatch demos/comments.cocci demos/comments.c init_defs_builtins:

Re: [Cocci] Development challenges around OCaml usage for SmPL

2019-05-23 Thread Markus Elfring
> You can do whatever you want in the ocaml code. This programming language has got also a general potential. But I find that there are special development challenges to consider for software components which do not belong to its standard library. How do you think about to take another look at an

Re: [Cocci] accessing comments

2019-05-23 Thread Markus Elfring
>> @display@ >> comments C; >> @@ >> *C > > This is not possible. At the moment. > Comments metavariables can only be attached to other tokens. I find that his wording can be ambiguous. How do you think about views around literate programming where executable code is between these comments?

Re: [Cocci] accessing comments

2019-05-23 Thread Markus Elfring
>> How do you think about to filter any text by regular expressions >> for semantic patch language constraints? > > Not supported. Would the text filter be possible by using (OCaml) script rules so far? How will these limitations be represented in the software documentation? >> Would you like

Re: [Cocci] accessing comments

2019-05-23 Thread Markus Elfring
> It is now possible to match the comments before, within, and after the > match of a token, via a comments metavariable. Are there any structures supported within source code comments? How do you think about to filter any text by regular expressions for semantic patch language constraints?

Re: [Cocci] Continuation for a code search after a common SmPL rule?

2019-05-21 Thread Markus Elfring
>> Can the splitting and recombination of such rules become more convenient >> with extensions for the Coccinelle software? > > In general it can't. This feedback seems to fit to the current software situation. > Coccinelle doesn't have the goal of minimizing the number of characters > in te

[Cocci] Continuation for a code search after a common SmPL rule?

2019-05-20 Thread Markus Elfring
Message repetition from 2019-05-16 because of a temporary technical difficulty with the mailing list services: = Hello, The semantic patch language can handle several rules which can contain remarkable amounts of source code search specifications. It can happen then that a few of these SmPL

Re: Coccinelle: semantic patch for missing of_node_put

2019-05-20 Thread Markus Elfring
> On the other hand, I don't know if the one that seemed to cause a crash > really caused a crash. It was detected by syzkaller, and it is also > possible that git bisect ended up at the wrong place. Do you refer to any known bug report here? > In any case, forgetting an of_node_put will

Re: [Cocci] Coccinelle: semantic patch for missing of_node_put

2019-05-20 Thread Markus Elfring
> $ 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

Re: Coccinelle: semantic patch for missing of_node_put

2019-05-17 Thread Markus Elfring
> A semantic patch has no access to comments. Thanks for your acknowledgement of the current situation. > The only thing I can see to do is to use python to interact with some > external tools. I see more software development possibilities. * Advanced data processing for source code comments

Re: Coccinelle: semantic patch for missing of_node_put

2019-05-17 Thread Markus Elfring
> 1, A simple method. > We did some experiments, and we could get the list of functions that need to > be considered directly through this script: > > $ 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 >

Re: [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses

2019-05-15 Thread Markus Elfring
> Could we use it to find out as many bugs as possible in the current kernel How do you think about to work with any more source code analysis approaches? > and then modify it? I guess that you do not need to wait for a solution so long. Variables which get reassigned in unwanted ways (before

Re: Coccinelle: Handling of SmPL disjunctions

2019-05-15 Thread Markus Elfring
>> Thanks for such additional information. Is it represented in the software >> documentation (besides the source code format)? > > It is not a concern of the user. I got interested in corresponding aspects. > The documentation is not going to contain a description of every line > in the

Re: [3/3] Coccinelle: pci_free_consistent: Extend when constraints for two SmPL ellipses

2019-05-15 Thread Markus Elfring
>>> On the other hand, I do care about causing false negatives. >> >> Do you find the missing warning after the addition of such an exclusion >> specification interesting? > > I already suggested how to improve the code. I find that the idea “e2->fld” needs further clarification. Such a SmPL

Re: [3/3] Coccinelle: pci_free_consistent: Extend when constraints for two SmPL ellipses

2019-05-15 Thread Markus Elfring
>> 1, "id = (T2)(e)" is rare. > > Thanks for checking. I don't really care if it is rare. I got related source code analysis concerns. > There should not be much cost to this. Each additional filter will influence the software run times and possible results. > On the other hand, I do care

Re: [3/3] Coccinelle: pci_free_consistent: Extend when constraints for two SmPL ellipses

2019-05-15 Thread Markus Elfring
> I don't think it is an environmental issue. You are right about taking other parameters better into account. > Theoretically, the original SmPL should find bugs. I expect also that both script versions should display a warning. > Although, I still send you my environmental information:

Re: [3/3] Coccinelle: pci_free_consistent: Extend when constraints for two SmPL ellipses

2019-05-15 Thread Markus Elfring
>> But with your modified SmPL, we can't find the bug. > > I do not see a difference here. I have accidentally overlooked to pass the parameter “-D report” to the spatch program. Now I notice also an unexpected and undesirable difference for your test example after the suggested addition of

Re: [2/3] Coccinelle: pci_free_consistent: Reduce a bit of duplicate SmPL code

2019-05-15 Thread Markus Elfring
>> Can different run time characteristics become relevant here? > > Internally, they should be identical. I got other imaginations in this area. I assume that the evaluation of a separate SmPL disjunction for the shown return values is occasionally nicer than the repeated matching for the

Re: [3/3] Coccinelle: pci_free_consistent: Extend when constraints for two SmPL ellipses

2019-05-15 Thread Markus Elfring
> 1, "id = (T2)(e)" is rare. I can follow this view for such a filter. > It may be a minor detail that will have no impact in practice. I suggest to reconsider this view once more. Should such exclusion specifications take also “unexpected” source code into account so that analysis results

Re: [3/3] Coccinelle: pci_free_consistent: Extend when constraints for two SmPL ellipses

2019-05-15 Thread Markus Elfring
> 1, "id = (T2)(e)" is rare. I can follow this view for such a filter. > It may be a minor detail that will have no impact in practice. I suggest to reconsider this view once more. Should such exclusion specifications take also “unexpected” source code into account so that analysis results

Re: [2/3] Coccinelle: pci_free_consistent: Reduce a bit of duplicate SmPL code

2019-05-14 Thread Markus Elfring
>> A return statement was specified with a known value for three branches >> of a SmPL disjunction. >> Reduce duplicate SmPL code there by using another disjunction for >> these return values. … > NACK. The goak is not to squeeze the most information into the fewest > number of characters. Can

Re: [1/3] Coccinelle: pci_free_consistent: Use formatted strings directly in SmPL rules

2019-05-14 Thread Markus Elfring
> NACK. If the code is going to change, I would rather it come closer to > staying within 80 characters. Do you really prefer then to deviate from the Linux coding style at such source code places? Would you like to split affected string literals over multiple lines? Regards, Markus

[PATCH 3/3] Coccinelle: pci_free_consistent: Extend when constraints for two SmPL ellipses

2019-05-14 Thread Markus Elfring
From: Markus Elfring Date: Tue, 14 May 2019 18:12:15 +0200 A SmPL ellipsis was specified for a search approach so that additional source code would be tolerated between an assignment to a local variable and the corresponding null pointer check. But such code should be restricted. * The local

[PATCH 2/3] Coccinelle: pci_free_consistent: Reduce a bit of duplicate SmPL code

2019-05-14 Thread Markus Elfring
From: Markus Elfring Date: Tue, 14 May 2019 17:18:24 +0200 A return statement was specified with a known value for three branches of a SmPL disjunction. Reduce duplicate SmPL code there by using another disjunction for these return values. Signed-off-by: Markus Elfring --- scripts/coccinelle

[PATCH 2/3] Coccinelle: pci_free_consistent: Reduce a bit of duplicate SmPL code

2019-05-14 Thread Markus Elfring
From: Markus Elfring Date: Tue, 14 May 2019 17:18:24 +0200 A return statement was specified with a known value for three branches of a SmPL disjunction. Reduce duplicate SmPL code there by using another disjunction for these return values. Signed-off-by: Markus Elfring --- scripts/coccinelle

[PATCH 1/3] Coccinelle: pci_free_consistent: Use formatted strings directly in SmPL rules

2019-05-14 Thread Markus Elfring
From: Markus Elfring Date: Tue, 14 May 2019 16:54:40 +0200 Formatted strings were always assigned to the Python variable “msg” before they were used in two rules of a script for the semantic patch language. Delete these extra variables so that the specified string objects are directly used

Re: [4/5] Coccinelle: put_device: Extend when constraints for twoSmPL ellipses

2019-05-14 Thread Markus Elfring
> I did another experiment at that time and found that this modification will > reduce the false positive rate, Thanks for such feedback. Will my update suggestion influence the current (or future) software situation? > but it may also reduce the recall rate. Would you like to explain this

Re: [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses

2019-05-14 Thread Markus Elfring
>> Can you agree to any information which I presented in the commit message? Do you find this description inappropriate? >>> You don't need so many type metavariables. >> >> It seems that the Coccinelle software can cope also with my SmPL code >> addition. >> You might feel uncomfortable with

Re: [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses

2019-05-14 Thread Markus Elfring
>> Can you agree to any information which I presented in the commit message? Do you find this description inappropriate? >>> You don't need so many type metavariables. >> >> It seems that the Coccinelle software can cope also with my SmPL code >> addition. >> You might feel uncomfortable with

Re: [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses

2019-05-13 Thread Markus Elfring
>> A SmPL ellipsis was specified for a search approach so that additional >> source code would be tolerated between an assignment to a local variable >> and the corresponding null pointer check. >> >> But such code should be restricted. >> * The local variable must not be reassigned there. >> * It

Re: [3/5] Coccinelle: put_device: Merge four SmPL when constraints into one

2019-05-13 Thread Markus Elfring
>> I try to stress SmPL functionality in this use case. > > That's not the goal of the semantic patches in the kernel. > > The rule is fine as it is. I am curious under which circumstances other software aspects can become more relevant (as suggested). Regards, Markus

Re: [5/5] Coccinelle: put_device: Merge two SmPL when constraints into one

2019-05-13 Thread Markus Elfring
>> Combine the exclusion specifications into a disjunction for the semantic >> patch language so that this argument is referenced only once there. … > NACK. This hurts readability I suggest to reconsider such readability concerns once more. Can corresponding software limitations be adjusted any

Re: [Cocci] [4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses

2019-05-13 Thread Markus Elfring
>> Take additional casts for these code exclusion specifications into account >> together with optional parentheses. > > NACK. I find this rejection surprising. > You don't need so many type metavariables. I got an other software development opinion for this aspect. Yesterday we started to

Re: [Cocci] [3/5] Coccinelle: put_device: Merge four SmPL when constraints into one

2019-05-13 Thread Markus Elfring
>> An assignment target was repeated in four SmPL when constraints. >> Combine the exclusion specifications into disjunctions for the semantic >> patch language so that this target is referenced only once there. > > NACK. I find this rejection questionable. > This exceeds 80 characters The

Re: [1/5] Coccinelle: put_device: Adjust a message construction

2019-05-13 Thread Markus Elfring
>> Thus simplify a message construction in a SmPL rule by concatenating text >> with two plus operators less. > > Is there any way to unindent, so that the string doesn't exceed 80 characters, > or at least no so much? How does your concern fit to the string literal tolerance from the Linux

[Cocci] [PATCH 4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses

2019-05-13 Thread Markus Elfring
From: Markus Elfring Date: Mon, 13 May 2019 09:47:17 +0200 A SmPL ellipsis was specified for a search approach so that additional source code would be tolerated between an assignment to a local variable and the corresponding null pointer check. But such code should be restricted. * The local

[Cocci] [PATCH 5/5] Coccinelle: put_device: Merge two SmPL when constraints into one

2019-05-13 Thread Markus Elfring
From: Markus Elfring Date: Mon, 13 May 2019 09:55:22 +0200 A single parameter was repeated for a function call in two SmPL when constraints. Combine the exclusion specifications into a disjunction for the semantic patch language so that this argument is referenced only once there. Signed-off

[Cocci] [PATCH 4/5] Coccinelle: put_device: Extend when constraints for two SmPL ellipses

2019-05-13 Thread Markus Elfring
From: Markus Elfring Date: Mon, 13 May 2019 09:47:17 +0200 A SmPL ellipsis was specified for a search approach so that additional source code would be tolerated between an assignment to a local variable and the corresponding null pointer check. But such code should be restricted. * The local

[PATCH 2/5] Coccinelle: put_device: Add a cast to an expression for an assignment

2019-05-13 Thread Markus Elfring
From: Markus Elfring Date: Wed, 8 May 2019 13:50:49 +0200 Extend a when constraint in a SmPL rule so that an additional cast is optionally excluded from source code searches for an expression in assignments. Signed-off-by: Markus Elfring Suggested-by: Julia Lawall Link: https

[PATCH 1/5] Coccinelle: put_device: Adjust a message construction

2019-05-13 Thread Markus Elfring
From: Markus Elfring Date: Tue, 7 May 2019 11:20:48 +0200 The Linux coding style tolerates long string literals so that the provided information can be easier found also by search tools like grep. Thus simplify a message construction in a SmPL rule by concatenating text with two plus operators

[PATCH 0/5] Coccinelle: put_device: Adjustments for a SmPL script

2019-05-13 Thread Markus Elfring
://systeme.lip6.fr/pipermail/cocci/2019-March/005692.html https://lkml.org/lkml/2019/3/26/395 I would appreciate if corresponding implementation details will get another look. Markus Elfring (5): Adjust a message construction Add a cast to an expression for an assignment Merge four SmPL when

Re: [Cocci] Coccinelle: semantic patch for missing of_node_put

2019-05-09 Thread Markus Elfring
> It's interesting to get the function list automatically. I occasionally imported code data into list variables or even database tables. > I'll try to parse the drivers/of/base.c file based on comments like this > "* Returns a node pointer with refcount incremented, use > * of_node_put() on it

Re: [Cocci] [PATCH] coccinelle: semantic patch for missing of_node_put

2019-05-07 Thread Markus Elfring
> The call to of_parse_phandle()/of_find_node_by_name() ... returns a node > pointer with refcount incremented thus it must be explicitly decremented > after the last usage. > > This SmPL is also looking for places where there is an of_node_put on > some path but not on others. I suggest to

Re: [Cocci] Detecting false positive sparse with Coccinelle

2019-04-29 Thread Markus Elfring
> … - the problem though is that I'm unable > to insert the (__force __be16) cast in the patch rule as > coccinelle is refusing hose lines. … It seems that I can not help directly with this concern. But a few other implementation details in your approach caught also my development attention once

Re: [Cocci] Data exchange over network interfaces by SmPL scripts

2019-04-27 Thread Markus Elfring
> connecting … > File "", line 35, in store_statements > socket.gaierror: [Errno -2] Name or service not known > Error in Python script, line 56, file … It seems that the attached adjusted data processing approach can produce an usable analysis result.

Re: [Cocci] Data exchange over network interfaces by SmPL scripts

2019-04-27 Thread Markus Elfring
> File "", line 35, in store_statements > socket.gaierror: [Errno -2] Name or service not known > Error in Python script, line 56, file … It seems that the attached adjusted data processing approach can produce an usable analysis result. elfring@Sonne:~/Projekte/Coccinelle/janitor> time

[Cocci] Data exchange through message queue interfaces by SmPL scripts

2019-04-25 Thread Markus Elfring
> Is there still a need to perform parallelisation for the mentioned software > components by other approaches? The multi-processing support by the Coccinelle software triggers some development challenges. If data should be shared between started (background) processes, an external system need to

Re: [Cocci] Data exchange over network interfaces by SmPL scripts

2019-04-25 Thread Markus Elfring
>> File "", line 34, in store_statements >> AttributeError: __exit__ >> Error in Python script, line 55, file … > > I have no idea. It looks like a python problem. Partly, yes (of course). > If you want help, you will have to construct a script > that exhibits the error with print statements

[Cocci] Data exchange over network interfaces by SmPL scripts

2019-04-25 Thread Markus Elfring
> Is there still a need to perform parallelisation for the mentioned software > components by other approaches? The multi-processing support by the Coccinelle software triggers some development challenges. If data should be shared between started (background) processes, an external system need to

Re: [Cocci] Addition of do-while support for SmPL

2019-04-24 Thread Markus Elfring
>> * Would you like to add a directory for your test collection? > > Hum, there are over 1000 files in tests/, Are any of them interesting also for you? > it's tedious to scroll through all of them. Can a separate folder for your contribution? Would you become interested in a topic like

[Cocci] Rejecting parallel execution of SmPL scripts

2019-04-24 Thread Markus Elfring
Hello, The Coccinelle software supports multi-processing (parameter “--jobs”) for a while. It would be occasionally useful to share data between started (background) processes for specific analysis tasks. Such parallel data collection would require a software design which is safe for data

Re: [Cocci] Checking import of code search results into a table by parallel SmPL data processing

2019-04-23 Thread Markus Elfring
> Since you haven't included the semantic patch, This information can become useful later eventually. > it seems that there is no way anyone can help you. Other developers can provide also helpful advices. Example: Mike Bayer Topic: Checking approaches around parallel data import for records

Re: [Cocci] Addition of do-while support for SmPL

2019-04-22 Thread Markus Elfring
> I would like to show you my efforts on adding the missing dowhile loop in > SmPL. Do you refer to the functionality “do … while(…) loop” here? Thanks for your interest in software extensions according to this topic. https://systeme.lip6.fr/pipermail/cocci/2015-May/002030.html

Re: [Cocci] Checking uniqueness for source code positions during SmPL data processing

2019-04-22 Thread Markus Elfring
>> Where does the added number come from for the identifier “reg1”? > > It's in the source code, at a different position than the reg result. You (and the script variant “list_duplicate_statement_pairs_from_if_branches6.cocci”) are right. A bit of exception handling code can be repeated too

Re: [Cocci] Checking uniqueness for source code positions during SmPL data processing

2019-04-22 Thread Markus Elfring
> I'm not going to debug anything that involves external tools, > ie your database. * Will such a restriction become interesting also for further clarifications? * Did you notice that the script variant “list_duplicate_statement_pairs_from_if_branches5.cocci” is working only by a simple

[Cocci] Checking uniqueness for source code positions during SmPL data processing

2019-04-22 Thread Markus Elfring
Hello, I reported that I am trying a specific source code analysis out again. Information can be imported also into database tables for such a purpose. I observed a primary key constraint violation for my data processing attempt. Useful background information can be found for a topic like

[Cocci] Navigation for source code positions from error messages

2019-04-21 Thread Markus Elfring
Hello, I try to achieve something also by the specification of Python code within scripts for the semantic patch language. It can happen then that such code contains questionable places (because of usual update candidates). Example for a corresponding error message: … File "", line 11

Re: [Cocci] Checking import of code search results into a table by parallel SmPL data processing

2019-04-20 Thread Markus Elfring
>> elfring@Sonne:~/Projekte/Linux/next-patched> time spatch --timeout 34 -j 2 >> --chunksize 1 -D database_URL=postgresql+psycopg2:///parallel_DVB_duplicates >> --dir drivers/media/dvb-frontends --sp-file >> ~/Projekte/Coccinelle/janitor/list_duplicate_statement_pairs_from_if_branches4.cocci >>

[Cocci] Checking import of code search results into a table by parallel SmPL data processing

2019-04-20 Thread Markus Elfring
Hello, I have noticed another questionable software behaviour during the application of the semantic patch language. elfring@Sonne:~/Projekte/Linux/next-patched> time spatch --timeout 34 -j 2 --chunksize 1 -D database_URL=postgresql+psycopg2:///parallel_DVB_duplicates --dir

Re: [Cocci] Checking execution environment for Python code in SmPL scripts

2019-04-20 Thread Markus Elfring
>> I would appreciate a more appropriate error message for such use cases. > > Coccinelle doesn't know what you intend. Executing the initialize rule is > not obligatory. Can execution of the specified initialisation code become mandatory? Regards, Markus

Re: [Cocci] Checking execution environment for Python code in SmPL scripts

2019-04-20 Thread Markus Elfring
>> @initialize:python@ >> +URL << virtual.database_URL; > > On the command line, your -D argument is URL, but here the variable is > called database_URL. I am sorry that I have overlooked the identifier mismatch here. > If you don't provide the variables needed by the initialize rule, > the

[Cocci] Checking execution environment for Python code in SmPL scripts

2019-04-20 Thread Markus Elfring
Hello, I constructed a SmPL script which can work as desired. elfring@Sonne:~/Projekte/Linux/next-patched> spatch drivers/media/dvb-frontends/tda1004x.c ~/Projekte/Coccinelle/janitor/list_duplicate_statement_pairs_from_if_branches3.cocci … Using SQLAlchemy version: 1.3.2 …

[Cocci] Checking the search for duplicate statements at the end of if branches

2019-04-19 Thread Markus Elfring
Hello, I have tried another script out for the evolving semantic patch language. Source code information is imported into a database table based on the following SmPL rule. @searching@ identifier work; statement s1, s2; position pos; type T; @@ T work(...) { ... when any if (...) { ...

[Cocci] Searching for last two statements in code blocks

2019-04-18 Thread Markus Elfring
Hello, I have tried another small SmPL script out. @display@ identifier work; statement s1, s2; type T; @@ T work(...) { ... when any { ... when any *s1 s2 } ... when any } I have observed that no statements were shown from if branches in my test source file. This happened then after

Re: [Cocci] Add code after local variable declarations?

2019-04-17 Thread Markus Elfring
> No i want to add some code to _all_ function that have a specific > structure as one of their argument. Thus i match on the function > parameter list for the struct i am interested in This source code search approach is generally fine. > and then after all the declaration i add a code

Re: [Cocci] Add code after local variable declarations?

2019-04-17 Thread Markus Elfring
>> Would you like to add any source code only after a variable declaration > > Coccinelle doesn't allow this. It has no way of knowing whether other > declarations come afterwards, I suggest to reconsider this quick response. Are there approximations supported for such a source code search

Re: [Cocci] Add code after local variable declarations?

2019-04-17 Thread Markus Elfring
>> Would you like to add any source code only after a variable declaration > > Coccinelle doesn't allow this. It has no way of knowing whether other > declarations come afterwards, I suggest to reconsider this quick response. Are there approximations supported for such a source code search

Re: [Cocci] Add code after local variable declarations?

2019-04-17 Thread Markus Elfring
> @@ > statement S,S1; > @@ > > foo(...) { > ... when != S > + added code > S1 > ... > } > > A declaration doesn't match S. Can this information trigger additional considerations for the handling of variable definitions? Would you like to add any source code only after a variable

Re: [Cocci] Working with backreferences in SmPL scripts?

2019-04-17 Thread Markus Elfring
> A metavariable is always bound to the same value within a given > control-flow path. Thanks for this information. > I have no idea what you are trying to get at with this example. Some goals can match to my use case description. * Is another nice refactoring application demonstrated for

[Cocci] Working with backreferences in SmPL scripts?

2019-04-17 Thread Markus Elfring
Hello, I have tried another small SmPL script out. @replacement@ expression ex; identifier var; @@ var - = var + + += ex elfring@Sonne:~/Projekte/Coccinelle/Probe> spatch simplify_addition1.cocci Test_increment1.c … @@ -1,6 +1,6 @@ int main(void) { int counter = 3;

Re: [Cocci] Clarification for SmPL functionality around position variables

2019-04-14 Thread Markus Elfring
>> I tried three different orderings out for these position variables >> in the meantime. >> >> Will the implementation be fixed for all affected software components anyhow? > > No. I am still curious then under which circumstances this software will be corrected. Regards, Markus

Re: [Cocci] Clarification for SmPL functionality around position variables

2019-04-14 Thread Markus Elfring
Variable find.p2 in duplicated_code cannot be used as both a position and a constraint >>> >>> I think that you have to declare find.p1 and find.p2 on a subsequent line. >> >> I have observed the same error message then. > > Go back and read what I wrote. I suggest to take another look

Re: [Cocci] Clarification for SmPL functionality around position variables

2019-04-14 Thread Markus Elfring
>> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci >> show_same_statements7.cocci >> … >> Variable find.p2 in duplicated_code cannot be used as both a position and a >> constraint > > I think that you have to declare find.p1 and find.p2 on a subsequent line. I have observed

Re: [Cocci] Clarification for SmPL functionality around position variables

2019-04-14 Thread Markus Elfring
> Use position variables and use a second rule that forces the positions to > be different. I already explained this. I suggest to take another look at the provided information. I have extended the analysis approach like the following. @find@ identifier work; position p1, p2; statement s1,

Re: [Cocci] Clarification for SmPL ellipsis functionality

2019-04-13 Thread Markus Elfring
>> I am still curious if it can be achieved that two statements >> (with a SmPL ellipsis between them) will be found only at different >> positions. >> >> How should be excluded that two generic search specifications >> will be merged? > > Use position variables and use a second rule that forces

Re: [Cocci] Checking influence of loops?

2019-04-13 Thread Markus Elfring
>>> Typically when there is a loop or goto. >> >> I find such a case distinction interesting. >> >> >>> But there is no special handling of either construct. >> >> Does this information contain a contradiction? > > No. Draw a control flow graph of a loop and see what should happen for > such a

Re: [Cocci] Checking influence of loops?

2019-04-13 Thread Markus Elfring
>>> If you have a pattern like >>> >>> AAA >>> ... >>> BBB >>> >>> The AAA and BBB might match the same code >> >> I agree to this information in principle. >> But I imagine that this source code should be found >> at different positions. > > No there is no such constraint. My software

Re: [Cocci] Checking influence of loops?

2019-04-13 Thread Markus Elfring
>> Should two search specifications (with SmPL ellipses) between them >> be kept separate for the desired diff output? > > I don't understand any of your answers precisely. I hope that we can come closer again to a better understanding of the reported software situation. > If you have a pattern

Re: [Cocci] Checking influence of loops?

2019-04-13 Thread Markus Elfring
> Your ifs may be in a loop. Does your technology treat this control flow in special ways? >>> >>> No. >> >> Would the quoted information be irrelevant then for the discussed use case? > > No idea what the above means. It seems that there is another communication difficulty

Re: [Cocci] Checking influence of loops?

2019-04-13 Thread Markus Elfring
>>> Your ifs may be in a loop. >> >> Does your technology treat this control flow in special ways? > > No. Would the quoted information be irrelevant then for the discussed use case? Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr

Re: [Cocci] Checking influence of loops?

2019-04-13 Thread Markus Elfring
> Your ifs may be in a loop. Does your technology treat this control flow in special ways? Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci

<    3   4   5   6   7   8   9   10   11   12   >