db: don't turn RaiseError on
[smatch.git] / smatch_scripts / db / fill_db_call_implies.pl
blob90c071c7f07ebe72a8a031685919c40087c80392
1 #!/usr/bin/perl -w
3 use strict;
4 use DBI;
6 my $warns = shift;
8 if (!defined($warns)) {
9 print "usage: $0 <warns.txt>\n";
10 exit(1);
13 my $db = DBI->connect("dbi:SQLite:smatch_db.sqlite", "", "", {AutoCommit => 0});
14 $db->do("PRAGMA synchronous = OFF");
15 $db->do("PRAGMA cache_size = 800000");
16 $db->do("PRAGMA journal_mode = OFF");
18 $db->do("delete from call_implies");
20 my $type = 6; # DEREFERENCE
21 open(WARNS, "<$warns");
22 while (<WARNS>) {
23 if (!($_ =~ /info: dereferences_param /)) {
24 next;
27 s/\n//;
29 my ($file_and_line, $file, $func, $dummy, $param, $value, $gs);
31 # fs/buffer.c:62 list_add() info: dereferences_param 1 static
33 $value = 1;
34 ($file_and_line, $func, $dummy, $dummy, $param, $gs) = split(/ /, $_);
35 ($file, $dummy) = split(/:/, $file_and_line);
36 $func =~ s/\(\)//;
38 if (!defined($param)) {
39 next;
42 my $static = 0;
43 if ($gs =~ /static/) {
44 $static = 1;
47 # print "insert into call_implies values ('$file', '$func', $static, $type, $param, $value)\n";
48 $db->do("insert into call_implies values ('$file', '$func', $static, $type, $param, $value)");
50 close(WARNS);
52 $db->commit();
53 $db->disconnect();