db: fix how parameter math works
commit53bb67f7881193650317c182c0a0625281beb29e
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 24 Sep 2014 13:30:01 +0000 (24 16:30 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Wed, 24 Sep 2014 13:30:01 +0000 (24 16:30 +0300)
tree9319f651ce713c561145f6109ace6bce9742278e
parent653777cf40d33a07113edaf41545884028d7bebf
db: fix how parameter math works

When I tested these changes I had two major problems:
1)  We sometimes record both the implied range and the comparison so it
    looks like, "1-s32max<$1" which is unparsable.
2)  smatch_parse_call_math.c doesn't support range lists only exact figures
    so if the parameter is a range list then we don't store anything and it
    is less information than we had before.

The fix for this is to go back to putting [] characters in the format like
this, "1-s32max[<$1]" or "1-s32max[$0 + 4]".

Eventually I will want to make smatch_parse_call_math.c handle range lists
but that can be done later.

There are several other minor bugs fixed in this change.

I made parse_call_math() ignore the final ']'.  So now it takes strings
like "$0 + $1]".  It's sort of a bogus string but that's fine.

I removed a duplicate check in returned_member_callback() and I removed an
unused variable in smatch_extra.c.

In smatch_db.c I said that if we knew the value was a literal then don't
bother looking it up in terms of parameter math.  Also I made some
variables const.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_db.c
smatch_extra.c
smatch_param_set.c
smatch_parse_call_math.c
smatch_ranges.c