forked from include-what-you-use/include-what-you-use
-
Notifications
You must be signed in to change notification settings - Fork 6
/
gcc.symbols.imp
293 lines (291 loc) · 17.1 KB
/
gcc.symbols.imp
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# For library symbols that can be defined in more than one header
# file, maps from symbol-name to legitimate header files.
# This list was generated via
# grep -R '__.*_defined' /usr/include | perl -nle 'm,/usr/include/([^:]*):#\s*\S+ __(.*)_defined, and print qq@ { symbol: [ "$2", public, "<$1>", public ] },@' | sort -u
# I ignored all entries that only appeared once on the list (eg uint32_t).
# I then added in NULL, which according to [diff.null] C.2.2.3, can
# be defined in <clocale>, <cstddef>, <cstdio>, <cstdlib>,
# <cstring>, <ctime>, or <cwchar>. We also allow their C
# equivalents.
# In each case, I ordered them so <sys/types.h> was first, if it was
# an option for this type. That's the preferred #include all else
# equal. The same goes for <stdint.h>. The visibility on the
# symbol-name is ignored; by convention we always set it to private.
[
{ symbol: [ "aiocb", private, "<aio.h>", public ] },
{ symbol: [ "blkcnt_t", private, "<sys/types.h>", public ] },
{ symbol: [ "blkcnt_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "blksize_t", private, "<sys/types.h>", public ] },
{ symbol: [ "blksize_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "cc_t", private, "<termios.h>", public ] },
{ symbol: [ "clock_t", private, "<sys/types.h>", public ] },
{ symbol: [ "clock_t", private, "<sys/time.h>", public ] },
{ symbol: [ "clock_t", private, "<time.h>", public ] },
{ symbol: [ "clockid_t", private, "<sys/types.h>", public ] },
{ symbol: [ "clockid_t", private, "<time.h>", public ] },
{ symbol: [ "daddr_t", private, "<sys/types.h>", public ] },
{ symbol: [ "daddr_t", private, "<rpc/types.h>", public ] },
{ symbol: [ "dev_t", private, "<sys/types.h>", public ] },
{ symbol: [ "dev_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "div_t", private, "<stdlib.h>", public ] },
{ symbol: [ "double_t", private, "<math.h>", public ] },
{ symbol: [ "error_t", private, "<errno.h>", public ] },
{ symbol: [ "error_t", private, "<argp.h>", public ] },
{ symbol: [ "error_t", private, "<argz.h>", public ] },
{ symbol: [ "fd_set", private, "<sys/select.h>", public ] },
{ symbol: [ "fd_set", private, "<sys/time.h>", public ] },
{ symbol: [ "fenv_t", private, "<fenv.h>", public ] },
{ symbol: [ "fexcept_t", private, "<fenv.h>", public ] },
{ symbol: [ "FILE", private, "<stdio.h>", public ] },
{ symbol: [ "FILE", private, "<wchar.h>", public ] },
{ symbol: [ "float_t", private, "<math.h>", public ] },
{ symbol: [ "fsblkcnt_t", private, "<sys/types.h>", public ] },
{ symbol: [ "fsblkcnt_t", private, "<sys/statvfs.h>", public ] },
{ symbol: [ "fsfilcnt_t", private, "<sys/types.h>", public ] },
{ symbol: [ "fsfilcnt_t", private, "<sys/statvfs.h>", public ] },
{ symbol: [ "getopt", private, "<unistd.h>", public ] },
{ symbol: [ "gid_t", private, "<sys/types.h>", public ] },
{ symbol: [ "gid_t", private, "<grp.h>", public ] },
{ symbol: [ "gid_t", private, "<pwd.h>", public ] },
{ symbol: [ "gid_t", private, "<signal.h>", public ] },
{ symbol: [ "gid_t", private, "<stropts.h>", public ] },
{ symbol: [ "gid_t", private, "<sys/ipc.h>", public ] },
{ symbol: [ "gid_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "gid_t", private, "<unistd.h>", public ] },
{ symbol: [ "htonl", private, "<arpa/inet.h>", public ] },
{ symbol: [ "htons", private, "<arpa/inet.h>", public ] },
{ symbol: [ "id_t", private, "<sys/types.h>", public ] },
{ symbol: [ "id_t", private, "<sys/resource.h>", public ] },
{ symbol: [ "imaxdiv_t", private, "<inttypes.h>", public ] },
{ symbol: [ "intmax_t", private, "<stdint.h>", public ] },
{ symbol: [ "uintmax_t", private, "<stdint.h>", public ] },
{ symbol: [ "ino64_t", private, "<sys/types.h>", public ] },
{ symbol: [ "ino64_t", private, "<dirent.h>", public ] },
{ symbol: [ "ino_t", private, "<sys/types.h>", public ] },
{ symbol: [ "ino_t", private, "<dirent.h>", public ] },
{ symbol: [ "ino_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "int8_t", private, "<stdint.h>", public ] },
{ symbol: [ "int16_t", private, "<stdint.h>", public ] },
{ symbol: [ "int32_t", private, "<stdint.h>", public ] },
{ symbol: [ "int64_t", private, "<stdint.h>", public ] },
{ symbol: [ "uint8_t", private, "<stdint.h>", public ] },
{ symbol: [ "uint16_t", private, "<stdint.h>", public ] },
{ symbol: [ "uint32_t", private, "<stdint.h>", public ] },
{ symbol: [ "uint64_t", private, "<stdint.h>", public ] },
{ symbol: [ "intptr_t", private, "<stdint.h>", public ] },
{ symbol: [ "uintptr_t", private, "<stdint.h>", public ] },
{ symbol: [ "iovec", private, "<sys/uio.h>", public ] },
{ symbol: [ "iovec", private, "<sys/socket.h>", public ] },
{ symbol: [ "itimerspec", private, "<time.h>", public ] },
{ symbol: [ "itimerspec", private, "<sys/timerfd.h>", public ] },
{ symbol: [ "key_t", private, "<sys/types.h>", public ] },
{ symbol: [ "key_t", private, "<sys/ipc.h>", public ] },
{ symbol: [ "lconv", private, "<locale.h>", public ] },
{ symbol: [ "ldiv_t", private, "<stdlib.h>", public ] },
{ symbol: [ "lldiv_t", private, "<stdlib.h>", public ] },
{ symbol: [ "max_align_t", private, "<stddef.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/types.h>", public ] },
{ symbol: [ "mode_t", private, "<fcntl.h>", public ] },
{ symbol: [ "mode_t", private, "<ndbm.h>", public ] },
{ symbol: [ "mode_t", private, "<spawn.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/ipc.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/mman.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "nlink_t", private, "<sys/types.h>", public ] },
{ symbol: [ "nlink_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "ntohl", private, "<arpa/inet.h>", public ] },
{ symbol: [ "ntohs", private, "<arpa/inet.h>", public ] },
{ symbol: [ "off64_t", private, "<sys/types.h>", public ] },
{ symbol: [ "off64_t", private, "<unistd.h>", public ] },
{ symbol: [ "off_t", private, "<sys/types.h>", public ] },
{ symbol: [ "off_t", private, "<aio.h>", public ] },
{ symbol: [ "off_t", private, "<fcntl.h>", public ] },
{ symbol: [ "off_t", private, "<stdio.h>", public ] },
{ symbol: [ "off_t", private, "<sys/mman.h>", public ] },
{ symbol: [ "off_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "off_t", private, "<unistd.h>", public ] },
{ symbol: [ "optarg", private, "<unistd.h>", public ] },
{ symbol: [ "opterr", private, "<unistd.h>", public ] },
{ symbol: [ "optind", private, "<unistd.h>", public ] },
{ symbol: [ "optopt", private, "<unistd.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/types.h>", public ] },
{ symbol: [ "pid_t", private, "<fcntl.h>", public ] },
{ symbol: [ "pid_t", private, "<sched.h>", public ] },
{ symbol: [ "pid_t", private, "<signal.h>", public ] },
{ symbol: [ "pid_t", private, "<spawn.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/msg.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/sem.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/shm.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/wait.h>", public ] },
{ symbol: [ "pid_t", private, "<termios.h>", public ] },
{ symbol: [ "pid_t", private, "<time.h>", public ] },
{ symbol: [ "pid_t", private, "<unistd.h>", public ] },
{ symbol: [ "pid_t", private, "<utmpx.h>", public ] },
{ symbol: [ "ptrdiff_t", private, "<stddef.h>", public ] },
{ symbol: [ "regex_t", private, "<regex.h>", public ] },
{ symbol: [ "regmatch_t", private, "<regex.h>", public ] },
{ symbol: [ "regoff_t", private, "<regex.h>", public ] },
{ symbol: [ "sigevent", private, "<signal.h>", public ] },
{ symbol: [ "sigevent", private, "<aio.h>", public ] },
{ symbol: [ "sigevent", private, "<mqueue.h>", public ] },
{ symbol: [ "sigevent", private, "<time.h>", public ] },
{ symbol: [ "siginfo_t", private, "<signal.h>", public ] },
{ symbol: [ "siginfo_t", private, "<sys/wait.h>", public ] },
{ symbol: [ "sigset_t", private, "<signal.h>", public ] },
{ symbol: [ "sigset_t", private, "<spawn.h>", public ] },
{ symbol: [ "sigset_t", private, "<sys/select.h>", public ] },
{ symbol: [ "sigval", private, "<signal.h>", public ] },
{ symbol: [ "sockaddr", private, "<sys/socket.h>", public ] },
{ symbol: [ "socklen_t", private, "<sys/socket.h>", public ] },
{ symbol: [ "socklen_t", private, "<netdb.h>", public ] },
{ symbol: [ "ssize_t", private, "<sys/types.h>", public ] },
{ symbol: [ "ssize_t", private, "<aio.h>", public ] },
{ symbol: [ "ssize_t", private, "<monetary.h>", public ] },
{ symbol: [ "ssize_t", private, "<mqueue.h>", public ] },
{ symbol: [ "ssize_t", private, "<stdio.h>", public ] },
{ symbol: [ "ssize_t", private, "<sys/msg.h>", public ] },
{ symbol: [ "ssize_t", private, "<sys/socket.h>", public ] },
{ symbol: [ "ssize_t", private, "<sys/uio.h>", public ] },
{ symbol: [ "ssize_t", private, "<unistd.h>", public ] },
{ symbol: [ "stat", private, "<sys/stat.h>", public ] },
{ symbol: [ "stat", private, "<ftw.h>", public ] },
{ symbol: [ "suseconds_t", private, "<sys/types.h>", public ] },
{ symbol: [ "suseconds_t", private, "<sys/select.h>", public ] },
{ symbol: [ "suseconds_t", private, "<sys/time.h>", public ] },
{ symbol: [ "time_t", private, "<time.h>", public ] },
{ symbol: [ "time_t", private, "<sched.h>", public ] },
{ symbol: [ "time_t", private, "<sys/msg.h>", public ] },
{ symbol: [ "time_t", private, "<sys/select.h>", public ] },
{ symbol: [ "time_t", private, "<sys/sem.h>", public ] },
{ symbol: [ "time_t", private, "<sys/shm.h>", public ] },
{ symbol: [ "time_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "time_t", private, "<sys/time.h>", public ] },
{ symbol: [ "time_t", private, "<sys/types.h>", public ] },
{ symbol: [ "time_t", private, "<utime.h>", public ] },
{ symbol: [ "timer_t", private, "<sys/types.h>", public ] },
{ symbol: [ "timer_t", private, "<time.h>", public ] },
{ symbol: [ "timespec", private, "<time.h>", public ] },
{ symbol: [ "timespec", private, "<aio.h>", public ] },
{ symbol: [ "timespec", private, "<mqueue.h>", public ] },
{ symbol: [ "timespec", private, "<sched.h>", public ] },
{ symbol: [ "timespec", private, "<signal.h>", public ] },
{ symbol: [ "timespec", private, "<sys/select.h>", public ] },
{ symbol: [ "timespec", private, "<sys/stat.h>", public ] },
{ symbol: [ "timeval", private, "<sys/time.h>", public ] },
{ symbol: [ "timeval", private, "<sys/resource.h>", public ] },
{ symbol: [ "timeval", private, "<sys/select.h>", public ] },
{ symbol: [ "timeval", private, "<utmpx.h>", public ] },
{ symbol: [ "tm", private, "<time.h>", public ] },
{ symbol: [ "u_char", private, "<sys/types.h>", public ] },
{ symbol: [ "u_char", private, "<rpc/types.h>", public ] },
{ symbol: [ "uid_t", private, "<sys/types.h>", public ] },
{ symbol: [ "uid_t", private, "<pwd.h>", public ] },
{ symbol: [ "uid_t", private, "<signal.h>", public ] },
{ symbol: [ "uid_t", private, "<stropts.h>", public ] },
{ symbol: [ "uid_t", private, "<sys/ipc.h>", public ] },
{ symbol: [ "uid_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "uid_t", private, "<unistd.h>", public ] },
{ symbol: [ "useconds_t", private, "<sys/types.h>", public ] },
{ symbol: [ "useconds_t", private, "<unistd.h>", public ] },
{ symbol: [ "wchar_t", private, "<stddef.h>", public ] },
{ symbol: [ "wchar_t", private, "<stdlib.h>", public ] },
{ symbol: [ "size_t", private, "<stddef.h>", public ] },
{ symbol: [ "size_t", private, "<aio.h>", public ] },
{ symbol: [ "size_t", private, "<glob.h>", public ] },
{ symbol: [ "size_t", private, "<grp.h>", public ] },
{ symbol: [ "size_t", private, "<iconv.h>", public ] },
{ symbol: [ "size_t", private, "<monetary.h>", public ] },
{ symbol: [ "size_t", private, "<mqueue.h>", public ] },
{ symbol: [ "size_t", private, "<ndbm.h>", public ] },
{ symbol: [ "size_t", private, "<pwd.h>", public ] },
{ symbol: [ "size_t", private, "<regex.h>", public ] },
{ symbol: [ "size_t", private, "<search.h>", public ] },
{ symbol: [ "size_t", private, "<signal.h>", public ] },
{ symbol: [ "size_t", private, "<stdio.h>", public ] },
{ symbol: [ "size_t", private, "<stdlib.h>", public ] },
{ symbol: [ "size_t", private, "<string.h>", public ] },
{ symbol: [ "size_t", private, "<strings.h>", public ] },
{ symbol: [ "size_t", private, "<sys/mman.h>", public ] },
{ symbol: [ "size_t", private, "<sys/msg.h>", public ] },
{ symbol: [ "size_t", private, "<sys/sem.h>", public ] },
{ symbol: [ "size_t", private, "<sys/shm.h>", public ] },
{ symbol: [ "size_t", private, "<sys/socket.h>", public ] },
{ symbol: [ "size_t", private, "<sys/types.h>", public ] },
{ symbol: [ "size_t", private, "<sys/uio.h>", public ] },
{ symbol: [ "size_t", private, "<time.h>", public ] },
{ symbol: [ "size_t", private, "<uchar.h>", public ] },
{ symbol: [ "size_t", private, "<unistd.h>", public ] },
{ symbol: [ "size_t", private, "<wchar.h>", public ] },
{ symbol: [ "size_t", private, "<wordexp.h>", public ] },
# Macros that can be defined in more than one file, don't have the
# same __foo_defined guard that other types do, so the grep above
# doesn't discover them. Until I figure out a better way, I just
# add them in by hand as I discover them.
{ symbol: [ "EOF", private, "<stdio.h>", public ] },
{ symbol: [ "EOF", private, "<libio.h>", public ] },
{ symbol: [ "FILE", private, "<stdio.h>", public ] },
{ symbol: [ "MAP_POPULATE", private, "<sys/mman.h>", public ] },
{ symbol: [ "MAP_POPULATE", private, "<linux/mman.h>", public ] },
{ symbol: [ "MAP_STACK", private, "<sys/mman.h>", public ] },
{ symbol: [ "MAP_STACK", private, "<linux/mman.h>", public ] },
{ symbol: [ "MAXHOSTNAMELEN", private, "<sys/param.h>", public ] },
{ symbol: [ "MAXHOSTNAMELEN", private, "<protocols/timed.h>", public ] },
{ symbol: [ "SIGABRT", private, "<signal.h>", public ] },
{ symbol: [ "SIGCHLD", private, "<signal.h>", public ] },
{ symbol: [ "SIGCHLD", private, "<linux/signal.h>", public ] },
{ symbol: [ "va_list", private, "<stdarg.h>", public ] },
{ symbol: [ "va_list", private, "<stdio.h>", public ] },
{ symbol: [ "va_list", private, "<wchar.h>", public ] },
# These are symbols that could be defined in either stdlib.h or
# malloc.h, but we always want the stdlib location.
{ symbol: [ "malloc", private, "<stdlib.h>", public ] },
{ symbol: [ "calloc", private, "<stdlib.h>", public ] },
{ symbol: [ "realloc", private, "<stdlib.h>", public ] },
{ symbol: [ "free", private, "<stdlib.h>", public ] },
# Entries for NULL
{ symbol: [ "NULL", private, "<stddef.h>", public ] }, # 'canonical' location for NULL
{ symbol: [ "NULL", private, "<clocale>", public ] },
{ symbol: [ "NULL", private, "<cstddef>", public ] },
{ symbol: [ "NULL", private, "<cstdio>", public ] },
{ symbol: [ "NULL", private, "<cstdlib>", public ] },
{ symbol: [ "NULL", private, "<cstring>", public ] },
{ symbol: [ "NULL", private, "<ctime>", public ] },
{ symbol: [ "NULL", private, "<cwchar>", public ] },
{ symbol: [ "NULL", private, "<locale.h>", public ] },
{ symbol: [ "NULL", private, "<stdio.h>", public ] },
{ symbol: [ "NULL", private, "<stdlib.h>", public ] },
{ symbol: [ "NULL", private, "<string.h>", public ] },
{ symbol: [ "NULL", private, "<time.h>", public ] },
{ symbol: [ "NULL", private, "<unistd.h>", public ] },
{ symbol: [ "NULL", private, "<wchar.h>", public ] },
# Kludge time: almost all STL types take an allocator, but they
# almost always use the default value. Usually we detect that
# and don't try to do IWYU, but sometimes it passes through.
# For instance, when adding two strings, we end up calling
# template<_CharT,_Traits,_Alloc> ... operator+(
# basic_string<_CharT,_Traits,_Alloc>, ...)
# These look like normal template args to us, so we see they're
# used and declare an iwyu dependency, even though we don't need
# to #include the traits or alloc type ourselves. The surest way
# to deal with this is to just say that everyone provides
# std::allocator. We can add more here at need.
{ symbol: [ "std::allocator", private, "<memory>", public ] },
{ symbol: [ "std::allocator", private, "<string>", public ] },
{ symbol: [ "std::allocator", private, "<vector>", public ] },
{ symbol: [ "std::allocator", private, "<map>", public ] },
{ symbol: [ "std::allocator", private, "<set>", public ] },
# A similar kludge for std::char_traits. basic_string,
# basic_ostream and basic_istream have this as a default template
# argument, and sometimes it bleeds through when clang desugars the
# string/ostream/istream type.
{ symbol: [ "std::char_traits", private, "<string>", public ] },
{ symbol: [ "std::char_traits", private, "<ostream>", public ] },
{ symbol: [ "std::char_traits", private, "<istream>", public ] },
{ symbol: [ "std::size_t", private, "<cstddef>", public ] },
{ symbol: [ "std::size_t", private, "<cstdio>", public ] },
{ symbol: [ "std::size_t", private, "<cstdlib>", public ] },
{ symbol: [ "std::size_t", private, "<cstring>", public ] },
{ symbol: [ "std::size_t", private, "<ctime>", public ] },
{ symbol: [ "std::size_t", private, "<cuchar>", public ] },
{ symbol: [ "std::size_t", private, "<cwchar>", public ] }
]