forked from include-what-you-use/include-what-you-use
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcc.symbols.imp
154 lines (153 loc) · 8.98 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
# 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 visibility on the symbol-name is ignored; by convension
# we always set it to private.
[
{ symbol: [ "blksize_t", private, "<sys/types.h>", public ] },
{ symbol: [ "blkcnt_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "blkcnt_t", private, "<sys/types.h>", public ] },
{ symbol: [ "blksize_t", private, "<sys/stat.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: [ "error_t", private, "<errno.h>", public ] },
{ symbol: [ "error_t", private, "<argp.h>", public ] },
{ symbol: [ "error_t", private, "<argz.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: [ "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, "<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: [ "id_t", private, "<sys/types.h>", public ] },
{ symbol: [ "id_t", private, "<sys/resource.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, "<sys/types.h>", public ] },
{ symbol: [ "int8_t", private, "<stdint.h>", public ] },
{ symbol: [ "intptr_t", private, "<stdint.h>", public ] },
{ symbol: [ "intptr_t", private, "<unistd.h>", public ] },
{ symbol: [ "key_t", private, "<sys/types.h>", public ] },
{ symbol: [ "key_t", private, "<sys/ipc.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/types.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/ipc.h>", public ] },
{ symbol: [ "mode_t", private, "<sys/mman.h>", public ] },
{ symbol: [ "nlink_t", private, "<sys/types.h>", public ] },
{ symbol: [ "nlink_t", private, "<sys/stat.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, "<unistd.h>", public ] },
{ symbol: [ "off_t", private, "<sys/stat.h>", public ] },
{ symbol: [ "off_t", private, "<sys/mman.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/types.h>", public ] },
{ symbol: [ "pid_t", private, "<unistd.h>", public ] },
{ symbol: [ "pid_t", private, "<signal.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/msg.h>", public ] },
{ symbol: [ "pid_t", private, "<sys/shm.h>", public ] },
{ symbol: [ "pid_t", private, "<termios.h>", public ] },
{ symbol: [ "pid_t", private, "<time.h>", public ] },
{ symbol: [ "pid_t", private, "<utmpx.h>", public ] },
{ symbol: [ "sigset_t", private, "<signal.h>", public ] },
{ symbol: [ "sigset_t", private, "<sys/epoll.h>", public ] },
{ symbol: [ "sigset_t", private, "<sys/select.h>", public ] },
{ symbol: [ "socklen_t", private, "<bits/socket.h>", private ] },
{ symbol: [ "socklen_t", private, "<unistd.h>", public ] },
{ symbol: [ "socklen_t", private, "<arpa/inet.h>", public ] },
{ symbol: [ "ssize_t", private, "<sys/types.h>", public ] },
{ symbol: [ "ssize_t", private, "<unistd.h>", public ] },
{ symbol: [ "ssize_t", private, "<monetary.h>", public ] },
{ symbol: [ "ssize_t", private, "<sys/msg.h>", public ] },
{ symbol: [ "suseconds_t", private, "<sys/types.h>", public ] },
{ symbol: [ "suseconds_t", private, "<sys/time.h>", public ] },
{ symbol: [ "suseconds_t", private, "<sys/select.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, "<unistd.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: [ "useconds_t", private, "<sys/types.h>", public ] },
{ symbol: [ "useconds_t", private, "<unistd.h>", public ] },
# glob.h seems to define size_t if necessary, but it should come from stddef.
{ symbol: [ "size_t", private, "<stddef.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, "<time.h>", public ] },
{ symbol: [ "size_t", private, "<wchar.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: [ "va_list", private, "<stdarg.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, "<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 ] }
]