Print this page
11506 smatch resync
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/tools/smatch/src/smatch_data/db/init_constraints_required.pl
+++ new/usr/src/tools/smatch/src/smatch_data/db/init_constraints_required.pl
1 1 #!/usr/bin/perl -w
2 2
3 3 use strict;
4 4 use warnings;
5 5 use bigint;
6 6 use DBI;
7 7 use Data::Dumper;
8 8 use File::Basename;
9 9
10 10 my $project = shift;
11 11 $project =~ s/.*=(.*)/$1/;
12 12 my $warns = shift;
13 13 my $db_file = shift;
14 14
15 15 my $db;
16 16
17 17 sub connect_to_db($)
18 18 {
19 19 my $name = shift;
20 20
21 21 $db = DBI->connect("dbi:SQLite:$name", "", "", {AutoCommit => 0});
22 22
23 23 $db->do("PRAGMA cache_size = 800000");
24 24 $db->do("PRAGMA journal_mode = OFF");
25 25 $db->do("PRAGMA count_changes = OFF");
26 26 $db->do("PRAGMA temp_store = MEMORY");
↓ open down ↓ |
26 lines elided |
↑ open up ↑ |
27 27 $db->do("PRAGMA locking = EXCLUSIVE");
28 28 }
29 29
30 30 sub load_manual_constraints($$)
31 31 {
32 32 my $full_path = shift;
33 33 my $project = shift;
34 34 my $dir = dirname($full_path);
35 35 my ($data, $op, $limit);
36 36
37 + if ($project =~ /^$/) {
38 + return;
39 + }
40 +
37 41 open(FILE, "$dir/$project.constraints_required");
38 42 while (<FILE>) {
39 43 ($data, $op, $limit) = split(/,/);
40 44 $op =~ s/ //g;
41 45 $limit =~ s/^ +//;
42 46 $limit =~ s/\n//;
43 47 $db->do("insert into constraints_required values (?, ?, ?);", undef, $data, $op, $limit);
44 48 }
45 49 close(FILE);
46 50
47 51 $db->commit();
48 52 }
49 53
50 54 connect_to_db($db_file);
51 55 load_manual_constraints($0, $project);
52 56
53 57 $db->commit();
54 58 $db->disconnect();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX