danmar/cppcheck — pull request #225 by juliantaylor (2014-01-23 23:53:38+00:00)
Title: (WIP) Fixed #5392 (new check: recommend expm1, log1p, erfc)

my first attempt at adding the new check from trac 5392.
still very much a prototype with style, naming and category issues, but as I couldn't find a developer guide I need some early hints.
has some basic tests, the ones that fail are where I need help.

main issues:
Token::Match seems to just a simple pattern matcher not a real semantic matcher, is there a semantic matcher similar to *semantic patch language* available?
my simple patterns would work for

function(variable) - constant`

patterns but fail for

function(expression) - constant

E.g.

exp(a + b / 3) - 1.

does not trigger it, am I just overlooking the `expression` pattern? `%any%` does not work.

function(variable) + constant operator expression

also false positives if operator has higher precedence as `+`, can I bound the pattern to an expression respecting precedence rules somehow to avoid this?

b = 1. - erf(b)

also does not trigger, I don't see why, is the `b =` included in the pattern match somehow?