extra: handle i++ and i += 2 better outside loops
commit2a095175d1d629f6e3e9290065e50c8026278313
authorDan Carpenter <error27@gmail.com>
Fri, 23 Apr 2010 16:15:00 +0000 (23 18:15 +0200)
committerDan Carpenter <error27@gmail.com>
Fri, 23 Apr 2010 16:15:00 +0000 (23 18:15 +0200)
tree86d860efed5816627e028436fd3658f2f38ca4e9
parent835c57e1c00ca7af49dd796e9314f3f033d3a3e5
extra: handle i++ and i += 2 better outside loops

This patch adds the function inside_loop() which returns 1 if we are
inside a loop or if we have reached a goto label.

Inside loops we assume that i++ can go up to max (Unless they are in a
canonical loop format, that's handled as a special case).  Outside of a
loop i++ is just a matter of adding 1 to the min and max values of i.

At this point "i = i + 1;" is always treated as being outside a loop
because smatch isn't clever enough to see that it's adding itself to
itself.

Signed-off-by: Dan Carpenter <error27@gmail.com>
smatch.h
smatch_extra.c
smatch_flow.c
validation/sm_math1.c [new file with mode: 0644]