All of lore.kernel.org
 help / color / mirror / Atom feed
* [cocci] parser error with loops
@ 2023-05-11 12:32 Bernhard Reutner-Fischer
  2023-05-11 12:51 ` Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Bernhard Reutner-Fischer @ 2023-05-11 12:32 UTC (permalink / raw)
  To: cocci; +Cc: Bernhard Reutner-Fischer

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,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-11 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11 12:32 [cocci] parser error with loops Bernhard Reutner-Fischer
2023-05-11 12:51 ` Julia Lawall

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.