On Thu, 9 Feb 2012, Michael Stefaniuc wrote:

Hello,

the type of an expression metavariable when passed to python is
 <type 'instance'>
but an expression list gets flattened to a string aka
 <type 'str'>

Perhaps. I was hoping to get rid of the instance idea, as I don't see the point of having anything other than string, ast least if itis not going to contain any useful information.

Can the expression list be passed instead as a list/array of 'instance'?
That way one could get to the expressions without having to write a
(simplified) C parser in python.

What I'm trying to do is to add additional checks to the Wine debug
functions ERR/FIXME/TRACE/WARN. Those are printf style functions with
varargs. While they do use __attribute__(format) there are stricter
checks that can be done for those. But those require the parsing of the
format string and thus the need to go through python.

Could another option be to process the arguments individually? I'm not sure to understand how the __attribute__(format) fits in, but if one considers the normal printf, then one could write

@@
expression str,e;
expression list[n] es;
@@

printf(str,es,e,...)

Then afterwards one could inherit n, and use that to check that the corresponding ยค directive in str is compatible with e.

julia
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to