On Wed, 16 Nov 2016, SF Markus Elfring wrote:

> > In a script rule, the metavariable declarations are interpreted by 
> > Coccinelle,
> > not the scripting language, so an include would not be allowed there.
>
> This detail was clear for me in principle.
>
>
> > Script rules also don't have constraints on metavariables anyway,
>
> Can other SmPL rule types specify constraints in the code form of a
> regular expression or a programming language script?

At the moment, the specification of constraints is not very uniform across
the different metavariable types.  We are working on improving this.

> > so I'm not sure what you are asking about.
>
> I am looking for ways to avoid source code duplication by inclusion of
> other files.
> Would it make sense to allow the use of an include statement within the
> SmPL variable definition block of a rule?

I have the impression that what you want would be adequately implemented
by a virtual identifier that could be tested in the code or by a virtual
rule.  For example, the semantic patches in the Linux kernel provide
alternate implementations depending on whether one uses the arguments -D
patch, -D context, etc.

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

Reply via email to