smatch.h: include scope.h
[smatch.git] / check_assign_vs_compare.c
blob09e5e0f4878a8a058c465c6f65d98997bbf9c4b7
1 /*
2 * smatch/check_assign_vs_compare.c
4 * Copyright (C) 2012 Oracle.
6 * Licensed under the Open Software License version 1.1
8 */
10 #include "smatch.h"
12 static int my_id;
14 static void match_condition(struct expression *expr)
16 sval_t val;
18 if (expr->type != EXPR_ASSIGNMENT || expr->op != '=')
19 return;
21 if (!get_value(expr->right, &val))
22 return;
23 sm_msg("warn: was '== %s' instead of '='", sval_to_str(val));
26 void check_assign_vs_compare(int id)
28 my_id = id;
29 add_hook(&match_condition, CONDITION_HOOK);