Rework smatch implied
commit18a272e0c0ffc461707eb60690addd4fc5e608a2
authorDan Carpenter <error27@gmail.com>
Mon, 4 May 2009 12:28:40 +0000 (4 15:28 +0300)
committerDan Carpenter <error27@gmail.com>
Mon, 4 May 2009 12:28:40 +0000 (4 15:28 +0300)
tree77ad931f8eff9098cf211058d033a5fbcb49f675
parentba35262133fe25ae6dfad050b01a64f6e0cf2d28
Rework smatch implied

This is a rough commit.  I hacked on it until the test cases pass.

The problem was that handling compound implications didn't work.

This patch adds "struct state_list *pre_merge" to sm_state.  my_pools
doesn't need to get copied to the merged state, it stays with the
pre_merge state.

With this change, we now have all the information we need to chop off
pre-merged states and re-merge them to get a new state.

The old code used to look at pools which were true and merge everything in
those pools.  The new code looks at pools which are false and chops off
the false bits to find the implied states.

all_pools isn't needed any more.
is_merged_hook isn't needed any more because we have detailed merge info.

We now consider sm_states merged even if the actual sm_state->state was
the same on both sides of the merge.
if (x) y = 1; else y = 1; <- (y is merged here)

I added validation/sm_implied6.c which uses a compound implication.

Signed-off-by: Dan Carpenter <error27@gmail.com>
smatch.h
smatch_extra.c
smatch_extra.h
smatch_hooks.c
smatch_implied.c
smatch_ranges.c
smatch_slist.c
smatch_slist.h
smatch_states.c
validation/sm_implied6.c [new file with mode: 0644]