*new* check_missing_break.c: check for fall through case statements
commitbb7ed7ff46604e9298cdabe48ab9189a8adc82cc
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 11 Jan 2013 07:50:33 +0000 (11 10:50 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 11 Jan 2013 07:50:33 +0000 (11 10:50 +0300)
tree97ae33ba9e76ceed555893dbfb9df93dc9270b81
parent293ddb0150b2c8495416f952f2e93bda2a0d3d1f
*new* check_missing_break.c: check for fall through case statements

This was my attempt to find missing break statements.  Falling through is,
of course, allowed by C but so much of the time when people do it, it is
unintentional.

This check tests if a value from the previous statement gets over written
in the next case statement without being used.  I perhaps over thought
things and should just print an error for every time it falls through.

Normally static checker tools let you silence the warning by putting a
/* fall through */ comment on the line before.  Smatch works on the
pre-processed code so it can't see the comments.

It is what it is.

This found 7 kernel bugs and I fixed them all so now it is 100% false
positives.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
check_list.h
check_missing_break.c [new file with mode: 0644]
smatch.h
smatch_flow.c