* [cocci] Searching for C++ delete expressions (with SmPL)?
@ 2025-08-08 8:00 Markus Elfring
2025-08-08 8:04 ` Julia Lawall
0 siblings, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2025-08-08 8:00 UTC (permalink / raw)
To: cocci; +Cc: Michele Martone
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [cocci] Searching for C++ delete expressions (with SmPL)?
2025-08-08 8:00 [cocci] Searching for C++ delete expressions (with SmPL)? Markus Elfring
@ 2025-08-08 8:04 ` Julia Lawall
2025-08-08 8:15 ` Markus Elfring
2025-08-09 6:44 ` Markus Elfring
0 siblings, 2 replies; 7+ messages in thread
From: Julia Lawall @ 2025-08-08 8:04 UTC (permalink / raw)
To: Markus Elfring; +Cc: cocci, Michele Martone
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
On Fri, 8 Aug 2025, Markus Elfring wrote:
> 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?
In general, I don't think you can put ? on random subterms. You could do
what you want with a disjunction.
julia
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [cocci] Searching for C++ delete expressions (with SmPL)?
2025-08-08 8:04 ` Julia Lawall
@ 2025-08-08 8:15 ` Markus Elfring
2025-08-08 8:29 ` Julia Lawall
2025-08-09 6:44 ` Markus Elfring
1 sibling, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2025-08-08 8:15 UTC (permalink / raw)
To: Julia Lawall, cocci; +Cc: Michele Martone
>> 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
>> …
…> 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++”?
> You could do
> what you want with a disjunction.
Under which circumstances will the mentioned “warning” be reconsidered better?
Regards,
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [cocci] Searching for C++ delete expressions (with SmPL)?
2025-08-08 8:15 ` Markus Elfring
@ 2025-08-08 8:29 ` Julia Lawall
2025-08-08 9:01 ` Markus Elfring
0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2025-08-08 8:29 UTC (permalink / raw)
To: Markus Elfring; +Cc: cocci, Michele Martone
[-- Attachment #1: Type: text/plain, Size: 843 bytes --]
On Fri, 8 Aug 2025, Markus Elfring wrote:
> >> 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
> >> …
> …> 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++”?
>
>
> > You could do
> > what you want with a disjunction.
>
> Under which circumstances will the mentioned “warning” be reconsidered better?
None.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [cocci] Searching for C++ delete expressions (with SmPL)?
2025-08-08 8:29 ` Julia Lawall
@ 2025-08-08 9:01 ` Markus Elfring
0 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-08-08 9:01 UTC (permalink / raw)
To: Julia Lawall, cocci; +Cc: Michele Martone
>> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [cocci] Searching for C++ delete expressions (with SmPL)?
2025-08-08 8:04 ` Julia Lawall
2025-08-08 8:15 ` Markus Elfring
@ 2025-08-09 6:44 ` Markus Elfring
2025-08-09 7:01 ` Markus Elfring
1 sibling, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2025-08-09 6:44 UTC (permalink / raw)
To: Julia Lawall, cocci; +Cc: Michele Martone
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [cocci] Searching for C++ delete expressions (with SmPL)?
2025-08-09 6:44 ` Markus Elfring
@ 2025-08-09 7:01 ` Markus Elfring
0 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2025-08-09 7:01 UTC (permalink / raw)
To: Julia Lawall, cocci; +Cc: Michele Martone
> Will another SmPL script example trigger further collateral evolution?
Would you be looking for SmPL script variations which can handle known
C++ source code transformation patterns to some degree?
* https://clang.llvm.org/extra/clang-tidy/checks/readability/delete-null-pointer.html
* https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#r11-avoid-calling-new-and-delete-explicitly
Regards,
Markus
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-08-09 7:01 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 8:00 [cocci] Searching for C++ delete expressions (with SmPL)? Markus Elfring
2025-08-08 8:04 ` Julia Lawall
2025-08-08 8:15 ` Markus Elfring
2025-08-08 8:29 ` Julia Lawall
2025-08-08 9:01 ` Markus Elfring
2025-08-09 6:44 ` Markus Elfring
2025-08-09 7:01 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).