From a157c327c1fb908b49c5fa8495bedd95c3b10a5b Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 8 Jan 2010 10:38:54 +0300 Subject: [PATCH] smatch_extra: I don't like empty ranges Originally I thought empty ranges should mean everything was included. But these days I think that was a mistake. Most empty ranges come from impossible conditions. x = 0; if (x > 100) { // <-- x has an empty range. Then when we merge the ranges we get an empty range again and we can't get rid of the empty range because it trumps everything. Really --two-passes and --known-conditions should be turned on by default and smatch should complain about impossible conditions that can not be optimized away at compile time. Signed-off-by: Dan Carpenter --- smatch_ranges.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/smatch_ranges.c b/smatch_ranges.c index d7fb6add..4e9ac16b 100644 --- a/smatch_ranges.c +++ b/smatch_ranges.c @@ -219,9 +219,6 @@ struct range_list *range_list_union(struct range_list *one, struct range_list *t struct data_range *tmp; struct range_list *ret = NULL; - if (!one || !two) /*having nothing in a list means everything is in */ - return NULL; - FOR_EACH_PTR(one, tmp) { add_range(&ret, tmp->min, tmp->max); } END_FOR_EACH_PTR(tmp); -- 2.11.4.GIT