Skip to content

Point effectless case distinctions out from SmPL disjunctions #400

@elfring

Description

@elfring

Disjunctions of the semantic patch language are using short-circuit evaluation.
It has got the consequence that the last element of the specified condition will only be checked if all previous parts did not match.
👀 Such a technical detail can occasionally be overlooked.

Another SmPL script example:

@test_replacements@
@@
(
-1
+9
|
-1 + 2
+3 + 4
)

Questionable test result (by the software combination “Coccinelle 1.3.0” for example):

Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch test-replace_expression.cocci return_test_addition.c
…
@@ -1,4 +1,4 @@
 int my_addition(void)
 {
- return 1 + 2;
+ return 9 + 2;
 }

💭 I would like to be notified somehow that such source code search patterns should be reconsidered once more.
🔮 Will any additional error explanations become helpful?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions