Skip to contentSkip to conversation

Searching for C++ delete expressions (with SmPL)?

cocci Markus Elfring 2 participants 7 messages Aug 8, 2025 – Aug 9, 2025

lore
Share & tools
lore
#0 lore raw

Hello,

Another SmPL script example:
#spatch --c++
@display@
expression e;
@@
delete
?[]
*e

Questionable test result (by the software combination “Coccinelle 1.3.0” for example):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch --parse-cocci show_delete_expressions.cocci …
warning: incompatible arity found on line 5
…
delete [] *e
…

How will clarification interests evolve further for this issue?

Regards,
Markus

#1 lore raw
Quoted 21 lines · Markus Elfring

Hello,

Another SmPL script example:
#spatch --c++
@display@
expression e;
@@
delete
?[]
*e

Questionable test result (by the software combination “Coccinelle 1.3.0” for example):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch --parse-cocci show_delete_expressions.cocci …
warning: incompatible arity found on line 5
…
delete [] *e
…

Quoted 1 line

How will clarification interests evolve further for this issue?

In general, I don't think you can put ? on random subterms. You could do what you want with a disjunction.

julia

#2 lore raw
Quoted 10 lines
Quoted 10 lines

Another SmPL script example:
#spatch --c++
@display@
expression e;
@@
delete
?[]
*e

Quoted 5 lines
Quoted 5 lines

Questionable test result (by the software combination “Coccinelle 1.3.0” for example):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch --parse-cocci show_delete_expressions.cocci …
warning: incompatible arity found on line 5
…

…> In general, I don't think you can put ? on random subterms.

How will the support evolve further for key word variants of the programming language “C++”?

Quoted 2 lines

You could do
what you want with a disjunction.

Under which circumstances will the mentioned “warning” be reconsidered better?

Regards,
Markus

#3 lore raw
Quoted 17 lines · Markus Elfring
Quoted 10 lines
Quoted 10 lines

Another SmPL script example:
#spatch --c++
@display@
expression e;
@@
delete
?[]
*e

Quoted 5 lines
Quoted 5 lines

Questionable test result (by the software combination “Coccinelle 1.3.0” for example):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch --parse-cocci show_delete_expressions.cocci …
warning: incompatible arity found on line 5
…

…> In general, I don't think you can put ? on random subterms.

Quoted 7 lines

How will the support evolve further for key word variants of the programming language “C++”?

Quoted 2 lines

You could do
what you want with a disjunction.

Under which circumstances will the mentioned “warning” be reconsidered better?

None.

#4 lore raw
Quoted 3 lines
Quoted 1 line

Under which circumstances will the mentioned “warning” be reconsidered better?

None.

I hope that additional development resources will influence software evolution in more desirable directions.

Regards,
Markus

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

In general, I don't think you can put ? on random subterms. You could do what you want with a disjunction.

Will another SmPL script example trigger further collateral evolution?

#spatch --c++
@display@
expression e;
@@
(delete[]
*e
|delete
*e
)

Regards,
Markus