Re: [cocci] Searching for duplicate exception handling code with SmPL?
Julia Lawall <[email protected]> Sat, 20 Jun 2026 07:34:13 +0200 (CEST)
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--8323329-69992295-1781933653=:4048
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8BIT
On Fri, 19 Jun 2026, Markus Elfring wrote:
> …
> >> sys.stderr.write(f"{convert_to_seconds(init_time)}: Initialisation was finished.\n")
> >>
> >> @searching exists@
> >> expression e, x;
> >> identifier item, rc;
> >> position p1, p2;
> >> @@
> >> if (...)
> >> {
> >> ... when != rc = e
> >> when != item = x
> >> kfree@p1(item);
> >> return rc;
> >> }
> >> ... when any
> >> if (...)
> >> {
> >> ... when != rc = e
> >> when != item = x
> >
> > Do you really require that e and x bind to the same things at the two
> > occurrences?
>
> I would expect more that mentioned identifier variables should usually match
> distinct things.
What you expect doesn't matter. The semantics of Coccinelle is that if
there are two occurrences of a metavariable and they are not in different
branches of a disjunction, they have to match the same thing.
julia
>
>
> > If the running time is slow, that is probably why?
>
> I got the impression that other factors should be also reconsidered.
>
> How much can you follow presented execution duration measurements
> for corresponding test reproductions?
>
> Regards,
> Markus
>
--8323329-69992295-1781933653=:4048--