sval: validation: absolute: add a couple new things that work now with sval
[smatch.git] / check_mod_timer.c
blobd1b719042aa49da934950fbfaf17e551d4f6c108
1 /*
2 * smatch/check_mod_timer.c
4 * Copyright (C) 2010 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
8 */
10 #include "smatch.h"
11 #include "smatch_slist.h"
13 static int my_id;
15 static void match_mod_timer(const char *fn, struct expression *expr, void *param)
17 struct expression *arg;
18 sval_t sval;
20 arg = get_argument_from_call_expr(expr->args, 1);
21 if (!get_value_sval(arg, &sval) || sval.value == 0)
22 return;
23 sm_msg("warn: mod_timer() takes an absolute time not an offset.");
26 void check_mod_timer(int id)
28 if (option_project != PROJ_KERNEL)
29 return;
31 my_id = id;
32 add_function_hook("mod_timer", &match_mod_timer, NULL);