Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: francois.berenger@inria.fr (Francois Berenger)
To: cocci@systeme.lip6.fr
Subject: [Cocci] What is the spatch file for this change and the corresponding spatch command line invocation
Date: Thu, 04 Dec 2014 15:31:59 +0100	[thread overview]
Message-ID: <5480705F.6000608@inria.fr> (raw)
In-Reply-To: <alpine.DEB.2.10.1412041354440.2118@hadrien>

On 12/04/2014 01:56 PM, Julia Lawall wrote:
>
>
> On Thu, 4 Dec 2014, Francois Berenger wrote:
>
>> On 12/03/2014 06:34 PM, Luis R. Rodriguez wrote:
>>> On Wed, Dec 03, 2014 at 06:29:54PM +0100, Francois Berenger wrote:
>>>> Hello,
>>>>
>>>> I give up trying to write the spatch myself:
>>>>
>>>> Before file:
>>>> ---
>>>> int i;
>>>>
>>>> for ( ; ; ++i ) {
>>>>     if (1) {
>>>>       continue;
>>>>     }
>>>> }
>>>> ---
>>>>
>>>> After file:
>>>> ---
>>>> int i;
>>>>
>>>> for ( ; ; ) {
>>>>     if (1) {
>>>>       ++i;
>>>>       continue;
>>>>     }
>>>>     ++i;
>>>> }
>>>> ---
>>>>
>>>> All my trials don't work, not any change in the file appears
>>>> if I try --in-place and -o fails because
>>>> "-o can not be applied because there are no modified files"
>>>
>>> Can you take the hands on tutorial before expecting folks to
>>> write rules for you?
>>>
>>> https://www.youtube.com/watch?v=buZrNd6XkEw
>>
>> If I really need to invest two hours before being able to use coccinelle
>> productively, that would be a serious entry barrier.
>>
>> And probably not just for me: for any potential new user of
>> coccinelle.
>
> I think that you may have started with an unfortunate case.  I'm not sure
> what is the strategy for matching the empty space in a for header.  It's
> not an expression, so what is it.

It is an optional expression: either there is an expression, either 
there is none.
I could not find such thing in the SmPL grammar manual (v1.0.0-rc21).

>  It may be possible only to match it
> exactly.
>
> On the other hand, it is helpful if you provide a semantic patch that
> you have tried, rather than just the before and after code.  From one
> example of before and after code, it is not always possible to guess the
> full generality of the rule that you are trying to implement.
>
> julia
>

-- 
Regards,
Francois.

  parent reply	other threads:[~2014-12-04 14:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03 17:29 [Cocci] What is the spatch file for this change and the corresponding spatch command line invocation Francois Berenger
2014-12-03 17:34 ` Luis R. Rodriguez
2014-12-04 12:49   ` Francois Berenger
2014-12-04 12:56     ` Julia Lawall
2014-12-04 13:00       ` Francois Berenger
2014-12-04 17:31         ` Luis R. Rodriguez
2014-12-04 14:31       ` Francois Berenger [this message]
2014-12-03 18:13 ` Julia Lawall
2014-12-04 10:17   ` Francois Berenger
2014-12-04 10:29     ` Julia Lawall
2014-12-04 10:40       ` Francois Berenger
2014-12-04 11:00         ` Francois Berenger
2014-12-04 11:22         ` Julia Lawall

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=5480705F.6000608@inria.fr \
    --to=francois.berenger@inria.fr \
    --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