Skip to contentSkip to conversation

Combining isomorphisms with source code adjustments?

Cocci Markus Elfring 2 participants 3 messages Apr 22, 2020

lore
Share & tools
lore
#0 lore raw

Hello,

I have taken another look at the following information.
https://github.com/coccinelle/coccinelle/blob/6b4bb692f208bfe86e62a616724570d9310c7150/standard.iso#L544

…
// Affectation/initialisation isomorphism
…
// They are handled in engine.
// 'X = Y' should also match 'type X = Y';
…

I have tried another script out for the semantic patch language.

@deletion@
expression input, storage, target;
@@
storage
- = input
... when != storage
target = ...

elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci delete_unused_value4.cocci …
the simple assignment expression on line 4 contains transformations
that prevent it from matching a declaration (not pure)
…

How do you think about the software situation?

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#1 lore raw
Quoted 24 lines · Markus Elfring

Hello,

I have taken another look at the following information.
https://github.com/coccinelle/coccinelle/blob/6b4bb692f208bfe86e62a616724570d9310c7150/standard.iso#L544

…
// Affectation/initialisation isomorphism
…
// They are handled in engine.
// 'X = Y' should also match 'type X = Y';
…

I have tried another script out for the semantic patch language.

@deletion@
expression input, storage, target;
@@
storage
- = input
... when != storage
target = ...

Quoted 8 lines

elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci delete_unused_value4.cocci …
the simple assignment expression on line 4 contains transformations
that prevent it from matching a declaration (not pure)
…

How do you think about the software situation?

I think what the message says. You have put a - in an awkward place so it may not be able to apply some isomorphisms.

julia

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#2 lore raw
Quoted 16 lines
Quoted 16 lines

@deletion@
expression input, storage, target;
@@
storage
- = input
... when != storage
target = ...

elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci delete_unused_value4.cocci …
the simple assignment expression on line 4 contains transformations
that prevent it from matching a declaration (not pure)
…

Quoted 4 lines
Quoted 1 line

How do you think about the software situation?

I think what the message says. You have put a - in an awkward place so it may not be able to apply some isomorphisms.

I got the impression that the Coccinelle software can handle changes together with isomorphisms at other source code places already.

* Why is this functionality restricted here?

* The reported software limitation can trigger undesirable code duplication if a corresponding transformation approach would be required so far to express extra case distinctions by the means of SmPL disjunctions.

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci