All of lore.kernel.org
 help / color / mirror / Atom feed
From: julia.lawall@lip6.fr (Julia Lawall)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Adding missing parameter to function if missing
Date: Thu, 7 Jul 2016 19:09:20 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1607071908130.3620@hadrien> (raw)
In-Reply-To: <924f7230d5074b14b8658f65e00de85a@vprd-opci0018.b-com.local>



On Thu, 7 Jul 2016, Fr?d?ric LEROY (ext) wrote:

> Hello Julia,
>
> > > @ test depends on !fn_with_user@
> > > identifier fn_with_user.fn;
> > > parameter list pl;
> > [...]
> >
> > This rule is contradictory.  You say that the rule fn_with_user should not have
> > matched, but you want to match the identifier fn_with_user.fn.
> > Instead, you should match fn first, then have one rule that matches the case
> > you don't want, and then finally the case that you do want:
>
> I was desesperate to the point to try everything ;-)
>
> > When you match barfn, you create an environment for each possible value
> > of fn.  This is then passed through the next two rules, where it records
> > whether the rule fn_with_user matches.  There is a separate environment for
> > each match of barfn.
>
> Understood.
>
> I have narrowed the issue with the help of --debug to this part :
>
> @fn_with_user@
> identifier barfn.fn, foo;
> typedef my_type;

Te typedef here is fine, if you want the type to be called my_type.

> parameter list pl;
> expression E;
> @@
>
> fn(my_type *foo, pl) {
> <+...
> bar(foo, E);
> ...+>
> }
>
> I was confusing between the type name 'my_type' and type value 'my_type'.
>
> What I would to do is something like that :
>
> @fn_with_user@
> identifier fn, foo;
> typedef T = "my_type"; // '= ...' is not correct

I'm not sure to understand what is the point of this.

> parameter list pl;
> @@
>
> fn(T *foo, pl) {
> <+...
> bar(...);
> ...+>
> }
>
> But I don't know how to link 'my_type' value to type T ...
> I am sure that I am missing something obvious there :(

Was it not working with the code I suggested?

julia

> Sincerely,
>
> Fr?d?ric Leroy
>
>
>

  parent reply	other threads:[~2016-07-07 17:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06 13:54 [Cocci] Adding missing parameter to function if missing Frédéric LEROY (ext)
2016-07-06 16:23 ` Julia Lawall
2016-07-07 12:18   ` Frédéric LEROY (ext)
2016-07-07 16:14     ` [Cocci] Adding " SF Markus Elfring
2016-07-08 10:46       ` Frédéric LEROY (ext)
2016-07-07 17:09     ` Julia Lawall [this message]
2016-07-06 16:50 ` SF Markus Elfring
2016-07-07 11:54   ` Frédéric LEROY (ext)
2016-07-07 15:43     ` 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=alpine.DEB.2.10.1607071908130.3620@hadrien \
    --to=julia.lawall@lip6.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 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.