slist: remove some dead code
[smatch.git] / check_no_effect.c
blob493aa4d3c624c815a145f948e602cfdace5f52b5
1 /*
2 * sparse/check_no_effect.c
4 * Copyright (C) 2010 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
8 */
10 #include "smatch.h"
12 static int my_id;
14 static void match_stmt(struct statement *stmt)
16 struct expression *expr;
18 if (stmt->type != STMT_EXPRESSION)
19 return;
20 expr = stmt->expression;
21 if (!expr)
22 return;
23 switch(expr->type) {
24 case EXPR_PREOP:
25 case EXPR_POSTOP:
26 case EXPR_STATEMENT:
27 case EXPR_ASSIGNMENT:
28 case EXPR_CALL:
29 case EXPR_CONDITIONAL:
30 case EXPR_SELECT:
31 case EXPR_CAST:
32 case EXPR_FORCE_CAST:
33 case EXPR_COMMA:
34 return;
36 if (in_expression_statement())
37 return;
38 sm_msg("warn: statement has no effect %d", expr->type);
41 void check_no_effect(int id)
43 my_id = id;
44 add_hook(&match_stmt, STMT_HOOK);