Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Finding non-zero returning functions with SmPL
Date: Mon, 27 Jul 2015 17:18:56 +0200	[thread overview]
Message-ID: <55B64BE0.7050303@users.sourceforge.net> (raw)

Hello,

I have tried the following small SmPL script out


@non_zero_returning_functions@
identifier work;
type return_type;
@@
*return_type work(...)
 {
  <+...
  return ... when != 0
             when != NULL
         ;
  ...+>
 }


on this bit of source code.


#include <API-test1.h>

int my_status(void)
{
  return 1;
}

int main(void)
{
  return my_status();
}


elfring at Sonne:~/Projekte/Coccinelle/janitor> spatch.opt -sp-file show_non-zero_returning_functions1.cocci ../Probe/API-test1.c
init_defs_builtins: /usr/local/lib/coccinelle/standard.h
116 120
Fatal error: exception Failure("minus: parse error: \n = File \"show_non-zero_returning_functions1.cocci\", line 8, column 13,  charpos = 116\n    around = 'when', whole content =   return ... when != 0;\n")


Do I use the SmPL construct "when" in an inappropriate way here?

Regards,
Markus

             reply	other threads:[~2015-07-27 15:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27 15:18 SF Markus Elfring [this message]
2015-07-27 15:34 ` [Cocci] Finding non-zero returning functions with SmPL Julia Lawall
2015-07-27 16:02   ` 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=55B64BE0.7050303@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox