modification_hooks: complete rewrite
commit7365609874eb46425d372a141c8e7b6c6b261548
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 18 May 2012 07:31:21 +0000 (18 10:31 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 18 May 2012 07:31:21 +0000 (18 10:31 +0300)
tree37c41576a786c6edba21e7908c7f19b6c61cf61c
parent6e2211442c5b930634c2a4eb7cc80d9a87dccc3f
modification_hooks: complete rewrite

The old modification_hooks didn't work very well.  For example if you had
this code:
        free(foo->x);
        foo++;
free(foo->x);

Then the old code complained about a double free.

The API is also changed.  In the new code, you just have one default
modification hook per check.  If a variable is modified we just pass the
old sm_state to the call_back.

The other thing I added was the "indirect" modification hook for
smatch_extra.  Smatch_extra handles direct modification like foo->x = 42
but for foo++, it just wants to set foo->x to unknown.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
20 files changed:
check_check_deref.c
check_container_of.c
check_deref.c
check_deref_check.c
check_dereferences_param.c
check_dev_queue_xmit.c
check_err_ptr_deref.c
check_expects_err_ptr.c
check_free.c
check_memory.c
check_overflow.c
check_param_mapper.c
check_return_efault.c
check_return_enomem.c
check_snprintf.c
check_wine_filehandles.c
smatch.h
smatch_extra.c
smatch_modification_hooks.c
smatch_states.c