Debian Codegraph @

tests/typedef.at

raw
1 # This file is part of GNU cflow testsuite. -*- Autotest -*-
2 # Copyright (C) 2019-2025 Sergey Poznyakoff
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_BANNER([typedefs])
18
19 CFLOW_OPT([-x -it],[
20 CFLOW_TEST([structs with same members],[typedef typedef00],
21 [typedef struct x {
22 char **foo;
23 } X;
24 typedef struct y {
25 char **foo;
26 } Y;
27 ],
28 [X t prog:3
29 Y t prog:6
30 ])
31
32 CFLOW_TEST([structs with tags matching typedef],[typedef typedef01],
33 [typedef struct X {
34 char **foo;
35 } X;
36 typedef struct Y {
37 char **foo;
38 } Y;
39 ],
40 [X t prog:3
41 Y t prog:6
42 ])
43
44 CFLOW_TEST([typedef to pointer],[typedef typedef02],
45 [typedef struct X {
46 char **foo;
47 } **X;
48 ],
49 [X t prog:3
50 ])
51
52 CFLOW_TEST([modifiers],[typedef typedef03],
53 [typedef struct X const *Y;
54 ],
55 [Y t prog:1
56 ])
57
58 ])
59