All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: cocci@inria.fr
Cc: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Subject: [cocci] parser error with loops
Date: Thu, 11 May 2023 14:32:09 +0200	[thread overview]
Message-ID: <20230511143209.23065a5e@nbbrfq> (raw)

Hi!

I'm encountering parser errors with loops.
Is this a known limitation that is maybe fixed already or am i doing
something wrong?

$ for i in /tmp/dummy-1.cocci /tmp/dummy.c ;do echo "# $i";cat $i;echo EOF;done
# /tmp/dummy-1.cocci
@ rule179 @
expression V, IX, INDEX, VAL;
@@
- for (IX = 0; (IX >= vec_safe_length (V)) ? false : (((void) (VAL = (*V)[IX].value)), (INDEX = (*V)[IX].index), true); (IX)++)
+ FOR_EACH_CONSTRUCTOR_ELT (V, IX, INDEX, VAL)

EOF
# /tmp/dummy.c
int i;
EOF
$ spatch --c++=11 --smpl-spacing --in-place --sp-file /tmp/dummy-1.cocci /tmp/dummy.c
init_defs_builtins: /usr/bin/../lib/coccinelle/standard.h
minus: parse error: 
  File "/tmp/dummy-1.cocci", line 7, column 0, charpos = 221
  around = '',
  whole content = 

$ spatch --version | sed 1q
spatch version 1.1.0 compiled with OCaml version 4.11.1
# off debian


PS: i get a similar error for other kinds of loops:
@ rule428 @
expression NODE, VAR;
@@
- do { tree var_ = (VAR); SSA_NAME_CHECK (NODE)->ssa_name.var = var_; SSA_NAME_IS_VIRTUAL_OPERAND (NODE) = (var_ && TREE_CODE (var_) == VAR_DECL && VAR_DECL_IS_VIRTUAL_OPERAND (var_)); } while (0)
+ SET_SSA_NAME_VAR_OR_IDENTIFIER (NODE, VAR)


thanks,

             reply	other threads:[~2023-05-11 12:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11 12:32 Bernhard Reutner-Fischer [this message]
2023-05-11 12:51 ` [cocci] parser error with loops 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=20230511143209.23065a5e@nbbrfq \
    --to=rep.dot.nop@gmail.com \
    --cc=cocci@inria.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.