File: function_decl_test.go

package info (click to toggle)
c2go 0.26.11-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,052 kB
  • sloc: ansic: 6,037; sh: 82; makefile: 5
file content (222 lines) | stat: -rw-r--r-- 7,685 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
package ast

import (
	"testing"
)

func TestFunctionDecl(t *testing.T) {
	nodes := map[string]Node{
		`0x7fb5a90e60d0 <line:231:1, col:22> col:7 clearerr 'void (FILE *)'`: &FunctionDecl{
			Addr:         0x7fb5a90e60d0,
			Pos:          NewPositionFromString("line:231:1, col:22"),
			Prev:         "",
			Position2:    "col:7",
			Name:         "clearerr",
			Type:         "void (FILE *)",
			Type2:        "",
			IsExtern:     false,
			IsImplicit:   false,
			IsUsed:       false,
			IsReferenced: false,
			IsStatic:     false,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x7fb5a90e2a50 </usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126> /usr/include/sys/stdio.h:39:5 renameat 'int (int, const char *, int, const char *)'`: &FunctionDecl{
			Addr:         0x7fb5a90e2a50,
			Pos:          NewPositionFromString("/usr/include/sys/stdio.h:39:1, /usr/include/AvailabilityInternal.h:21697:126"),
			Prev:         "",
			Position2:    "/usr/include/sys/stdio.h:39:5",
			Name:         "renameat",
			Type:         "int (int, const char *, int, const char *)",
			Type2:        "",
			IsExtern:     false,
			IsImplicit:   false,
			IsUsed:       false,
			IsReferenced: false,
			IsStatic:     false,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x7fb5a90e9b70 </usr/include/stdio.h:244:6> col:6 implicit fprintf 'int (FILE *, const char *, ...)' extern`: &FunctionDecl{
			Addr:         0x7fb5a90e9b70,
			Pos:          NewPositionFromString("/usr/include/stdio.h:244:6"),
			Prev:         "",
			Position2:    "col:6",
			Name:         "fprintf",
			Type:         "int (FILE *, const char *, ...)",
			Type2:        "",
			IsExtern:     true,
			IsImplicit:   true,
			IsUsed:       false,
			IsReferenced: false,
			IsStatic:     false,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x7fb5a90e9d40 prev 0x7fb5a90e9b70 <col:1, /usr/include/sys/cdefs.h:351:63> /usr/include/stdio.h:244:6 fprintf 'int (FILE *, const char *, ...)'`: &FunctionDecl{
			Addr:         0x7fb5a90e9d40,
			Pos:          NewPositionFromString("col:1, /usr/include/sys/cdefs.h:351:63"),
			Prev:         "0x7fb5a90e9b70",
			Position2:    "/usr/include/stdio.h:244:6",
			Name:         "fprintf",
			Type:         "int (FILE *, const char *, ...)",
			Type2:        "",
			IsExtern:     false,
			IsImplicit:   false,
			IsUsed:       false,
			IsReferenced: false,
			IsStatic:     false,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x7fb5a90ec210 <line:259:6> col:6 implicit used printf 'int (const char *, ...)' extern`: &FunctionDecl{
			Addr:         0x7fb5a90ec210,
			Pos:          NewPositionFromString("line:259:6"),
			Prev:         "",
			Position2:    "col:6",
			Name:         "printf",
			Type:         "int (const char *, ...)",
			Type2:        "",
			IsExtern:     true,
			IsImplicit:   true,
			IsUsed:       true,
			IsReferenced: false,
			IsStatic:     false,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x2ae30d8 </usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54> <scratch space>:17:1 __acos 'double (double)' extern`: &FunctionDecl{
			Addr:         0x2ae30d8,
			Pos:          NewPositionFromString("/usr/include/math.h:65:3, /usr/include/x86_64-linux-gnu/sys/cdefs.h:57:54"),
			Prev:         "",
			Position2:    "<scratch space>:17:1",
			Name:         "__acos",
			Type:         "double (double)",
			Type2:        "",
			IsExtern:     true,
			IsImplicit:   false,
			IsUsed:       false,
			IsReferenced: false,
			IsStatic:     false,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x7fc595071500 <line:26:1, line:69:1> line:26:5 referenced main 'int (int, char **)'`: &FunctionDecl{
			Addr:         0x7fc595071500,
			Pos:          NewPositionFromString("line:26:1, line:69:1"),
			Prev:         "",
			Position2:    "line:26:5",
			Name:         "main",
			Type:         "int (int, char **)",
			Type2:        "",
			IsExtern:     false,
			IsImplicit:   false,
			IsUsed:       false,
			IsReferenced: true,
			IsStatic:     false,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x55973a008cb0 <line:93619:1, line:93630:1> line:93619:12 used exprIsConst 'int (Expr *, int, int)' static`: &FunctionDecl{
			Addr:         0x55973a008cb0,
			Pos:          NewPositionFromString("line:93619:1, line:93630:1"),
			Prev:         "",
			Position2:    "line:93619:12",
			Name:         "exprIsConst",
			Type:         "int (Expr *, int, int)",
			Type2:        "",
			IsExtern:     false,
			IsImplicit:   false,
			IsUsed:       true,
			IsReferenced: false,
			IsStatic:     true,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x563ade547cb8 <safe_math.h:13:1, line:25:1> line:14:2 safe_unary_minus_func_int8_t_s 'int8_t (int8_t)':'int8_t (int8_t)' static`: &FunctionDecl{
			Addr:         0x563ade547cb8,
			Pos:          NewPositionFromString("safe_math.h:13:1, line:25:1"),
			Prev:         "",
			Position2:    "line:14:2",
			Name:         "safe_unary_minus_func_int8_t_s",
			Type:         "int8_t (int8_t)",
			Type2:        "int8_t (int8_t)",
			IsExtern:     false,
			IsImplicit:   false,
			IsUsed:       false,
			IsReferenced: false,
			IsStatic:     true,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x556cac571be0 <tests/asm.c:9:1, line:13:1> line:9:26 sqlite3Hwtime1 'unsigned long (void)' inline`: &FunctionDecl{
			Addr:         0x556cac571be0,
			Pos:          NewPositionFromString("tests/asm.c:9:1, line:13:1"),
			Prev:         "",
			Position2:    "line:9:26",
			Name:         "sqlite3Hwtime1",
			Type:         "unsigned long (void)",
			Type2:        "",
			IsExtern:     false,
			IsImplicit:   false,
			IsUsed:       false,
			IsReferenced: false,
			IsStatic:     false,
			IsInline:     true,
			ChildNodes:   []Node{},
		},
		`0x21c3da0 <line:8201:1, line:8786:1> line:8201:25 used insertvertex 'enum insertvertexresult (struct mesh *, struct behavior *, vertex, struct otri *, struct osub *, int, int)'`: &FunctionDecl{
			Addr:         0x21c3da0,
			Pos:          NewPositionFromString("line:8201:1, line:8786:1"),
			Prev:         "",
			Position2:    "line:8201:25",
			Name:         "insertvertex",
			Type:         "enum insertvertexresult (struct mesh *, struct behavior *, vertex, struct otri *, struct osub *, int, int)",
			Type2:        "",
			IsExtern:     false,
			IsImplicit:   false,
			IsUsed:       true,
			IsReferenced: false,
			IsStatic:     false,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x30bdba8 parent 0x304fbb0 <col:3, col:38> col:30 used getinfo 'enum countries ()'`: &FunctionDecl{
			Addr:         0x30bdba8,
			Pos:          NewPositionFromString("col:3, col:38"),
			Prev:         "",
			Parent:       "0x304fbb0",
			Position2:    "col:30",
			Name:         "getinfo",
			Type:         "enum countries ()",
			Type2:        "",
			IsExtern:     false,
			IsImplicit:   false,
			IsUsed:       true,
			IsReferenced: false,
			IsStatic:     false,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
		`0x353d3b8 parent 0x31e9ba0 prev 0x33b0810 <col:2, col:30> col:22 used dmatrix 'double **(long, long, long, long)'`: &FunctionDecl{
			Addr:         0x353d3b8,
			Pos:          NewPositionFromString("col:2, col:30"),
			Prev:         "0x33b0810",
			Parent:       "0x31e9ba0",
			Position2:    "col:22",
			Name:         "dmatrix",
			Type:         "double **(long, long, long, long)",
			Type2:        "",
			IsExtern:     false,
			IsImplicit:   false,
			IsUsed:       true,
			IsReferenced: false,
			IsStatic:     false,
			IsInline:     false,
			ChildNodes:   []Node{},
		},
	}

	runNodeTests(t, nodes)
}