handle stuff like the kernel's WARN_ON() macro
[smatch.git] / smatch_ignore.c
blob2ac6b9be56695b77de6d6a1907f1d7e909a4f754
1 /*
2 * sparse/smatch_tracker.c
4 * Copyright (C) 2009 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
8 */
10 #include "smatch.h"
12 static struct tracker_list *ignored;
14 void add_ignore(int owner, const char *name, struct symbol *sym)
16 struct tracker *tmp;
18 tmp = malloc(sizeof(*tmp));
19 tmp->name = alloc_string(name);
20 tmp->owner = owner;
21 tmp->sym = sym;
22 add_ptr_list(&ignored, tmp);
25 int is_ignored(int owner, const char *name, struct symbol *sym)
27 struct tracker *tmp;
29 FOR_EACH_PTR(ignored, tmp) {
30 if (tmp->owner == owner && tmp->sym == sym
31 && !strcmp(tmp->name, name))
32 return 1;
33 } END_FOR_EACH_PTR(tmp);
34 return 0;
37 static void clear_ignores(void)
39 __free_ptr_list((struct ptr_list **)&ignored);
42 void register_smatch_ignore(int id)
44 add_hook(&clear_ignores, END_FUNC_HOOK);