4 * Copyright (C) 2006 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
13 typedef void (*reg_func
) (int id
);
14 void register_derefed_params(int id
);
15 void register_null_deref(int id
);
16 void register_smatch_extra(int id
);
17 void register_smatch_ignore(int id
);
18 void register_overflow(int id
);
19 void register_locking(int id
);
20 void register_memory(int id
);
21 void register_implications(int id
);
22 void register_frees_argument(int id
);
23 /* <- your test goes here */
24 /* void register_template(int id); */
26 const reg_func reg_funcs
[] = {
27 ®ister_smatch_extra
, /* smatch_extra always has to be first */
28 ®ister_smatch_ignore
,
33 // ®ister_frees_argument,
35 /* <- your test goes here */
36 /* ®ister_template, */
38 ®ister_implications
, /* implications always has to be last */
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.");
52 int main(int argc
, char **argv
)
57 /* The script IDs start at 1.
58 0 is used for internal stuff. */
59 for(i
= 0; (func
= reg_funcs
[i
]); i
++){
64 if (!strcmp(argv
[1], "--debug")) {
66 } else if (!strcmp(argv
[1], "--debug-implied")) {
67 debug_implied_states
= 1;
68 } else if (!strcmp(argv
[1], "--no-implied")) {
69 option_no_implied
= 1;
70 } else if (!strcmp(argv
[1], "--assume-loops")) {
71 option_assume_loops
= 1;
72 } else if (!strcmp(argv
[1], "--known-conditions")) {
73 option_known_conditions
= 1;
74 } else if (!strcmp(argv
[1], "--help")) {