All of lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Find all variables/parameters of a given type.
Date: Fri, 16 Jan 2015 19:36:34 +0100	[thread overview]
Message-ID: <54B95A32.9090600@users.sourceforge.net> (raw)
In-Reply-To: <528DE554-4455-43F3-86D0-A4A1BE677755@gmail.com>

> I?m trying to write a semantic patch to be able to find
> all `long` variables/function parameters in my code.

Can the desired semantic filter approach be also written
without a SmPL disjunction?

Would you like to try the following variant out?

@find_integer_variable@
identifier var;
@@
*long var
 ... ;
)

@find_integer_within_function_declaration@
identifier func, var;
@@
 func(...,
*     long var,
      ...);
)

@find_integer_from_function_definition@
identifier func, var;
@@
 func(...,
*     long var,
      ...)
 { ... }


Are you looking for more special cases in your source code?

Regards,
Markus

  parent reply	other threads:[~2015-01-16 18:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16 12:42 [Cocci] Find all variables/parameters of a given type Eliseo Martínez
2015-01-16 17:51 ` Julia Lawall
2015-01-16 17:55 ` SF Markus Elfring
2015-01-16 18:10   ` Julia Lawall
2015-01-16 18:21     ` [Cocci] Support for function definitions within SmPL disjunctions? SF Markus Elfring
2015-01-16 18:36 ` SF Markus Elfring [this message]
2015-01-16 19:18   ` [Cocci] Find all variables/parameters of a given type Eliseo Martínez
2015-01-16 20:05     ` SF Markus Elfring
2015-01-16 20:22       ` Julia Lawall
2015-01-16 21:25         ` Eliseo Martínez
2015-01-16 20:11     ` 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=54B95A32.9090600@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 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.