Timur Tabi
2018-12-04 22:56:41 UTC
I have some rules and Python code that removes __FUNCTION__ as a
parameter in a call to a function. That all works great. I now want
it to remove __func__ in exactly the same way. So I copy/pasted my
rules and just changed __FUNCTION__ to __func__, but spatch complains:
warning: line 202: should __func__ be a metavariable?
warning: line 218: should __func__ be a metavariable?
warning: line 229: should __func__ be a metavariable?
I don't even know what this means. Here is one rule that fails:
// Look for NV_PRINTF2 calls that have __func__ as the first parameter
@r2b depends on rules@
constant char[] c;
expression x;
@@
NV_PRINTF2(x, c, __func__, ...)
// Get rid of __func__ at the beginning of the string
@script:python s2b@
c << r2b.c;
c2;
@@
import re
coccinelle.c2 = re.sub('%s[: ]*', '', c, 1)
@depends on rules@
expression x;
constant char[] r2b.c;
identifier s2b.c2;
@@
NV_PRINTF2(x,
-c, __func__
+c2
,...);
parameter in a call to a function. That all works great. I now want
it to remove __func__ in exactly the same way. So I copy/pasted my
rules and just changed __FUNCTION__ to __func__, but spatch complains:
warning: line 202: should __func__ be a metavariable?
warning: line 218: should __func__ be a metavariable?
warning: line 229: should __func__ be a metavariable?
I don't even know what this means. Here is one rule that fails:
// Look for NV_PRINTF2 calls that have __func__ as the first parameter
@r2b depends on rules@
constant char[] c;
expression x;
@@
NV_PRINTF2(x, c, __func__, ...)
// Get rid of __func__ at the beginning of the string
@script:python s2b@
c << r2b.c;
c2;
@@
import re
coccinelle.c2 = re.sub('%s[: ]*', '', c, 1)
@depends on rules@
expression x;
constant char[] r2b.c;
identifier s2b.c2;
@@
NV_PRINTF2(x,
-c, __func__
+c2
,...);