1 /*
2 * Copyright (C) 2006 Dan Carpenter.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
16 */
17
18 #ifndef SMATCH_H_
19 # define SMATCH_H_
20
21 #include <stdio.h>
22 #include <string.h>
23 #include <limits.h>
24 #include <sys/time.h>
25 #include <sqlite3.h>
26 #include "lib.h"
27 #include "allocate.h"
28 #include "scope.h"
29 #include "parse.h"
30 #include "expression.h"
31 #include "avl.h"
32
33 typedef struct {
34 struct symbol *type;
35 union {
183 struct smatch_state *prev;
184 struct expression *cur;
185 };
186
187 typedef void (modification_hook)(struct sm_state *sm, struct expression *mod_expr);
188 void add_modification_hook(int owner, modification_hook *call_back);
189 void add_modification_hook_late(int owner, modification_hook *call_back);
190 struct smatch_state *get_modification_state(struct expression *expr);
191
192 int outside_of_function(void);
193 const char *get_filename(void);
194 const char *get_base_file(void);
195 char *get_function(void);
196 int get_lineno(void);
197 extern int final_pass;
198 extern struct symbol *cur_func_sym;
199 extern int option_debug;
200 extern int local_debug;
201 extern int option_info;
202 extern int option_spammy;
203 extern char *trace_variable;
204 extern struct stree *global_states;
205 int is_skipped_function(void);
206 int is_silenced_function(void);
207
208 /* smatch_impossible.c */
209 int is_impossible_path(void);
210 void set_path_impossible(void);
211
212 extern FILE *sm_outfd;
213 extern FILE *sql_outfd;
214 extern FILE *caller_info_fd;
215 extern int sm_nr_checks;
216 extern int sm_nr_errors;
217 extern const char *progname;
218
219 /*
220 * How to use these routines:
221 *
222 * sm_fatal(): an internal error of some kind that should immediately exit
|
1 /*
2 * Copyright (C) 2006 Dan Carpenter.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
16 *
17 * Copyright 2019 Joyent, Inc.
18 */
19
20 #ifndef SMATCH_H_
21 # define SMATCH_H_
22
23 #include <stdio.h>
24 #include <string.h>
25 #include <limits.h>
26 #include <sys/time.h>
27 #include <sqlite3.h>
28 #include "lib.h"
29 #include "allocate.h"
30 #include "scope.h"
31 #include "parse.h"
32 #include "expression.h"
33 #include "avl.h"
34
35 typedef struct {
36 struct symbol *type;
37 union {
185 struct smatch_state *prev;
186 struct expression *cur;
187 };
188
189 typedef void (modification_hook)(struct sm_state *sm, struct expression *mod_expr);
190 void add_modification_hook(int owner, modification_hook *call_back);
191 void add_modification_hook_late(int owner, modification_hook *call_back);
192 struct smatch_state *get_modification_state(struct expression *expr);
193
194 int outside_of_function(void);
195 const char *get_filename(void);
196 const char *get_base_file(void);
197 char *get_function(void);
198 int get_lineno(void);
199 extern int final_pass;
200 extern struct symbol *cur_func_sym;
201 extern int option_debug;
202 extern int local_debug;
203 extern int option_info;
204 extern int option_spammy;
205 extern int option_timeout;
206 extern char *trace_variable;
207 extern struct stree *global_states;
208 int is_skipped_function(void);
209 int is_silenced_function(void);
210
211 /* smatch_impossible.c */
212 int is_impossible_path(void);
213 void set_path_impossible(void);
214
215 extern FILE *sm_outfd;
216 extern FILE *sql_outfd;
217 extern FILE *caller_info_fd;
218 extern int sm_nr_checks;
219 extern int sm_nr_errors;
220 extern const char *progname;
221
222 /*
223 * How to use these routines:
224 *
225 * sm_fatal(): an internal error of some kind that should immediately exit
|