Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Finding usage of the statement "goto" with SmPL
Date: Wed, 9 Dec 2015 14:50:48 +0100	[thread overview]
Message-ID: <566831B8.1020306@users.sourceforge.net> (raw)

Hello,

I have tried another tiny SmPL script out.

@jumping@
identifier label;
@@
*goto label;


This test example works as expected.

elfring at Sonne:~/Projekte/Coccinelle/janitor> spatch.opt show_goto_usage1.cocci ~/Projekte/Linux/next-patched/drivers/block/zram/zram_drv.c
?
@@ -1424,7 +1400,6 @@ static int __init zram_init(void)
                ret = zram_add();
                mutex_unlock(&zram_index_mutex);
                if (ret < 0)
-                       goto out_error;
                num_devices--;
        }
 

Now I am trying also to generate other display formats for the corresponding data
with a SmPL approach like the following.

?
@contains_goto@
identifier label, work;
position g_pos, pos;
type return_type;
@@
 return_type work at pos(...)
 {
 ... when any
 goto label at g_pos;
 ... when any
 }

@script:python collection depends on contains_goto@
fun << contains_goto.work;
places << contains_goto.pos;
go_to << contains_goto.label;
jump_at << contains_goto.g_pos;
@@
print("collection: " + "fun=" + fun + " | go_to=" + go_to)
store_positions(fun, places, go_to, jump_at)
?


elfring@Sonne:~/Projekte/Coccinelle/janitor/jumping1> spatch.opt list_functions_with_goto1.cocci ~/Projekte/Linux/next-patched/drivers/block/zram/zram_drv.c
?
No result for this analysis!


Unfortunately, I get the impression that the SmPL rule does not get executed
because the base rule "contains_goto" might not produce the desired data.
How should this surprise be resolved?

Regards,
Markus

             reply	other threads:[~2015-12-09 13:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-09 13:50 SF Markus Elfring [this message]
2015-12-09 14:01 ` [Cocci] Finding usage of the statement "goto" with SmPL Julia Lawall
2015-12-09 14:15   ` SF 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=566831B8.1020306@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=cocci@systeme.lip6.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