Skip to contentSkip to conversation

Searching for repeated source code with SmPL?

cocci Markus Elfring 2 participants 36 messages May 6, 2024 – May 22, 2024

lore
Share & tools
lore
#0 lore raw

Hello,

Source code parts can occasionally be repeated.

* Loops
The control flow can contain ordinary loops.

* Recursion
A function may be called by itself.

Such constructs trigger special consequences also for further data processing with higher level technologies.

+ Computation tree logic

+ Linear temporal logic

I am still looking for clarifications so that the Coccinelle software can be applied in safer ways.

Regular expressions support some search operators for quantification. A notation is accordingly supported for the specification of a minimum number of matches which would be bigger than one item.

I imagine that such functionality would be helpful also for the semantic patch language. How will the chances evolve to extend corresponding quantifiers anyhow?
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/23f7738a7881b02d016d278ee293cfd4a126fcab/docs/manual/cocci_syntax.tex#L793
https://github.com/coccinelle/coccinelle/blob/755250323b80f27701e78d325cc83509197b33b1/docs/manual/cocci_syntax.tex#L793

I would appreciate if multiple occurrences of code elements can be better detected and transformed.

Regards,
Markus

#1 lore raw
Quoted 27 lines · Markus Elfring

Hello,

Source code parts can occasionally be repeated.

* Loops
The control flow can contain ordinary loops.

* Recursion
A function may be called by itself.

Such constructs trigger special consequences also for further data processing with higher level technologies.

+ Computation tree logic

+ Linear temporal logic

I am still looking for clarifications so that the Coccinelle software can be applied in safer ways.

Regular expressions support some search operators for quantification. A notation is accordingly supported for the specification of a minimum number of matches which would be bigger than one item.

Quoted 7 lines

I imagine that such functionality would be helpful also for the semantic patch language. How will the chances evolve to extend corresponding quantifiers anyhow?
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/23f7738a7881b02d016d278ee293cfd4a126fcab/docs/manual/cocci_syntax.tex#L793
https://github.com/coccinelle/coccinelle/blob/755250323b80f27701e78d325cc83509197b33b1/docs/manual/cocci_syntax.tex#L793

I would appreciate if multiple occurrences of code elements can be better detected and transformed.

I have no intention of adding regular expressions. Be more concrete about what you are not able to do.

julia

#2 lore raw
Quoted 30 lines
Quoted 30 lines

Source code parts can occasionally be repeated.

* Loops
The control flow can contain ordinary loops.

* Recursion
A function may be called by itself.

Such constructs trigger special consequences also for further data processing with higher level technologies.

+ Computation tree logic

+ Linear temporal logic

I am still looking for clarifications so that the Coccinelle software can be applied in safer ways.

Regular expressions support some search operators for quantification. A notation is accordingly supported for the specification of a minimum number of matches which would be bigger than one item.

I imagine that such functionality would be helpful also for the semantic patch language. How will the chances evolve to extend corresponding quantifiers anyhow?
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/23f7738a7881b02d016d278ee293cfd4a126fcab/docs/manual/cocci_syntax.tex#L793
https://github.com/coccinelle/coccinelle/blob/755250323b80f27701e78d325cc83509197b33b1/docs/manual/cocci_syntax.tex#L793

Quoted 4 lines
Quoted 2 lines

I would appreciate if multiple occurrences of code elements can be better detected and transformed.

I have no intention of adding regular expressions.

Please take another look at provided information from my clarification approach so that undesirable misunderstandings can be better avoided.

* Regular expressions are supported already by the Coccinelle software.

+ They can be applied for advanced SmPL constraints.

+ Embedded scripts for programming languages like “OCaml” and “Python” occasionally benefit from this technique.

Quoted 1 line

Be more concrete about what you are not able to do.

The semantic patch language supports a few “Dot variants” so far.
I am looking for further possibilities according to item quantification. How should a search be performed for source code which would occur twice at least (without taking repetition because of loops and recursion into account)?

How would a notation “{2,}” look like in SmPL?
https://en.wikipedia.org/wiki/Regular_expression#Basic_concepts

Regards,
Markus

#3 lore raw
In reply to Julia Lawall
Quoted 1 line

Be more concrete about what you are not able to do.

Would you find another specific search use case easier to clarify?

Example:
How would you like to determine that an if statement was specified three times within an function implementation while the corresponding compound statement should contain a variable assignment and a goto statement (at the end)?

Regards,
Markus

#4 lore raw
Quoted 8 lines · Markus Elfring
Quoted 1 line

Be more concrete about what you are not able to do.

Would you find another specific search use case easier to clarify?

Example:
How would you like to determine that an if statement was specified three times within an function implementation while the corresponding compound statement should contain a variable assignment and a goto statement (at the end)?

If you really are concerned about three identical if statements plced anywhere, you can record their positions and then count them. But it doesn't seem like a genuinely useful thing to do.

julia

#5 lore raw
Quoted 6 lines
Quoted 4 lines

Example:
How would you like to determine that an if statement was specified three times within an function implementation while the corresponding compound statement should contain a variable assignment and a goto statement (at the end)?

If you really are concerned about three identical if statements plced anywhere,

It can be usual to repeat if statements which would be similar also because of known design patterns like error detection and exception handling.

Quoted 1 line

you can record their positions and then count them.

The Coccinelle software counts source code parts already for the supported “Dot variants”, doesn't it?

How do you think about extensions for SmPL quantifiers?

Quoted 1 line

But it doesn't seem like a genuinely useful thing to do.

The beginning of another source code analysis can help to achieve a better understanding for desirable transformations.

Regards,
Markus

#6 lore raw
In reply to Julia Lawall

…

Quoted 2 lines
Quoted 2 lines

I would appreciate if multiple occurrences of code elements can be better detected and transformed.

…

Quoted 1 line

Be more concrete about what you are not able to do.

I hope that indicated communication (and data processing) difficulties can be adjusted a bit more.

See also another source code example:

void my_test(void)
{
my_action(1);
my_action(2);
my_action(3);
}

See also a corresponding analysis approach by the means of a tiny script for the semantic patch language:

@display@
@@
my_action(...);
<+...
*my_action(...);
...+>

Why is no diff output generated by the software combination “Coccinelle 1.2-00008-g75525032” so far?

Regards,
Markus

#7 lore raw
Quoted 30 lines · Markus Elfring

…

Quoted 2 lines
Quoted 2 lines

I would appreciate if multiple occurrences of code elements can be better detected and transformed.

…

Quoted 1 line

Be more concrete about what you are not able to do.

I hope that indicated communication (and data processing) difficulties can be adjusted a bit more.

See also another source code example:

void my_test(void)
{
my_action(1);
my_action(2);
my_action(3);
}

See also a corresponding analysis approach by the means of a tiny script for the semantic patch language:

@display@
@@
my_action(...);
<+...
*my_action(...);
...+>

Quoted 2 lines

Why is no diff output generated by the software combination “Coccinelle 1.2-00008-g75525032” so far?

Your semantic patch needs to be:

@display@
@@
my_action(...);
<+... when any
*my_action(...);
...+>

Without that, a call to my_action is forbidden in the region matched by the <+... ...+>. Because any kind of dot thing matches the shortest path between what comes before and what comes after (here the end of the function).

julia

#8 lore raw
Quoted 12 lines
Quoted 2 lines

Why is no diff output generated by the software combination “Coccinelle 1.2-00008-g75525032” so far?

Your semantic patch needs to be:

@display@
@@
my_action(...);
<+... when any
*my_action(...);
...+>

Quoted 3 lines

Without that, a call to my_action is forbidden in the region matched by the <+... ...+>. Because any kind of dot thing matches the shortest path between what comes before and what comes after (here the end of the function).

Thanks for this quick feedback.

It seems that we expect different data processing also for the shown test case.

The SmPL construct “<+... … ...+>” supports a search for code parts which occur at least once.
Thus it seems that the specified search pattern needs be duplicated before if you would like to find code which should occur at least twice.
I would appreciate if undesirable duplication of search patterns can be avoided here.

Regards,
Markus

#9 lore raw
Quoted 18 lines · Markus Elfring
Quoted 12 lines
Quoted 2 lines

Why is no diff output generated by the software combination “Coccinelle 1.2-00008-g75525032” so far?

Your semantic patch needs to be:

@display@
@@
my_action(...);
<+... when any
*my_action(...);
...+>

Quoted 3 lines

Without that, a call to my_action is forbidden in the region matched by the <+... ...+>. Because any kind of dot thing matches the shortest path between what comes before and what comes after (here the end of the function).

Thanks for this quick feedback.

Quoted 7 lines

It seems that we expect different data processing also for the shown test case.

The SmPL construct “<+... … ...+>” supports a search for code parts which occur at least once.
Thus it seems that the specified search pattern needs be duplicated before if you would like to find code which should occur at least twice.
I would appreciate if undesirable duplication of search patterns can be avoided here.

If you want to find code that occurs at least twice, isn't it most natural to make a pattern that shows the thing occurring twice?

julia

#10 lore raw
Quoted 4 lines
Quoted 1 line

I would appreciate if undesirable duplication of search patterns can be avoided here.

If you want to find code that occurs at least twice, isn't it most natural to make a pattern that shows the thing occurring twice?

Obviously, yes.

Our development views seem to differ in the desire to express such a data processing task in a more succinct way also by the means of the semantic patch language.

Which SmPL constructs can indicate a minimum occurrence number (≥ 2) accordingly?

Regards,
Markus

#11 lore raw
Quoted 5 lines · Markus Elfring
Quoted 4 lines
Quoted 1 line

I would appreciate if undesirable duplication of search patterns can be avoided here.

If you want to find code that occurs at least twice, isn't it most natural to make a pattern that shows the thing occurring twice?

Quoted 7 lines

Obviously, yes.

Our development views seem to differ in the desire to express such a data processing task in a more succinct way also by the means of the semantic patch language.

Which SmPL constructs can indicate a minimum occurrence number (≥ 2) accordingly?

There is no dedicated construct for that purpose.

julia

#12 lore raw
Quoted 3 lines
Quoted 1 line

Which SmPL constructs can indicate a minimum occurrence number (≥ 2) accordingly?

There is no dedicated construct for that purpose.

Will chances grow to extend involved software components?

Regards,
Markus

#13 lore raw
Quoted 5 lines · Markus Elfring
Quoted 3 lines
Quoted 1 line

Which SmPL constructs can indicate a minimum occurrence number (≥ 2) accordingly?

There is no dedicated construct for that purpose.

Will chances grow to extend involved software components?

No.

#14 lore raw
In reply to Julia Lawall
Quoted 9 lines

Your semantic patch needs to be:

@display@
@@
my_action(...);
<+... when any
*my_action(...);
...+>

Quoted 3 lines

Without that, a call to my_action is forbidden in the region matched by the <+... ...+>. Because any kind of dot thing matches the shortest path between what comes before and what comes after (here the end of the function).

Can the Coccinelle software inform better about the case that the shortest path constraint was “accidentally overlooked” in a SmPL script?

There are further development challenges to consider. See also a corresponding transformation approach by the means of another tiny script for the semantic patch language:

@adjustment@
@@
my_action(
- ...
+ 0

          );

<+... when any
-my_action(...);
...+>

Test result:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch use_one_test_call.cocci repeated_three_calls.c …
previous modification:

<<< 0
CONTEXT

According to environment 0:

current modification:
MINUS

According to environment 0:

adjustment: already tagged token:
C code context
File "repeated_three_calls.c", line 4, column 12, charpos = 48
around = ')',
whole content = my_action(2);

Can the data processing be improved anyhow?

Regards,
Markus

#15 lore raw
Quoted 49 lines · Markus Elfring
Quoted 9 lines

Your semantic patch needs to be:

@display@
@@
my_action(...);
<+... when any
*my_action(...);
...+>

Quoted 3 lines

Without that, a call to my_action is forbidden in the region matched by the <+... ...+>. Because any kind of dot thing matches the shortest path between what comes before and what comes after (here the end of the function).

Can the Coccinelle software inform better about the case that the shortest path constraint was “accidentally overlooked” in a SmPL script?

There are further development challenges to consider. See also a corresponding transformation approach by the means of another tiny script for the semantic patch language:

@adjustment@
@@
my_action(

(quoted diff) +1 -2
-          ...
+          0
          );
 <+... when any
-my_action(...);
 ...+>

Test result:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch use_one_test_call.cocci repeated_three_calls.c …
previous modification:

<<< 0
CONTEXT

According to environment 0:

current modification:
MINUS

According to environment 0:

Quoted 8 lines

adjustment: already tagged token:
C code context
File "repeated_three_calls.c", line 4, column 12, charpos = 48
around = ')',
whole content = my_action(2);

Can the data processing be improved anyhow?

The current semantic pach allows the first my_action to match anywhere, including the second my_action, third, etc. So if you have changes in both, then there will be contradictory changes to the code.

Probably you should start with ... when != my_action(...) to be sure to get the first one.

julia

#16 lore raw
Quoted 5 lines
Quoted 1 line

Can the data processing be improved anyhow?

The current semantic pach allows the first my_action to match anywhere, including the second my_action, third, etc. So if you have changes in both, then there will be contradictory changes to the code.

I suggest to reconsider such information in more detail according to the presented transformation approach.

Quoted 2 lines

Probably you should start with ... when != my_action(...) to be sure to get the first one.

I would expect that only the first function call should be matched by the initial SmPL search pattern (without an extra when constraint). Should subsequent repeated calls be taken into account only for the shown deletion attempt?

Regards,
Markus

#17 lore raw
Quoted 10 lines · Markus Elfring
Quoted 5 lines
Quoted 1 line

Can the data processing be improved anyhow?

The current semantic pach allows the first my_action to match anywhere, including the second my_action, third, etc. So if you have changes in both, then there will be contradictory changes to the code.

I suggest to reconsider such information in more detail according to the presented transformation approach.

Quoted 5 lines
Quoted 2 lines

Probably you should start with ... when != my_action(...) to be sure to get the first one.

I would expect that only the first function call should be matched by the initial SmPL search pattern (without an extra when constraint).

Why would you expect that? Coccinelle looks through your function and matches the pattern anywhere it can. The matches are independent of each other.

julia

Quoted 6 lines

Should subsequent repeated calls be taken into account only for the shown deletion attempt?

Regards,
Markus

#18 lore raw
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Probably you should start with ... when != my_action(...) to be sure to get the first one.

I would expect that only the first function call should be matched by the initial SmPL search pattern (without an extra when constraint).

Why would you expect that?

I expect here that specific source code starts a known statement list.

Quoted 1 line

Coccinelle looks through your function and matches the pattern anywhere it can.

Can this software distinguish also better statement sequences accordingly?

Quoted 1 line

The matches are independent of each other.

* They can occasionally occur in different scopes.

* Statement sequences (which include discussed repetitions) should be “interrupted” by other source code.

Regards,
Markus

#19 lore raw
Quoted 9 lines · Markus Elfring
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Probably you should start with ... when != my_action(...) to be sure to get the first one.

I would expect that only the first function call should be matched by the initial SmPL search pattern (without an extra when constraint).

Why would you expect that?

I expect here that specific source code starts a known statement list.

Coccinelle takes a pattern expressed as a CTL formula and every node in the control flow graph and tries to match the pattern at each node. The matching at one node is independent of the matching at another node. If there are conflicting matches that result in conflicting transformations, then it generates an error message.

julia

Quoted 17 lines
Quoted 3 lines

Coccinelle looks through your function and matches the pattern anywhere it can.

Can this software distinguish also better statement sequences accordingly?

Quoted 1 line

The matches are independent of each other.

* They can occasionally occur in different scopes.

* Statement sequences (which include discussed repetitions) should be “interrupted” by other source code.

Regards,
Markus

#20 lore raw
Quoted 7 lines
Quoted 1 line

I expect here that specific source code starts a known statement list.

Coccinelle takes a pattern expressed as a CTL formula and every node in the control flow graph and tries to match the pattern at each node. The matching at one node is independent of the matching at another node. If there are conflicting matches that result in conflicting transformations, then it generates an error message.

Do we stumble on conflicts for more desirable data processing also according to involved computation tree logic variants?

The mentioned nodes should occasionally mark the beginning and a corresponding end of a code sequence.
Will code sequences (as statement lists in the discussed test case) become better supported in the way as known units (or building blocks)?

Regards,
Markus

#21 lore raw
In reply to Julia Lawall
Quoted 4 lines
Quoted 1 line

I expect here that specific source code starts a known statement list.

Coccinelle takes a pattern expressed as a CTL formula and every node in the control flow graph and tries to match the pattern at each node.

…

Which filter criteria does the applied computation tree logic variant need to recognise an item as the beginning of a sequence?

Regards,
Markus

#22 lore raw
In reply to Julia Lawall
Quoted 2 lines

Probably you should start with ... when != my_action(...) to be sure to get the first one.

Should any SmPL search item which is specified at the beginning of an SmPL rule be handled by the Coccinelle software as the first source code filter also without an extra when constraint?

Can it be checked if such a primary condition is really evaluated in the desired order?

Regards,
Markus

#23 lore raw
Quoted 6 lines · Markus Elfring
Quoted 2 lines

Probably you should start with ... when != my_action(...) to be sure to get the first one.

Should any SmPL search item which is specified at the beginning of an SmPL rule be handled by the Coccinelle software as the first source code filter also without an extra when constraint?

No. Surely you don't want that. If you ask to replace all X's by Y, then you normally want to replace all of them.

Quoted 2 lines

Can it be checked if such a primary condition is really evaluated in the desired order?

No idea what this means. "desired order" is just something that exists in the head of the person who wrote the rule. Coccinelle doesn't know that.

julia

#24 lore raw
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Probably you should start with ... when != my_action(...) to be sure to get the first one.

Should any SmPL search item which is specified at the beginning of an SmPL rule be handled by the Coccinelle software as the first source code filter also without an extra when constraint?

No. Surely you don't want that. If you ask to replace all X's by Y, then you normally want to replace all of them.

Such a transformation depends on context code which should be replaced finally.

Quoted 5 lines
Quoted 2 lines

Can it be checked if such a primary condition is really evaluated in the desired order?

No idea what this means. "desired order" is just something that exists in the head of the person who wrote the rule. Coccinelle doesn't know that.

I am trying out to determine once more if the presented use case can work also without an extra when constraint.

The following SmPL script variant can generate a reasonable diff output for a test case.

@adjustment@
@@
... when != my_action(...)
my_action(
- ...
+ 0

          );

<+... when any
-my_action(...);
...+>

But I find the shown duplication of SmPL code questionable and therefore improvable.

Regards,
Markus

#25 lore raw
Quoted 38 lines · Markus Elfring
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Probably you should start with ... when != my_action(...) to be sure to get the first one.

Should any SmPL search item which is specified at the beginning of an SmPL rule be handled by the Coccinelle software as the first source code filter also without an extra when constraint?

No. Surely you don't want that. If you ask to replace all X's by Y, then you normally want to replace all of them.

Such a transformation depends on context code which should be replaced finally.

Quoted 5 lines
Quoted 2 lines

Can it be checked if such a primary condition is really evaluated in the desired order?

No idea what this means. "desired order" is just something that exists in the head of the person who wrote the rule. Coccinelle doesn't know that.

I am trying out to determine once more if the presented use case can work also without an extra when constraint.

The following SmPL script variant can generate a reasonable diff output for a test case.

@adjustment@
@@
... when != my_action(...)
my_action(

(quoted diff) +1 -2
-          ...
+          0
          );
 <+... when any
-my_action(...);
 ...+>
Quoted 1 line

But I find the shown duplication of SmPL code questionable and therefore improvable.

The language is as it is. You can express various things by adding more or less information.

julia

#26 lore raw
Quoted 12 lines
Quoted 12 lines

@adjustment@
@@
... when != my_action(...)
my_action(

(quoted diff) +1 -2
-          ...
+          0
          );
 <+... when any
-my_action(...);
 ...+>
Quoted 4 lines
Quoted 1 line

But I find the shown duplication of SmPL code questionable and therefore improvable.

The language is as it is. You can express various things by adding more or less information.

I got the impression that undesirable software limitations are indicated here.

See also the software development principle “Do not repeat yourself”:
https://en.wikipedia.org/wiki/Don%27t_repeat_yourself

Regards,
Markus

#27 lore raw
In reply to Julia Lawall
Quoted 2 lines

The language is as it is. You can express various things by adding more or less information.

The previous SmPL script example indicated special SmPL code design possibilities. Thus I would like to apply such development experiences to another SmPL script variant.

// See also:
// qca_read_fw_build_info()
// drivers/bluetooth/btqca.c
@replacement@
identifier exit, result;
statement s;
@@
... when != if (...) { ... when any result = -EILSEQ; goto exit; }
(if (...)
-{
- result = -EILSEQ;
goto
- exit
+ e_ilseq

    ;

-}
|if (...)
{
... when any
- result = -EILSEQ;
goto
- exit
+ e_ilseq

    ;

}
)
...
exit:
s
return result;
+
+e_ilseq:
+result = -EILSEQ;
+goto exit;

Test result:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> spatch --parse-cocci use_common_code_for_EILSEQ-4.cocci …
minus: parse error:
File "use_common_code_for_EILSEQ-4.cocci", line 8, column 37, charpos = 162
around = 'result',
whole content = ... when != if (...) { ... when any result = -EILSEQ; goto exit; }

Unfortunately, it seems that I stumble once more on questionable software limitations.

Regards,
Markus

#28 lore raw
Quoted 7 lines · Markus Elfring
Quoted 2 lines

The language is as it is. You can express various things by adding more or less information.

The previous SmPL script example indicated special SmPL code design possibilities. Thus I would like to apply such development experiences to another SmPL script variant.

Quoted 8 lines

// See also:
// qca_read_fw_build_info()
// drivers/bluetooth/btqca.c
@replacement@
identifier exit, result;
statement s;
@@
... when != if (...) { ... when any result = -EILSEQ; goto exit; }

There is currently no way to nest whens.

julia

Quoted 42 lines

(if (...)

(quoted diff) +1 -4
-{
-   result = -EILSEQ;
    goto
-        exit
+        e_ilseq
    ;
-}

|if (...)
{
... when any

(quoted diff) +1 -2
-   result = -EILSEQ;
    goto
-        exit
+        e_ilseq
    ;
 }

)
...
exit:
s
return result;

(quoted diff) +4 -0
+
+e_ilseq:
+result = -EILSEQ;
+goto exit;

Test result:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> spatch --parse-cocci use_common_code_for_EILSEQ-4.cocci …
minus: parse error:
File "use_common_code_for_EILSEQ-4.cocci", line 8, column 37, charpos = 162
around = 'result',
whole content = ... when != if (...) { ... when any result = -EILSEQ; goto exit; }

Unfortunately, it seems that I stumble once more on questionable software limitations.

Regards,
Markus

#29 lore raw
In reply to Markus Elfring
Quoted 12 lines

Source code parts can occasionally be repeated.

* Loops
The control flow can contain ordinary loops.

* Recursion
A function may be called by itself.

Such constructs trigger special consequences also for further data processing with higher level technologies.

Quoted 7 lines

+ Computation tree logic

+ Linear temporal logic

I am still looking for clarifications so that the Coccinelle software can be applied in safer ways.

Would you like to acknowledge that data processing is influenced also according to handling of loops and recursion by the means of the provided technology “computation tree logic with variables and witnesses”?

Do you find a paper like “Cycle Detection in Computation Tree Logic” interesting for corresponding adjustments?
https://www.fabiomogavero.com/publications/jarticles/2018/fmmps(ic18).pdf
https://dx.doi.org/10.1016/j.ic.2018.09.007

Regards,
Markus

#30 lore raw
In reply to Markus Elfring
Quoted 1 line

Source code parts can occasionally be repeated.

Would you like to clarify how the data processing for scripts of the semantic patch language should be influenced by the program parameter “--no-loops”?
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/477e7e12478bd317aa97ee79857d185601ab6f33/docs/manual/spatch_options.tex#L365
https://github.com/coccinelle/coccinelle/blob/477e7e12478bd317aa97ee79857d185601ab6f33/docs/manual/spatch_options.tex#L365

Regards,
Markus

#31 lore raw
Quoted 7 lines · Markus Elfring
Quoted 1 line

Source code parts can occasionally be repeated.

Would you like to clarify how the data processing for scripts of the semantic patch language should be influenced by the program parameter “--no-loops”?
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/477e7e12478bd317aa97ee79857d185601ab6f33/docs/manual/spatch_options.tex#L365
https://github.com/coccinelle/coccinelle/blob/477e7e12478bd317aa97ee79857d185601ab6f33/docs/manual/spatch_options.tex#L365

--noloops mean that the back edge of a loop is ignored. It can greatly reduce running time.

julia

#32 lore raw
Quoted 9 lines
Quoted 7 lines
Quoted 1 line

Source code parts can occasionally be repeated.

Would you like to clarify how the data processing for scripts of the semantic patch language should be influenced by the program parameter “--no-loops”?
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/477e7e12478bd317aa97ee79857d185601ab6f33/docs/manual/spatch_options.tex#L365
https://github.com/coccinelle/coccinelle/blob/477e7e12478bd317aa97ee79857d185601ab6f33/docs/manual/spatch_options.tex#L365

--noloops mean that the back edge of a loop is ignored.

Do “back edges” occasionally need special treatment according to the evaluation of computation tree logic variants?

Quoted 1 line

It can greatly reduce running time.

Such information is good to know for more desirable run time characteristics.

* Will the software evolve any further also for better detection of duplicate source code?

* How good are statement sequences actually handled so far?

Regards,
Markus

#33 lore raw
In reply to Julia Lawall
Quoted 1 line

--noloops mean that the back edge of a loop is ignored.

Should the program parameter “--no-loops” influence also the handling of Linux “iterators” (like “list_for_each_entry_safe”) anyhow?

Regards,
Markus

#34 lore raw
Quoted 4 lines · Markus Elfring
Quoted 1 line

--noloops mean that the back edge of a loop is ignored.

Should the program parameter “--no-loops” influence also the handling of Linux “iterators” (like “list_for_each_entry_safe”) anyhow?

No idea.

#35 lore raw
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

--noloops mean that the back edge of a loop is ignored.

Should the program parameter “--no-loops” influence also the handling of Linux “iterators” (like “list_for_each_entry_safe”) anyhow?

No idea.

How do you think about to take another look at further diff outputs which can be generated by a simple SmPL script example?

Analysing statement sequences in consistent ways (with SmPL)?
https://lore.kernel.org/cocci/[email protected]/
https://sympa.inria.fr/sympa/arc/cocci/2024-05/msg00076.html

Source files for corresponding clarification opportunities:

* ath6kl_set_multicast_list()
https://elixir.bootlin.com/linux/v6.9.1/source/drivers/net/wireless/ath/ath6kl/main.c#L1232

* batadv_frag_merge_packets()
https://elixir.bootlin.com/linux/v6.9.1/source/net/batman-adv/fragmentation.c#L258

* iavf_reset_task()
https://elixir.bootlin.com/linux/v6.9.1/source/drivers/net/ethernet/intel/iavf/iavf_main.c#L3097

* bch_pending_bdevs_cleanup()
https://elixir.bootlin.com/linux/v6.9.1/source/drivers/md/bcache/super.c#L2691

Regards,
Markus