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] Matching functions with attributes
Date: Wed, 21 Jan 2015 17:15:21 +0100	[thread overview]
Message-ID: <54BFD099.8030002@users.sourceforge.net> (raw)
In-Reply-To: <D59A6A6F-9D60-44DE-9B6C-8B615B776EA8@gmail.com>

> Then, would there be any way to match functions having the
> literal ?FUNC_ATTR_NONNULL_RET? in their declaration/definition?

A preprocessor symbol like "NULL" or "ZERO_OR_NULL_PTR" can be found
at least.   ;-)

Would you like to try it out how many source code places can be found
with your macro name?


> @@ identifier func =~ "^(transstr|list_alloc|listitem_alloc| [...] |concat_str)$"; [...] @@
> 
>   var = func(...);
>   ... when != var = E
> (
> * if (var == NULL) S;
> |
> * if (var != NULL) S;
> )

Does this kind of SmPL disjunction make sense?


> ```
> 
> As you see, I have to replicate the list.

I would also appreciate if such repetition could be avoided for
SmPL constraints.


> Is there any better way to achieve the same effect?

How do you think about to construct the desired regular expression
by other programming scripts automatically?

Would you like to store involved function names into specific
data structures (like databases)?

Regards,
Markus

  reply	other threads:[~2015-01-21 16:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 14:05 [Cocci] Matching functions with attributes Eliseo Martínez
2015-01-21 16:15 ` SF Markus Elfring [this message]
2015-01-21 17:28   ` Eliseo Martínez
2015-01-21 18:03     ` SF Markus Elfring
2015-01-21 21:36       ` Eliseo Martínez
2015-01-21 21:46     ` Julia Lawall
2015-01-21 22:47       ` Eliseo Martínez
2015-01-22  5:58         ` Julia Lawall
2015-01-22  8:45         ` SF Markus Elfring
2015-01-22  8:59         ` SF Markus Elfring
2015-01-22  9:23           ` Eliseo Martínez
2015-01-22  9:36             ` Eliseo Martínez
2015-01-22 10:11               ` SF Markus Elfring
2015-01-22 11:52             ` Julia Lawall
2015-01-22 12:56               ` Eliseo Martínez
2015-01-22 14:44                 ` Julia Lawall
2015-01-22 15:28                 ` SF Markus Elfring
2015-01-22  8:29       ` [Cocci] Run time differences between SmPL disjunctions and regular expressions (in constraints) SF Markus Elfring
2015-01-22  8:37         ` Julia Lawall
2015-01-22  9:50           ` SF Markus Elfring
2015-01-27 19:01 ` [Cocci] Matching functions with attributes 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=54BFD099.8030002@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.