slist: don't allocate so many duplicate ->possible states
Originally state were simple and declared like this:
STATE(null);
In the cmp_possible_sm() we could just compare the pointers to see if we
already had that one in the ->possible list. But then the started being
allocated dynamically and it became more complicated. I believe that
actually it looks very complicated with some smatch_extra tests and the
"preserve" flag but really it's just doing the pointer tests still. In
other words it's totally buggy.
Anyway, it needs to needs to be a little complicated to work correctly and
that's because we use the ->possible list for smatch_extra to split the
return states. So we want to preserve leaf sm states (ie states that are
not merged).
Then for the rest, if it's a simple state we can just do the pointer
compares and that's very easy. Otherwise we can just do a strcmp() on
the state->names.
One problem I found is that some states had no name. That's not useful, so
I have fixed some of those.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
36 files changed: