Print this page
11506 smatch resync
@@ -19,10 +19,11 @@
#include <stdio.h>
#include <unistd.h>
#include <libgen.h>
#include "smatch.h"
+#include "smatch_slist.h"
#include "check_list.h"
char *option_debug_check = (char *)"";
char *option_project_str = (char *)"smatch_generic";
static char *option_db_file = (char *)"smatch_db.sqlite";
@@ -36,11 +37,10 @@
int option_param_mapper = 0;
int option_call_tree = 0;
int option_no_db = 0;
int option_enable = 0;
int option_disable = 0;
-int option_debug_related;
int option_file_output;
int option_time;
int option_mem;
char *option_datadir_str;
int option_fatal_checks;
@@ -174,11 +174,11 @@
free(str);
return ret;
}
#define OPTION(_x) do { \
- if (match_option((*argvp)[i], #_x)) { \
+ if (match_option((*argvp)[1], #_x)) { \
option_##_x = 1; \
} \
} while (0)
void parse_args(int *argcp, char ***argvp)
@@ -229,12 +229,10 @@
OPTION(fatal_checks);
OPTION(spammy);
OPTION(info);
OPTION(debug);
- OPTION(debug_implied);
- OPTION(debug_related);
OPTION(assume_loops);
OPTION(no_data);
OPTION(two_passes);
OPTION(full_path);
OPTION(param_mapper);
@@ -320,10 +318,11 @@
return NULL;
}
int main(int argc, char **argv)
{
+ struct string_list *filelist = NULL;
int i;
reg_func func;
sm_outfd = stdout;
sql_outfd = stdout;
@@ -341,12 +340,16 @@
bin_dir = get_bin_dir(argv[0]);
data_dir = get_data_dir(argv[0]);
allocate_hook_memory();
+ allocate_dynamic_states_array(num_checks);
create_function_hook_hash();
open_smatch_db(option_db_file);
+ sparse_initialize(argc, argv, &filelist);
+ alloc_valid_ptr_rl();
+
for (i = 1; i < ARRAY_SIZE(reg_funcs); i++) {
func = reg_funcs[i].func;
/* The script IDs start at 1.
0 is used for internal stuff. */
if (!option_enable || reg_funcs[i].enabled == 1 ||
@@ -353,11 +356,11 @@
(option_disable && reg_funcs[i].enabled != -1) ||
strncmp(reg_funcs[i].name, "register_", 9) == 0)
func(i);
}
- smatch(argc, argv);
+ smatch(filelist);
free_string(data_dir);
if (option_succeed)
return 0;
if (sm_nr_errors > 0)