I've poked around for a while, and can't find this anywhere. I have found a nice example of a cppcheck rule-file that shows a simple pattern;
<?xml version="1.0"?>
<rule version="1">
<pattern>if \( p \) { free \( p \) ; }</pattern>
<message>
<id>redundantCondition</id>
<severity>style</severity>
<summary>Redundant condition. It is valid to free a NULL pointer.</summary>
</message>
</rule>
Which works nicely, as long as all the pointers are named 'p' and the call is 'free'. How do I change 'p' to match any identifier? How do I check for "'free' or 'delete'"? Is the pattern a grep/awk/sed pattern?
I am a Cppcheck developer.
Cppcheck uses PCRE. So use a regular expression that follows the Perl rules.
I'm not really good at Perl regular expressions so I can't answer how/if you can match any identifier (since it should be matched twice).
.. hope that helps a little at least.