Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@inria.fr>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: cocci@inria.fr
Subject: Re: [cocci] How to fix parse errors for two SmPL scripts?
Date: Sat, 20 Jul 2024 14:28:45 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.22.394.2407201428360.28271@hadrien> (raw)
In-Reply-To: <76a0d20b-7328-4e5d-a8b8-c687bb11773e@web.de>

[-- Attachment #1: Type: text/plain, Size: 1579 bytes --]

This problem has been fixed.

julia

On Fri, 19 Jul 2024, Markus Elfring wrote:

> Hello,
>
> I stumbled on undesirable behaviour once more also with the software
> combination “Coccinelle 1.2-00021-gac9af0e8”.
>
> A)
>
> @replacement@
> constant char[] format1, format2;
> expression check, input, target;
> expression list el;
> identifier x;
> @@
> -if (check)
> -   target += x(input, format1, el);
> -else
> -   target += x(input, format2, el);
> +target += x(input, (check) ? format1 : format2, el);
>
>
> Questionable test result:
> Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> spatch --parse-cocci use_ternary_operator3.cocci
> …
> minus: parse error:
>   File "use_ternary_operator3.cocci", line 8, column 14, charpos = 144
>   around = 'x',
>   whole content = -   target += x(input, format1, el);
>
>
> B)
>
> @replacement2@
> expression check, context, target;
> expression list inputs;
> format list fl1, fl2;
> identifier action;
> @@
> -if (check)
> -   target += action(context, "%@fl1@", inputs);
> -else
> -   target += action(context, "%@fl2@", inputs);
> +target += action(context, (check) ? "%@fl1@" : "%@fl2@", inputs);
>
>
> Another questionable test result:
> Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> spatch --parse-cocci use_ternary_operator4.cocci
> …
> minus: parse error:
>   File "use_ternary_operator4.cocci", line 8, column 14, charpos = 144
>   around = 'action',
>   whole content = -   target += action(context, "%@fl1@", inputs);
>
>
> How can corresponding software components be improved?
>
> Regards,
> Markus
>

      parent reply	other threads:[~2024-07-20 12:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19 10:21 [cocci] How to fix parse errors for two SmPL scripts? Markus Elfring
2024-07-19 10:26 ` Julia Lawall
2024-07-19 10:31 ` Julia Lawall
2024-07-20 12:28 ` Julia Lawall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.22.394.2407201428360.28271@hadrien \
    --to=julia.lawall@inria.fr \
    --cc=Markus.Elfring@web.de \
    --cc=cocci@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).