All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolaus@rath.org (Nikolaus Rath)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Replacing one (specific!) type with another
Date: Sat, 08 Oct 2016 13:45:05 -0700	[thread overview]
Message-ID: <87shs6y3hq.fsf@vostro.rath.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1610080743040.3176@hadrien> (Julia Lawall's message of "Sat, 8 Oct 2016 07:50:50 +0200 (CEST)")

On Oct 08 2016, Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Fri, 7 Oct 2016, Nikolaus Rath wrote:
>
>> On Oct 06 2016, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> >> Somehow I'm having a really hard time grasping the fundamentals. The
>> >> first two examples make sense - I could adapt them for similar
>> >> situations. But then, I still have absolutely no idea how I would come
>> >> up with the third example, or how to adapt it. What does "idexpression"
>> >> mean? What does "ptr at p1" mean? Is this documented anywhere?
>> >
>> > idexpression is an expression that is resricted to be an identifier.  It
>> > allows you to put a type on an expression that has the form of an
>> > identifier.  You can also say identifier x;  But that is just a name.  It
>> > has no type.  It could be an expression, a field name, a parameter name,
>> > etc.
>>
>> Hm. Based on your last two sentences I'd conclude that 'idexpression'
>> matches variable names for variables of a specific type. But that
>> doesn't seem to be what you describe in your first two sentences. Could
>> you explain what you meant iwth "expression that has the form of an
>> identifier"?
>>
>> To me, an identifier is something that's written literally into the
>> source code and cannot be meaningfully taken apart, e.g. a function
>> name, variable name, or the member of a struct. An expression, on the
>> other hand, is something that can be meaningfully split into
>> sub-components. Is that also how you use these terms?
>
> An expression is something that has a value.  So an idexpression would be
> something that cannot be taken apart, but it is also used in a context
> where it has a value.  Unlike in the case of a parameter name or field
> name, where it is a name for something that will get a value in the
> future.

Got it, thanks!

>> > @ connects patterns that match the same term.  So match a term against the
>> > explicit name ptr and also match it against an identifier expression that
>> > has a particular type.  This is not exactly a beginner example.
>>
>> Okay, I'll just ignore that for now.
>>
>> >> I'd hate to waste your time asking tons of such trivial questions on the
>> >> mailing list, but I just can't find any helpful documentation at all...
>> >
>> > If you look on the web page in the papers and slides section, at the top
>> > there are several tutorials and overview talks, some with video.
>>
>> I think I looked at everything that is not a video. But none of it
>> mentioned that you can put an arbitrary name between the @@ or explained
>> what the different metavariable types (idexpression, expression, etc)
>> are.
>
> The name is illustrated in Advanced SmPL:
> http://coccinelle.lip6.fr/papers/cocciwk4_talk2.pdf

Call me stupid, but I just went through it again and I still don't see
it. There are lots of examples with "@ ..stuff..@" (the first on slide
4), but as far as I can tell it never explains what this means.

Actually, the frequent occurence of @script:python@ makes me think that
this actually has semantic signficance and is much more than a label
that I can choose for my own convenience...?
 

> A variety of metavariable types are listed in slide 11 of the Linux
> oriented tutorial: http://coccinelle.lip6.fr/papers/tutorial.pdf

Yes, I saw that. But I deliberately wrote "explained" rather than just
"listed" :-).


Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             ?Time flies like an arrow, fruit flies like a Banana.?

  reply	other threads:[~2016-10-08 20:45 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-05  3:27 [Cocci] Replacing one (specific!) type with another Nikolaus Rath
2016-10-05  5:45 ` Julia Lawall
2016-10-05 16:09   ` Nikolaus Rath
2016-10-05 16:39     ` Michael Stefaniuc
2016-10-05 17:21     ` [Cocci] Replacing one variable name " SF Markus Elfring
2016-10-05 22:34       ` Nikolaus Rath
2016-10-06  5:42         ` SF Markus Elfring
2016-10-06  5:56         ` Julia Lawall
2016-10-05 20:02     ` [Cocci] Replacing one (specific!) type " Julia Lawall
2016-10-05 22:38       ` Nikolaus Rath
2016-10-06  5:55         ` Julia Lawall
2016-10-08  3:16           ` Nikolaus Rath
2016-10-08  5:50             ` Julia Lawall
2016-10-08 20:45               ` Nikolaus Rath [this message]
2016-10-08 21:23                 ` Julia Lawall
2016-10-09  6:32                 ` SF Markus Elfring
2016-10-08  6:48             ` [Cocci] Usage of "expressions" and "identifiers" with SmPL SF Markus Elfring
2016-10-08  6:57               ` Julia Lawall
     [not found]               ` <alpine.DEB.2.10.1610080850470.7750@hadrien>
2016-10-08  7:49                 ` SF Markus Elfring
2016-10-08  7:56                   ` Julia Lawall
2016-10-08  8:26                     ` SF Markus Elfring
2016-10-08  8:38                       ` Julia Lawall
2016-10-08  9:25                         ` SF Markus Elfring
2016-10-08 20:28                           ` Nikolaus Rath
2016-10-09  7:49                             ` SF Markus Elfring
2016-10-09 20:38                               ` Nikolaus Rath
2016-10-10  6:48                                 ` SF Markus Elfring
2016-10-10  6:50                                   ` Julia Lawall
2016-10-06  6:30         ` [Cocci] Replacing one (specific!) type with another SF Markus Elfring
2016-10-08  4:22       ` Nikolaus Rath
2016-10-08  5:31         ` Julia Lawall
2016-10-08 20:52           ` Nikolaus Rath
2016-10-08 21:21             ` Julia Lawall
2016-10-09 20:45               ` Nikolaus Rath
2016-10-10  4:49                 ` Julia Lawall
2016-10-10  4:54                 ` Julia Lawall
2016-10-10 15:56                   ` Nikolaus Rath
2016-10-10 18:45                     ` Nikolaus Rath
2016-10-10 19:45                       ` Julia Lawall
2016-10-10 21:27                         ` Nikolaus Rath
2016-10-10 21:33                           ` Julia Lawall
2016-10-10 23:00                             ` Nikolaus Rath
2016-10-11  6:51                               ` Julia Lawall
2016-10-12 15:08                                 ` Nikolaus Rath
2016-10-12 20:37                                   ` Julia Lawall
2016-10-05  5:51 ` 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=87shs6y3hq.fsf@vostro.rath.org \
    --to=nikolaus@rath.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.