All of lore.kernel.org
 help / color / mirror / Atom feed
From: der.herr@hofr.at (Nicholas Mc Guire)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Fatal error: exception Failure("not supported")
Date: Sun, 17 May 2015 08:18:03 +0200	[thread overview]
Message-ID: <20150517061803.GA32427@opentech.at> (raw)


Hi !

 Writing some simple checks for user-space sample code to check that a 
 read loop has some error checking in it - the read loop should look 
 something like this:

        do {
                len = read(fd, buff + off, BUFFSIZE);
                if (len < 0 && len != -EAGAIN) {
                        perror("read failed");
                        exit(-1);
                }
                off += len;
        } while (len > 0);

to check this the following cocci spatch was intended 

<snip>
virtual report
virtual org

@check_open@
identifier f,retval;
idexpression int fd;
idexpression int l;
idexpression int o;
idexpression char * b;
position p;
@@

f(...) {
<+...
 do {
 ...
 l = read@p(fd,b+o,...);
 if (l < 0 && l != -EAGAIN) {
? perror(...);
(
  exit(...);
|
  return ...;
)
}
 l = l + o;                                                                                               
} while ( l > 0);
return retval;
...+>
}


@script: python@
p<<check_open.p;
fn<<check_open.f;
@@
print "OK: read loop in %s:%s line %s checking errors" % (p[0].file,fn, p[0].line)
<snip>

 spatch --parse-cocci gives no errors and the output looks fine (just the iso
 expansions basically) - but when run with:
  spatch --sp-file check_read_loop.cocci open_read_ok.c
 its giving me:
  init_defs_builtins: /usr/local/share/coccinelle/standard.h
  Fatal error: exception Failure("not supported")

how can I figure out what is "not supported" here ?

thx!
hofrat

             reply	other threads:[~2015-05-17  6:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-17  6:18 Nicholas Mc Guire [this message]
2015-05-17 12:08 ` [Cocci] Fatal error: exception Failure("not supported") Sébastien Hinderer
2015-05-17 13:11   ` Julia Lawall
2015-05-17 13:28     ` Nicholas Mc Guire
2015-05-17 13:52       ` Julia Lawall
2015-05-17 15:05     ` [Cocci] Support for "do { … } while"? 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=20150517061803.GA32427@opentech.at \
    --to=der.herr@hofr.at \
    --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.