static void register_silenced_functions(void) { struct token *token; char *func; char name[256]; silenced_funcs = create_function_hashtable(500); if (option_project == PROJ_NONE) return; snprintf(name, 256, "%s.silenced_functions", option_project_str); token = get_tokens_file(name); if (!token) return; if (token_type(token) != TOKEN_STREAMBEGIN) return; token = token->next; while (token_type(token) != TOKEN_STREAMEND) { if (token_type(token) != TOKEN_IDENT) return; func = alloc_string(show_ident(token->ident)); insert_func(silenced_funcs, func, INT_PTR(1)); token = token->next; } clear_token_alloc(); }
static void register_ignored_macros(void) { struct token *token; char *macro; char name[256]; if (option_project == PROJ_NONE) strcpy(name, "ignored_macros"); else snprintf(name, 256, "%s.ignored_macros", option_project_str); token = get_tokens_file(name); if (!token) return; if (token_type(token) != TOKEN_STREAMBEGIN) return; token = token->next; while (token_type(token) != TOKEN_STREAMEND) { if (token_type(token) != TOKEN_IDENT) return; macro = alloc_string(show_ident(token->ident)); add_ptr_list(&__ignored_macros, macro); token = token->next; } clear_token_alloc(); }
static void register_no_return_funcs(void) { struct token *token; const char *func; char name[256]; if (option_project == PROJ_NONE) strcpy(name, "no_return_funcs"); else snprintf(name, 256, "%s.no_return_funcs", option_project_str); token = get_tokens_file(name); if (!token) return; if (token_type(token) != TOKEN_STREAMBEGIN) return; token = token->next; while (token_type(token) != TOKEN_STREAMEND) { if (token_type(token) != TOKEN_IDENT) return; func = show_ident(token->ident); add_function_hook(func, &__match_nullify_path_hook, NULL); token = token->next; } clear_token_alloc(); }
static void register_shifters(void) { char filename[256]; struct token *token; char *name; int *val; snprintf(filename, sizeof(filename), "%s.bit_shifters", option_project_str); token = get_tokens_file(filename); if (!token) return; if (token_type(token) != TOKEN_STREAMBEGIN) return; token = token->next; while (token_type(token) != TOKEN_STREAMEND) { if (token_type(token) != TOKEN_IDENT) return; name = alloc_string(show_ident(token->ident)); token = token->next; if (token_type(token) != TOKEN_NUMBER) return; val = malloc(sizeof(int)); *val = atoi(token->number); insert_struct(shifters, name, val); token = token->next; } clear_token_alloc(); }
static void register_funcs_from_file(void) { struct token *token; const char *func; int arg; token = get_tokens_file("kernel.dma_funcs"); if (!token) return; if (token_type(token) != TOKEN_STREAMBEGIN) return; token = token->next; while (token_type(token) != TOKEN_STREAMEND) { if (token_type(token) != TOKEN_IDENT) return; func = show_ident(token->ident); token = token->next; if (token_type(token) != TOKEN_NUMBER) return; arg = atoi(token->number); add_function_hook(func, &match_dma_func, INT_PTR(arg)); token = token->next; } clear_token_alloc(); }
struct symbol_list * __sparse(char *filename) { struct symbol_list *res; res = sparse_keep_tokens(filename); /* Drop the tokens for this file after parsing */ clear_token_alloc(); /* And return it */ return res; }
static void register_returns_held_funcs(void) { struct token *token; const char *func; token = get_tokens_file("kernel.returns_held_funcs"); if (!token) return; if (token_type(token) != TOKEN_STREAMBEGIN) return; token = token->next; while (token_type(token) != TOKEN_STREAMEND) { if (token_type(token) != TOKEN_IDENT) return; func = show_ident(token->ident); return_implies_state(func, valid_ptr_min, valid_ptr_max, &match_returns_held, NULL); return_implies_state(func, 0, 0, &match_returns_null, NULL); token = token->next; } clear_token_alloc(); }