> > Try dropping the ; on the assignment fb = e
>
> It worked, thanks!
>
> What is the meaning of the semi-column in that case? The obvious would
> be that it matches an end of line, but given the behaviour shown
> above, I guess there's more to it?

In SmPL you specify complete terms.  For example, you can't just write

if (...)

You have to put at least a then branch.

Likewise, if you have e1 = e2;, the only complete term it matches is a
complete top-level assignment.  It can't match the last n tokens of a
declaration.  On the other hand e1 = e2 is an expression.  It can be part
of other things.

If you think a bit about my explanation, you will quickly see that it is
not quite right, because int x = 12; doesn't have a subterm of the form x
= 12 according to the grammar of C.  So there is a small internal hack to
get around that issue.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to