Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Julia Lawall <julia.lawall@inria.fr>, cocci@inria.fr
Subject: Re: [cocci] Searching for repeated source code with SmPL?
Date: Sun, 12 May 2024 16:51:59 +0200	[thread overview]
Message-ID: <0f37e7b2-df29-44ac-b4da-69168bf7a85c@web.de> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2405121513320.6747@hadrien>

> The language is as it is.  You can express various things by adding more
> or less information.

The previous SmPL script example indicated special SmPL code design possibilities.
Thus I would like to apply such development experiences to another SmPL script variant.


// See also:
// qca_read_fw_build_info()
// drivers/bluetooth/btqca.c
@replacement@
identifier exit, result;
statement s;
@@
 ... when != if (...) { ... when any result = -EILSEQ; goto exit; }
(if (...)
-{
-   result = -EILSEQ;
    goto
-        exit
+        e_ilseq
    ;
-}
|if (...)
 {
 ... when any
-   result = -EILSEQ;
    goto
-        exit
+        e_ilseq
    ;
 }
)
 ...
 exit:
 s
 return result;
+
+e_ilseq:
+result = -EILSEQ;
+goto exit;


Test result:
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> spatch --parse-cocci use_common_code_for_EILSEQ-4.cocci
…
minus: parse error:
  File "use_common_code_for_EILSEQ-4.cocci", line 8, column 37, charpos = 162
  around = 'result',
  whole content =  ... when != if (...) { ... when any result = -EILSEQ; goto exit; }


Unfortunately, it seems that I stumble once more on questionable software limitations.

Regards,
Markus

  parent reply	other threads:[~2024-05-12 14:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-06 10:08 [cocci] Searching for repeated source code with SmPL? Markus Elfring
2024-05-06 10:09 ` Julia Lawall
2024-05-06 11:03   ` Markus Elfring
2024-05-06 12:10   ` Markus Elfring
2024-05-06 12:16     ` Julia Lawall
2024-05-06 12:40       ` Markus Elfring
2024-05-11 15:36   ` Markus Elfring
2024-05-11 16:04     ` Julia Lawall
2024-05-11 16:35       ` Markus Elfring
2024-05-11 16:37         ` Julia Lawall
2024-05-11 17:02           ` Markus Elfring
2024-05-11 17:12             ` Julia Lawall
2024-05-11 17:21               ` Markus Elfring
2024-05-11 17:33                 ` Julia Lawall
2024-05-12  6:48       ` Markus Elfring
2024-05-12  7:34         ` Julia Lawall
2024-05-12  8:01           ` Markus Elfring
2024-05-12  8:10             ` Julia Lawall
2024-05-12  8:33               ` Markus Elfring
2024-05-12  9:17                 ` Julia Lawall
2024-05-12  9:30                   ` Markus Elfring
2024-05-13  9:34                   ` Markus Elfring
2024-05-12 11:24           ` Markus Elfring
2024-05-12 12:53             ` Julia Lawall
2024-05-12 13:07               ` Markus Elfring
2024-05-12 13:13                 ` Julia Lawall
2024-05-12 13:22                   ` Markus Elfring
2024-05-12 14:51                   ` Markus Elfring [this message]
2024-05-12 14:57                     ` Julia Lawall
2024-05-11  7:15 ` Markus Elfring
2024-05-22  8:20 ` Markus Elfring
2024-05-22  8:24   ` Julia Lawall
2024-05-22  8:44     ` Markus Elfring
2024-05-22 13:12     ` Markus Elfring
2024-05-22 15:34       ` Julia Lawall
2024-05-22 16:06         ` Markus Elfring

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=0f37e7b2-df29-44ac-b4da-69168bf7a85c@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@inria.fr \
    --cc=julia.lawall@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).