function_hooks: bump the number of entries in the table to 10k
[smatch.git] / smatch.c
blob6d48919eab56c8fd705a0c795818b1bfa2767383
1 /*
2 * sparse/smatch.c
4 * Copyright (C) 2006 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
8 */
10 #include <stdio.h>
11 #include "smatch.h"
13 typedef void (*reg_func) (int id);
14 void register_smatch_extra(int id);
15 void register_smatch_ignore(int id);
16 void register_implications(int id);
17 void register_function_hooks(int id);
18 void check_null_deref(int id);
19 void check_overflow(int id);
20 void check_locking(int id);
21 void check_memory(int id);
22 void check_frees_argument(int id);
23 /* <- your test goes here */
24 /* void register_template(int id); */
26 static const reg_func reg_funcs[] = {
27 &register_smatch_extra, /* smatch_extra always has to be first */
28 &register_smatch_ignore,
29 &check_null_deref,
30 &check_overflow,
31 &check_locking,
32 &check_memory,
33 // &check_frees_argument,
35 /* <- your test goes here */
36 /* &register_template, */
38 &register_implications, /* implications always has to be last */
39 NULL
42 static void help(void)
44 printf("Usage: smatch [smatch arguments][sparse arguments] file.c\n");
45 printf("--debug: print lots of debug output.\n");
46 printf("--debug-implied: print debug output about implications.\n");
47 printf("--assume-loops: assume loops always go through at least once.\n");
48 printf("--known-conditions: don't branch for known conditions.");
49 exit(1);
52 int main(int argc, char **argv)
54 int i;
55 reg_func func;
57 /* The script IDs start at 1.
58 0 is used for internal stuff. */
59 create_function_hash();
60 for(i = 0; (func = reg_funcs[i]); i++){
61 func(i + 1);
63 register_function_hooks(-1);
65 while(argc >= 2) {
66 if (!strcmp(argv[1], "--debug")) {
67 debug_states = 1;
68 } else if (!strcmp(argv[1], "--debug-implied")) {
69 debug_implied_states = 1;
70 } else if (!strcmp(argv[1], "--no-implied")) {
71 option_no_implied = 1;
72 } else if (!strcmp(argv[1], "--assume-loops")) {
73 option_assume_loops = 1;
74 } else if (!strcmp(argv[1], "--known-conditions")) {
75 option_known_conditions = 1;
76 } else if (!strcmp(argv[1], "--help")) {
77 help();
78 } else {
79 break;
81 argc--;
82 argv++;
85 smatch(argc, argv);
86 return 0;