Start caring about the types a little.
commit5d0b8244ed69997b9622b8f0177692aa2e58b12e
authorDan Carpenter <error27@gmail.com>
Mon, 7 Dec 2009 08:43:27 +0000 (7 10:43 +0200)
committerDan Carpenter <error27@gmail.com>
Mon, 7 Dec 2009 08:43:27 +0000 (7 10:43 +0200)
treea84520e065dddce041a852479c877ea59a2e8885
parent74d3be728194de8483a1c74e4b71b94d60d89038
Start caring about the types a little.

This is still half arsed...  :/

I created smatch_type.c with the function get_type().  The idea is that
you pass it an expression and it returns the type.  "Type" in this case
mean either a ptr type or a base_type with the number of bits and
MOD_SIGNED or MOD_UNSIGNED.

Later on smatch_extra.c will take advantage of this information so that
the possible ranges can be more accurate.  Right now we assume everything
is type long long.

Currently, both get_type() and get_value() ignore casts.  That will have
to change.

Also I don't know anything about what get_type() should return for x + y
where x and y are different types.  I guess it returns the larger type.
There are rules for this, but I don't know what they are yet.  Right now
if smatch saw x + y, it would assume that x is an array...  :/

check_signed.c prints a bunch of bogus stuff.  I keep hoping that if
I print out information that is almost correct, then someone will do all
the work to finish it up and make it work correctly.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Makefile
check_signed.c [new file with mode: 0644]
smatch.c
smatch.h
smatch_helper.c
smatch_type.c [new file with mode: 0644]