Debian Codegraph @

tests/multi.at

raw
1 # This file is part of GNU cflow testsuite. -*- Autotest -*-
2 # Copyright (C) 2006, 2007, 2010 Jerry St.Clair
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 as
6 # published by the Free Software Foundation; either version 3, or (at
7 # your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # 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/licenses/>.
16
17 AT_SETUP([multiple source files])
18 AT_KEYWORDS([multi])
19
20 CFLOW_OPT([-ix_], [
21
22 dnl Source file #1
23 AT_DATA([multi1], [
24 #include "multi2.h"
25 #include "multi3.h"
26
27 static int stat = 1;
28
29 int main(int argc, char **argv)
30 {
31 static int local_stat;
32 local_stat = foo1(glob) + foo2(stat);
33 return local_stat;
34 }
35 ])
36
37 dnl Source file #2
38 AT_DATA([multi2], [
39 #include "multi2.h"
40 #include "multi3.h"
41
42 int glob = 2;
43 static int stat = 10;
44
45 static void _bar(int x)
46 {
47 glob = foo2(x);
48 }
49
50 int foo1(int y)
51 {
52 int local = 1;
53 _bar(local);
54 return stat;
55 }
56 ])
57
58 dnl Source file #3
59 AT_DATA([multi3], [
60 #include "multi3.h"
61
62 static int stat = 100;
63
64 static void _bar(int x)
65 {
66 stat += x;
67 }
68
69 int foo2(int y)
70 {
71 static int local_stat = 1;
72 _bar(local_stat + y + glob);
73 return local_stat;
74 }
75 ])
76
77 dnl Expected output
78 AT_DATA([expout],
79 [main() <int main (int argc, char **argv) at multi1:7>:
80 local_stat <int local_stat at multi1:9>
81 foo1() <int foo1 (int y) at multi2:13>:
82 _bar() <void _bar (int x) at multi2:8>:
83 glob <int glob at multi2:5>
84 foo2() <int foo2 (int y) at multi3:11>:
85 _bar() <void _bar (int x) at multi3:6>:
86 stat <int stat at multi3:4>
87 local_stat <int local_stat at multi3:13>
88 glob <int glob at multi2:5>
89 stat <int stat at multi2:6>
90 glob <int glob at multi2:5>
91 foo2() <int foo2 (int y) at multi3:11>:
92 _bar() <void _bar (int x) at multi3:6>:
93 stat <int stat at multi3:4>
94 local_stat <int local_stat at multi3:13>
95 glob <int glob at multi2:5>
96 stat <int stat at multi1:5>
97 ])
98
99 AT_CHECK([cflow ]TEST_CFLOW_OPTIONS[ multi1 multi2 multi3], [0], [expout])
100
101 ])
102
103 AT_CLEANUP
104