From: Michael Stefaniuc <mstefani@mykolab.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Matching more than one declaration?
Date: Fri, 03 May 2019 10:03:04 +0200 [thread overview]
Message-ID: <04697af8fb0c96a2e14d15fc11d708a7@mykolab.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1905030916530.3572@hadrien>
[-- Attachment #1: Type: text/plain, Size: 613 bytes --]
On 2019-05-03 09:17, Julia Lawall wrote:
> On Thu, 2 May 2019, Michael Stefaniuc wrote:
>
>> Hello,
>>
>> it seems that more than one declaration cannot be matched in one rule:
>>
>> @@
>> identifier i, f;
>> @@
>> - int i;
>> - int f;
>>
>> That won't match
>>
>> void foo(void)
>> {
>> int i;
>> float f;
>
> The semantic patch has int int and the code has int float. If the code
> has int int, it matches fine.
Duh... I messed it up while simplifying my test case :/
It does work but only in function scope and not in global scope.
I've attached the fixed test case.
thanks
bye
michael
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: declare.c --]
[-- Type: text/x-c; name=declare.c, Size: 60 bytes --]
int i;
float f;
void foo(void)
{
int i;
float f;
}
[-- Attachment #3: declare.cocci --]
[-- Type: text/plain, Size: 43 bytes --]
@@
identifier i, f;
@@
- int i;
- float f;
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: declare.diff --]
[-- Type: text/x-diff; name=declare.diff, Size: 133 bytes --]
--- declare.c
+++ /tmp/cocci-output-5279-c2f13d-declare.c
@@ -3,6 +3,4 @@ float f;
void foo(void)
{
- int i;
- float f;
}
[-- Attachment #5: Type: text/plain, Size: 136 bytes --]
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2019-05-03 8:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-02 21:04 [Cocci] Matching more than one declaration? Michael Stefaniuc
2019-05-03 7:17 ` Julia Lawall
2019-05-03 8:03 ` Michael Stefaniuc [this message]
2019-05-03 20:39 ` Julia Lawall
2019-05-03 20:44 ` Michael Stefaniuc
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=04697af8fb0c96a2e14d15fc11d708a7@mykolab.com \
--to=mstefani@mykolab.com \
--cc=cocci@systeme.lip6.fr \
--cc=julia.lawall@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;
as well as URLs for NNTP newsgroup(s).