From b7d95a374492711498fa26b4331a8abbd3a3752d Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 15 Apr 2013 11:44:13 +0300 Subject: [PATCH] db: always split the return values if we're not using --info This code is to handle the case where we do: err = -ENOMEM; goto err_out; ... err = -EINVAL; goto err_out; err_out: unlock(); return err; It's often better to try separate each return path and figure out the implications of each. The problem is that if it's a big function with a lot of states and there are a bunch of return paths then sometimes it's thousands of states and it's just too much information to print. In those cases we just bail out. But if we're not printing information then it doesn't take too much time to separate the states. The only thing this affects currently is check_locking.c. Signed-off-by: Dan Carpenter --- smatch_db.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/smatch_db.c b/smatch_db.c index 0b531860..74ff42fd 100644 --- a/smatch_db.c +++ b/smatch_db.c @@ -769,9 +769,14 @@ static int call_return_state_hooks_split_possible(struct expression *expr) /* bail if it gets too complicated */ nr_possible = ptr_list_size((struct ptr_list *)sm->possible); nr_states = ptr_list_size((struct ptr_list *)__get_cur_slist()); - if (nr_possible >= 100) + /* + * the main thing option_info because we don't want to print a + * million lines of output. If someone else, like check_locking.c + * wants this data, then it doesn't cause a slow down to provide it. + */ + if (option_info && nr_possible >= 100) return 0; - if (nr_states * nr_possible >= 1000) + if (option_info && nr_states * nr_possible >= 2000) return 0; FOR_EACH_PTR(sm->possible, tmp) { -- 2.11.4.GIT