In one rule, I have some Python code that parses a string literal to
see what it looks like.  If I detect a specific pattern, then I want
another rule (that has no Python code) to act differently.

More specifically, if a string literal passed as a parameter to
DBG_PRINTF() starts with "NVRM: ", then I want my script to replace
DBG_PRINTF with NV_PRINTF.  This works today.

If the string does not begin with "NVRM:", however, then I want
DBG_PRINTF changed to NV_PRINTF_EX instead.

If this can't work, an alternative would be to create a second script
that handles DBG_PRINTF to NV_PRINTF_EX.  However, it would need to
abort the change if the Python script detects that NVRM: doesn't
exist.  So is there a way for Python to return a value that says,
"Woah, stop and undo everything you just did!"
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to