From 49166a5228c7eaad9ea36e1492f569950ff7f8bb Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 11 Aug 2015 20:37:24 +0300 Subject: [PATCH] smatch: remove the "loop could be replaced with if statement" messages These never found any bugs. Signed-off-by: Dan Carpenter --- smatch.h | 2 -- smatch_flow.c | 1 - smatch_states.c | 16 ---------------- 3 files changed, 19 deletions(-) diff --git a/smatch.h b/smatch.h index 0890f19b..e060f7fb 100644 --- a/smatch.h +++ b/smatch.h @@ -576,8 +576,6 @@ void __discard_pre_cond_states(void); void __use_cond_states(void); extern struct state_list *__last_base_slist; -void __warn_on_silly_pre_loops(void); - void __push_continues(void); void __discard_continues(void); void __process_continues(void); diff --git a/smatch_flow.c b/smatch_flow.c index 85492aec..abac6cfa 100644 --- a/smatch_flow.c +++ b/smatch_flow.c @@ -544,7 +544,6 @@ static void handle_pre_loop(struct statement *stmt) once_through = 1; __split_stmt(stmt->iterator_statement); - __warn_on_silly_pre_loops(); if (is_forever_loop(stmt)) { __merge_continues(); __save_gotos(loop_name); diff --git a/smatch_states.c b/smatch_states.c index 4c33e67d..b69a36d0 100644 --- a/smatch_states.c +++ b/smatch_states.c @@ -748,22 +748,6 @@ static int top_stree_empty(struct stree_stack **stack) return empty; } -/* a silly loop does this: while(i--) { return; } */ -void __warn_on_silly_pre_loops(void) -{ - if (!__path_is_null()) - return; - if (!top_stree_empty(&continue_stack)) - return; - if (!top_stree_empty(&break_stack)) - return; - /* if the path was nullified before the loop, then we already - printed an error earlier */ - if (top_stree_empty(&false_stack)) - return; - sm_msg("info: loop could be replaced with if statement."); -} - void __merge_continues(void) { struct stree *stree; -- 2.11.4.GIT