*new* check_macros: find macro precedence bugs
[smatch.git] / smatch_project.c
blobf33c5fd1fe89b07f3d641ecf700456294a98d4c1
1 /*
2 * sparse/smatch_project.c
4 * Copyright (C) 2010 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
8 */
11 * This file is only for very generic stuff, that is reusable
12 * between projects. If you need something special create a
13 * check_your_project.c.
17 #include "smatch.h"
19 static void register_no_return_funcs(void)
21 struct token *token;
22 const char *func;
23 static char name[256];
26 snprintf(name, 256, "%s.no_return_funcs", option_project_str);
27 name[255] = '\0';
28 token = get_tokens_file(name);
29 if (!token)
30 return;
31 if (token_type(token) != TOKEN_STREAMBEGIN)
32 return;
33 token = token->next;
34 while (token_type(token) != TOKEN_STREAMEND) {
35 if (token_type(token) != TOKEN_IDENT)
36 return;
37 func = show_ident(token->ident);
38 add_function_hook(func, &__match_nullify_path_hook, NULL);
39 token = token->next;
41 clear_token_alloc();
44 void register_project(int id)
46 if (option_project != PROJ_KERNEL)
47 add_function_hook("exit", &__match_nullify_path_hook, NULL);
48 register_no_return_funcs();